Don't move cursor when toggling folds in org-mode

This commit is contained in:
Henrik Lissner 2017-05-19 17:08:49 +02:00
parent dcc3b9a2fc
commit 6c3c40e41e

View file

@ -127,14 +127,16 @@ wrong places)."
"Toggle the local fold at the point (as opposed to cycling through all levels "Toggle the local fold at the point (as opposed to cycling through all levels
with `org-cycle'). Also removes babel result blocks, if run from a code block." with `org-cycle'). Also removes babel result blocks, if run from a code block."
(interactive) (interactive)
(org-babel-when-in-src-block (save-excursion
(call-interactively 'org-babel-remove-result-one-or-many)) (org-beginning-of-line)
(cond ((org-at-heading-p) (cond ((org-in-src-block-p)
(org-babel-remove-result))
((org-at-heading-p)
(outline-toggle-children)) (outline-toggle-children))
((org-at-item-p) ((org-at-item-p)
(let ((window-beg (window-start))) (let ((window-beg (window-start)))
(org-cycle) (org-cycle)
(set-window-start nil window-beg))))) (set-window-start nil window-beg))))))
;;;###autoload ;;;###autoload
(defun +org/toggle-checkbox () (defun +org/toggle-checkbox ()