Skip to content

Commit

Permalink
Fix: (org-sidebar-tree-toggle) Toggle tree sidebar off properly
Browse files Browse the repository at this point in the history
I think I broke this in the previous fix by omitting pre-first-heading
content from the sidebar when it displays the whole buffer, which
caused the comparison of the buffers' point-min to fail.

Fixes #34.  Thanks to Matt Price (@titaniumbones) and @MKB6 for
reporting.

Released as 0.3.2.
  • Loading branch information
alphapapa committed Oct 30, 2020
1 parent 4d8f6fc commit cb14edc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ Display a sidebar for ~org-ql~ ~QUERY~. Interactively, with prefix, prompt for
:TOC: 0
:END:

** 0.3.2

*Fixed*
+ Command =org-sidebar-tree-toggle= didn't always toggle the tree sidebar off. (Fixes [[https://github.com/alphapapa/org-sidebar/issues/34][#34]]. Thanks to [[https://github.com/titaniumbones][Matt Price]] and [[https://github.com/mkb6][mkb6]] for reporting.)

** 0.3.1

*Fixed*
Expand Down
6 changes: 4 additions & 2 deletions org-sidebar.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

;; Author: Adam Porter <[email protected]>
;; URL: https://github.com/alphapapa/org-sidebar
;; Version: 0.3.1
;; Version: 0.3.2
;; Package-Requires: ((emacs "26.1") (s "1.10.0") (dash "2.13") (dash-functional "1.2.0") (org "9.0") (org-ql "0.2") (org-super-agenda "1.0"))
;; Keywords: hypermedia, outlines, Org, agenda

Expand Down Expand Up @@ -509,13 +509,15 @@ If it is open and shows the view for the current buffer, delete
it. Otherwise, show it for current buffer."
(interactive)
(let* ((parent-point-min (point-min))
(parent-point-max (point-max))
(parent-buffer (or (buffer-base-buffer)
(current-buffer)))
(tree-window (--first (window-parameter it 'org-sidebar-tree-window)
(window-at-side-list nil org-sidebar-tree-side))))
(if (and tree-window
(with-current-buffer (window-buffer tree-window)
(and (eq parent-point-min (point-min))
(and (<= parent-point-min (point-min))
(= parent-point-max (point-max))
(or (eq parent-buffer (buffer-base-buffer))
(eq parent-buffer (current-buffer))))))
;; Tree displays current buffer: delete tree window.
Expand Down

0 comments on commit cb14edc

Please sign in to comment.