summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-01-30 10:18:24 (GMT)
committer Bastien Guerry <bzg@altern.org>2013-01-30 10:18:24 (GMT)
commit6d06bcfcbca93a05c43b0b5fb2a0e8b374da295c (patch)
tree49154212af8053435842c03bc0910afe697da268
parent35f944aaf06cf4403fa99df030483c17b03aad44 (diff)
downloadorg-mode-6d06bcfcbca93a05c43b0b5fb2a0e8b374da295c.zip
org-mode-6d06bcfcbca93a05c43b0b5fb2a0e8b374da295c.tar.gz
org.el: Always honor `org-startup-indented', even when `org-inhibit-startup' is non-nil
* org.el (org-mode): Always honor `org-startup-indented', even when `org-inhibit-startup' is non-nil. * org-indent.el (org-indent-mode): Don't check `org-inhibit-startup'. Thanks to Carsten for suggesting this.
-rw-r--r--lisp/org-indent.el123
-rw-r--r--lisp/org.el4
2 files changed, 62 insertions, 65 deletions
diff --git a/lisp/org-indent.el b/lisp/org-indent.el
index 054ccb0..d5f17b2 100644
--- a/lisp/org-indent.el
+++ b/lisp/org-indent.el
@@ -159,69 +159,68 @@ properties, after each buffer modification, on the modified zone.
The process is synchronous. Though, initial indentation of
buffer, which can take a few seconds on large buffers, is done
-during idle time." nil " Ind" nil
-(cond
- ((org-bound-and-true-p org-inhibit-startup)
- (setq org-indent-mode nil))
- ((and org-indent-mode (featurep 'xemacs))
- (message "org-indent-mode does not work in XEmacs - refusing to turn it on")
- (setq org-indent-mode nil))
- ((and org-indent-mode
- (not (org-version-check "23.1.50" "Org Indent mode" :predicate)))
- (message "org-indent-mode can crash Emacs 23.1 - refusing to turn it on!")
- (ding)
- (sit-for 1)
- (setq org-indent-mode nil))
- (org-indent-mode
- ;; mode was turned on.
- (org-set-local 'indent-tabs-mode nil)
- (or org-indent-strings (org-indent-initialize))
- (org-set-local 'org-indent-initial-marker (copy-marker 1))
- (when org-indent-mode-turns-off-org-adapt-indentation
- (org-set-local 'org-adapt-indentation nil))
- (when org-indent-mode-turns-on-hiding-stars
- (org-set-local 'org-hide-leading-stars-before-indent-mode
- org-hide-leading-stars)
- (org-set-local 'org-hide-leading-stars t))
- (make-local-variable 'filter-buffer-substring-functions)
- (add-hook 'filter-buffer-substring-functions
- (lambda (fun start end delete)
- (org-indent-remove-properties-from-string
- (funcall fun start end delete))))
- (org-add-hook 'after-change-functions 'org-indent-refresh-maybe nil 'local)
- (org-add-hook 'before-change-functions
- 'org-indent-notify-modified-headline nil 'local)
- (and font-lock-mode (org-restart-font-lock))
- (org-indent-remove-properties (point-min) (point-max))
- ;; Submit current buffer to initialize agent. If it's the first
- ;; buffer submitted, also start the agent. Current buffer is
- ;; pushed in both cases to avoid a race condition.
- (if org-indent-agentized-buffers
+during idle time."
+ nil " Ind" nil
+ (cond
+ ((and org-indent-mode (featurep 'xemacs))
+ (message "org-indent-mode does not work in XEmacs - refusing to turn it on")
+ (setq org-indent-mode nil))
+ ((and org-indent-mode
+ (not (org-version-check "23.1.50" "Org Indent mode" :predicate)))
+ (message "org-indent-mode can crash Emacs 23.1 - refusing to turn it on!")
+ (ding)
+ (sit-for 1)
+ (setq org-indent-mode nil))
+ (org-indent-mode
+ ;; mode was turned on.
+ (org-set-local 'indent-tabs-mode nil)
+ (or org-indent-strings (org-indent-initialize))
+ (org-set-local 'org-indent-initial-marker (copy-marker 1))
+ (when org-indent-mode-turns-off-org-adapt-indentation
+ (org-set-local 'org-adapt-indentation nil))
+ (when org-indent-mode-turns-on-hiding-stars
+ (org-set-local 'org-hide-leading-stars-before-indent-mode
+ org-hide-leading-stars)
+ (org-set-local 'org-hide-leading-stars t))
+ (make-local-variable 'filter-buffer-substring-functions)
+ (add-hook 'filter-buffer-substring-functions
+ (lambda (fun start end delete)
+ (org-indent-remove-properties-from-string
+ (funcall fun start end delete))))
+ (org-add-hook 'after-change-functions 'org-indent-refresh-maybe nil 'local)
+ (org-add-hook 'before-change-functions
+ 'org-indent-notify-modified-headline nil 'local)
+ (and font-lock-mode (org-restart-font-lock))
+ (org-indent-remove-properties (point-min) (point-max))
+ ;; Submit current buffer to initialize agent. If it's the first
+ ;; buffer submitted, also start the agent. Current buffer is
+ ;; pushed in both cases to avoid a race condition.
+ (if org-indent-agentized-buffers
+ (push (current-buffer) org-indent-agentized-buffers)
(push (current-buffer) org-indent-agentized-buffers)
- (push (current-buffer) org-indent-agentized-buffers)
- (setq org-indent-agent-timer
- (run-with-idle-timer 0.2 t #'org-indent-initialize-agent))))
- (t
- ;; mode was turned off (or we refused to turn it on)
- (kill-local-variable 'org-adapt-indentation)
- (setq org-indent-agentized-buffers
- (delq (current-buffer) org-indent-agentized-buffers))
- (when (markerp org-indent-initial-marker)
- (set-marker org-indent-initial-marker nil))
- (when (boundp 'org-hide-leading-stars-before-indent-mode)
- (org-set-local 'org-hide-leading-stars
- org-hide-leading-stars-before-indent-mode))
- (remove-hook 'filter-buffer-substring-functions
- (lambda (fun start end delete)
- (org-indent-remove-properties-from-string
- (funcall fun start end delete))))
- (remove-hook 'after-change-functions 'org-indent-refresh-maybe 'local)
- (remove-hook 'before-change-functions
- 'org-indent-notify-modified-headline 'local)
- (org-with-wide-buffer
- (org-indent-remove-properties (point-min) (point-max)))
- (and font-lock-mode (org-restart-font-lock))
- (redraw-display))))
+ (setq org-indent-agent-timer
+ (run-with-idle-timer 0.2 t #'org-indent-initialize-agent))))
+ (t
+ ;; mode was turned off (or we refused to turn it on)
+ (kill-local-variable 'org-adapt-indentation)
+ (setq org-indent-agentized-buffers
+ (delq (current-buffer) org-indent-agentized-buffers))
+ (when (markerp org-indent-initial-marker)
+ (set-marker org-indent-initial-marker nil))
+ (when (boundp 'org-hide-leading-stars-before-indent-mode)
+ (org-set-local 'org-hide-leading-stars
+ org-hide-leading-stars-before-indent-mode))
+ (remove-hook 'filter-buffer-substring-functions
+ (lambda (fun start end delete)
+ (org-indent-remove-properties-from-string
+ (funcall fun start end delete))))
+ (remove-hook 'after-change-functions 'org-indent-refresh-maybe 'local)
+ (remove-hook 'before-change-functions
+ 'org-indent-notify-modified-headline 'local)
+ (org-with-wide-buffer
+ (org-indent-remove-properties (point-min) (point-max)))
+ (and font-lock-mode (org-restart-font-lock))
+ (redraw-display))))
(defun org-indent-indent-buffer ()
"Add indentation properties to the accessible part of the buffer."
diff --git a/lisp/org.el b/lisp/org.el
index 1c6f329..ca751a7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4915,6 +4915,7 @@ The following commands are available:
(org-set-local 'calc-embedded-open-mode "# ")
(modify-syntax-entry ?@ "w")
(if org-startup-truncated (setq truncate-lines t))
+ (when org-startup-indented (require 'org-indent) (org-indent-mode 1))
(org-set-local 'font-lock-unfontify-region-function
'org-unfontify-region)
;; Activate before-change-function
@@ -4996,9 +4997,6 @@ The following commands are available:
(set-buffer-modified-p bmp)))
(when org-startup-with-inline-images
(org-display-inline-images))
- (when org-startup-indented
- (require 'org-indent)
- (org-indent-mode 1))
(unless org-inhibit-startup-visibility-stuff
(org-set-startup-visibility)))
;; Try to set org-hide correctly