From fe4c6a852901ae5f00d320e214ce8ffefd301e7f Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 19 Oct 2016 20:08:09 +0200 Subject: [PATCH] Fix S-TAB when called on a block * lisp/org.el (org-cycle): Call `org-hide-block-toggle-maybe' after universal argument check. Also remove the function from `org-tab-first-hook' to that effect. --- lisp/org.el | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 992b27761..0108c6820 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6917,10 +6917,6 @@ if the variable `org-cycle-global-at-bob' is t." org-cycle-hook)) (pos (point))) - (when (or bob-special (equal arg '(4))) - ;; special case: use global cycling - (setq arg t)) - (cond ((equal arg '(16)) @@ -6932,6 +6928,11 @@ if the variable `org-cycle-global-at-bob' is t." (outline-show-all) (org-unlogged-message "Entire buffer visible, including drawers")) + ((equal arg '(4)) (org-cycle-internal-global)) + + ;; Try hiding block at point. + ((org-hide-block-toggle-maybe)) + ;; Try cdlatex TAB completion ((org-try-cdlatex-tab)) @@ -6944,11 +6945,10 @@ Use `\\[org-edit-special]' to edit table.el tables")) (org-table-justify-field-maybe) (call-interactively 'org-table-next-field)))) - ((run-hook-with-args-until-success - 'org-tab-after-check-for-table-hook)) + ((run-hook-with-args-until-success 'org-tab-after-check-for-table-hook)) ;; Global cycling: delegate to `org-cycle-internal-global'. - ((eq arg t) (org-cycle-internal-global)) + (bob-special (org-cycle-internal-global)) ;; Drawers: delegate to `org-flag-drawer'. ((save-excursion @@ -7556,8 +7556,6 @@ a block. Return a non-nil value when toggling is successful." (when (eq (overlay-get ov 'invisible) 'org-hide-block) (delete-overlay ov)))))))) -;; org-tab-after-check-for-cycling-hook -(add-hook 'org-tab-first-hook 'org-hide-block-toggle-maybe) ;; Remove overlays when changing major mode (add-hook 'org-mode-hook (lambda () (add-hook 'change-major-mode-hook -- 2.11.4.GIT