Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when starting or saving in narrow buffer #14

Open
basaran opened this issue Jul 2, 2022 · 1 comment · May be fixed by #15
Open

error when starting or saving in narrow buffer #14

basaran opened this issue Jul 2, 2022 · 1 comment · May be fixed by #15

Comments

@basaran
Copy link

basaran commented Jul 2, 2022

Hello,

org-ol-tree has a great feature prefix to narrow to buffer. But when you save or open the org-ol-tree in narrow state, it throws an error (treemacs related). It should probably widen on refresh/build actions and possibly narrow it back on the buffer. My lisp is limited but I found this:

(defun narrow-p ()
  "Return t if a buffer is narrowed"
   (not (equal (- (point-max) (point-min)) (buffer-size))))

and adding this to org-ol-tree ()

(if (narrow-p)
      (widen))

Another option might also be to add an org-hook to widen the buffer prior to saving it, and narrow it later. What do you think?

@basaran
Copy link
Author

basaran commented Jul 2, 2022

I think I found a better way to handle this with save-restriction, I can send a pull release if you would like to review?

@basaran basaran linked a pull request Jul 2, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant