Indent-mode: Disable in Emacs 21 and earlier
* lisp/org-indent.el (org-indent-mode): Refuse to turn on prior to Emacs 23.2
This commit is contained in:
parent
3c4b18c00c
commit
040b2aa6b2
11
doc/org.texi
11
doc/org.texi
|
@ -12687,12 +12687,11 @@ more text | more text
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
|
|
||||||
If you are using at least Emacs 23.2 and version 6.29 of Org, this kind of
|
If you are using at least Emacs 23.2@footnote{Emacs 23.1 can actually crash
|
||||||
view can be achieved dynamically at display time using
|
with @code{org-indent-mode}} and version 6.29 of Org, this kind of view can
|
||||||
@code{org-indent-mode}. @i{Using this with earlier versions of Emacs can
|
be achieved dynamically at display time using @code{org-indent-mode}. In
|
||||||
lead to crashes.} In this minor
|
this minor mode, all lines are prefixed for display with the necessary amount
|
||||||
mode, all lines are prefixed for display with the necessary amount of
|
of space@footnote{@code{org-indent-mode} also sets the @code{wrap-prefix}
|
||||||
space@footnote{@code{org-indent-mode} also sets the @code{wrap-prefix}
|
|
||||||
property, such that @code{visual-line-mode} (or purely setting
|
property, such that @code{visual-line-mode} (or purely setting
|
||||||
@code{word-wrap}) wraps long lines (including headlines) correctly indented.
|
@code{word-wrap}) wraps long lines (including headlines) correctly indented.
|
||||||
}. Also headlines are prefixed with additional stars, so that the amount of
|
}. Also headlines are prefixed with additional stars, so that the amount of
|
||||||
|
|
|
@ -127,45 +127,56 @@ Internally this works by adding `line-prefix' properties to all non-headlines.
|
||||||
These properties are updated locally in idle time.
|
These properties are updated locally in idle time.
|
||||||
FIXME: How to update when broken?"
|
FIXME: How to update when broken?"
|
||||||
nil " Ind" nil
|
nil " Ind" nil
|
||||||
(if (org-bound-and-true-p org-inhibit-startup)
|
(cond
|
||||||
(setq org-indent-mode nil)
|
((org-bound-and-true-p org-inhibit-startup)
|
||||||
(if org-indent-mode
|
(setq org-indent-mode nil))
|
||||||
(progn
|
((and org-indent-mode
|
||||||
(org-set-local 'indent-tabs-mode nil)
|
(or (< emacs-major-version 23)
|
||||||
(or org-indent-strings (org-indent-initialize))
|
(and (= emacs-major-version 23)
|
||||||
(when org-indent-mode-turns-off-org-adapt-indentation
|
(< emacs-minor-version 2))))
|
||||||
(org-set-local 'org-adapt-indentation nil))
|
(message "org-indent-mode is can crash Emacs 23.1 - refused to turn it on!")
|
||||||
(when org-indent-mode-turns-on-hiding-stars
|
(ding)
|
||||||
(org-set-local 'org-hide-leading-stars-before-indent-mode
|
(sit-for 1)
|
||||||
org-hide-leading-stars)
|
(setq org-indent-mode nil))
|
||||||
(org-set-local 'org-hide-leading-stars t))
|
(org-indent-mode
|
||||||
(make-local-variable 'buffer-substring-filters)
|
;; mode was turned on.
|
||||||
(add-to-list 'buffer-substring-filters
|
(org-set-local 'indent-tabs-mode nil)
|
||||||
'org-indent-remove-properties-from-string)
|
(or org-indent-strings (org-indent-initialize))
|
||||||
(org-add-hook 'org-after-demote-entry-hook
|
(when org-indent-mode-turns-off-org-adapt-indentation
|
||||||
'org-indent-refresh-section nil 'local)
|
(org-set-local 'org-adapt-indentation nil))
|
||||||
(org-add-hook 'org-after-promote-entry-hook
|
(when org-indent-mode-turns-on-hiding-stars
|
||||||
'org-indent-refresh-section nil 'local)
|
(org-set-local 'org-hide-leading-stars-before-indent-mode
|
||||||
(org-add-hook 'org-font-lock-hook
|
org-hide-leading-stars)
|
||||||
'org-indent-refresh-to nil 'local)
|
(org-set-local 'org-hide-leading-stars t))
|
||||||
(and font-lock-mode (org-restart-font-lock))
|
(make-local-variable 'buffer-substring-filters)
|
||||||
)
|
(add-to-list 'buffer-substring-filters
|
||||||
(save-excursion
|
'org-indent-remove-properties-from-string)
|
||||||
(save-restriction
|
(org-add-hook 'org-after-demote-entry-hook
|
||||||
(org-indent-remove-properties (point-min) (point-max))
|
'org-indent-refresh-section nil 'local)
|
||||||
(kill-local-variable 'org-adapt-indentation)
|
(org-add-hook 'org-after-promote-entry-hook
|
||||||
(when (boundp 'org-hide-leading-stars-before-indent-mode)
|
'org-indent-refresh-section nil 'local)
|
||||||
(org-set-local 'org-hide-leading-stars
|
(org-add-hook 'org-font-lock-hook
|
||||||
org-hide-leading-stars-before-indent-mode))
|
'org-indent-refresh-to nil 'local)
|
||||||
(setq buffer-substring-filters
|
(and font-lock-mode (org-restart-font-lock))
|
||||||
(delq 'org-indent-remove-properties-from-string
|
)
|
||||||
buffer-substring-filters))
|
(t
|
||||||
(remove-hook 'org-after-promote-entry-hook
|
;; mode was turned off (or we refused to turn it on)
|
||||||
'org-indent-refresh-section 'local)
|
(save-excursion
|
||||||
(remove-hook 'org-after-demote-entry-hook
|
(save-restriction
|
||||||
'org-indent-refresh-section 'local)
|
(org-indent-remove-properties (point-min) (point-max))
|
||||||
(and font-lock-mode (org-restart-font-lock))
|
(kill-local-variable 'org-adapt-indentation)
|
||||||
(redraw-display))))))
|
(when (boundp 'org-hide-leading-stars-before-indent-mode)
|
||||||
|
(org-set-local 'org-hide-leading-stars
|
||||||
|
org-hide-leading-stars-before-indent-mode))
|
||||||
|
(setq buffer-substring-filters
|
||||||
|
(delq 'org-indent-remove-properties-from-string
|
||||||
|
buffer-substring-filters))
|
||||||
|
(remove-hook 'org-after-promote-entry-hook
|
||||||
|
'org-indent-refresh-section 'local)
|
||||||
|
(remove-hook 'org-after-demote-entry-hook
|
||||||
|
'org-indent-refresh-section 'local)
|
||||||
|
(and font-lock-mode (org-restart-font-lock))
|
||||||
|
(redraw-display))))))
|
||||||
|
|
||||||
|
|
||||||
(defface org-indent
|
(defface org-indent
|
||||||
|
|
Loading…
Reference in New Issue