Browse Source

org.el (org-mode-restart): Fix turning off `org-indent-mode' when necessary

* org.el (org-mode-restart): Fix turning off `org-indent-mode'
when necessary.
Nicolas Goaziou 6 years ago
parent
commit
d4b653656e
1 changed files with 5 additions and 4 deletions
  1. 5 4
      lisp/org.el

+ 5 - 4
lisp/org.el

@@ -20365,11 +20365,12 @@ This command does many different things, depending on context:
 		"C-c C-c can do nothing useful at this location")))))))))
 
 (defun org-mode-restart ()
-  "Restart Org-mode, to scan again for special lines.
-Also updates the keyword regular expressions and file variables."
   (interactive)
-  (funcall major-mode)
-  (hack-local-variables)
+  (let ((indent-status (org-bound-and-true-p org-indent-mode)))
+    (funcall major-mode)
+    (hack-local-variables)
+    (when (and indent-status (not (org-bound-and-true-p org-indent-mode)))
+      (org-indent-mode -1)))
   (message "%s restarted" major-mode))
 
 (defun org-kill-note-or-show-branches ()