summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2019-02-12 23:33:01 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2019-02-12 23:33:01 +0100
commite54f09af5005581a49da5d42d53a6c8ef19127de (patch)
treeccdf6bb6558b7b12fbb092b62d0a07d0bd6cfefe
parent931b7b8faf9611f0c5d16f3e3a6ee8f5c7f7b1be (diff)
downloadorg-mode-e54f09af5005581a49da5d42d53a6c8ef19127de.tar.gz
org-macs: Fix visibility issue with file local variables
* lisp/org-macs.el (org-preserve-local-variables): When file local variables are preserved and located in a folded section, make sure to hide them again. Reported-by: Scott Randby <srandby@gmail.com> <http://lists.gnu.org/r/emacs-orgmode/2019-02/msg00105.html>
-rw-r--r--lisp/org-macs.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index d3e5932..4658d57 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -193,8 +193,16 @@ because otherwise all these markers will point to nowhere."
(when local-variables
(org-with-wide-buffer
(goto-char (point-max))
- (unless (bolp) (insert "\n"))
- (insert local-variables))))))
+ ;; If last section is folded, make sure to also hide file
+ ;; local variables after inserting them back.
+ (let ((overlay
+ (cl-find-if (lambda (o)
+ (eq 'outline (overlay-get o 'invisible)))
+ (overlays-at (1- (point))))))
+ (unless (bolp) (insert "\n"))
+ (insert local-variables)
+ (when overlay
+ (move-overlay overlay (overlay-start overlay) (point-max)))))))))
(defmacro org-no-popups (&rest body)
"Suppress popup windows and evaluate BODY."