summaryrefslogtreecommitdiff
path: root/lisp/indent.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2017-12-14 11:18:51 +0200
committerDmitry Gutov <dgutov@yandex.ru>2017-12-14 11:18:51 +0200
commit7e9eef0ffd90cd7e39f15b003e4a9770be27b0ce (patch)
tree65c46eac3785849457ba9d989ed4acf19b3e8fac /lisp/indent.el
parent6067f0c702e3652a9d489852752f038320cb91ae (diff)
downloademacs-7e9eef0ffd90cd7e39f15b003e4a9770be27b0ce.tar.gz
Consolidate 'widen' calls
* lisp/progmodes/prog-mode.el (prog-indentation-context): Un-document all elements but the first. (prog-widen): Remove. (http://lists.gnu.org/archive/html/emacs-devel/2017-12/msg00321.html) * doc/lispref/text.texi (Mode-Specific Indent): Update. * lisp/progmodes/ruby-mode.el (ruby-calculate-indent): Don't call widen. * lisp/progmodes/python.el (python-indent-guess-indent-offset) (python-info-current-defun): Replace prog-widen with widen; these functions are not called during indentation. (python-indent-context) (python-indent--calculate-indentation) (python-info-dedenter-opening-block-message) (python-info-line-ends-backslash-p) (python-info-beginning-of-backslash) (python-info-continuation-line-p) (python-info-current-defun): Remove 'widen' calls. * lisp/indent.el (indent-according-to-mode) (indent-for-tab-command, indent-region): Move them here. * lisp/textmodes/mhtml-mode.el (mhtml-indent-line): Bind prog-indentation-context to one-element list.
Diffstat (limited to 'lisp/indent.el')
-rw-r--r--lisp/indent.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/indent.el b/lisp/indent.el
index d5ba0bd8491..ccf0e99c08b 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -69,6 +69,8 @@ variable is `indent-relative' or `indent-relative-maybe', handle
it specially (since those functions are used for tabbing); in
that case, indent by aligning to the previous non-blank line."
(interactive)
+ (save-restriction
+ (widen)
(syntax-propertize (line-end-position))
(if (memq indent-line-function
'(indent-relative indent-relative-maybe))
@@ -84,7 +86,7 @@ that case, indent by aligning to the previous non-blank line."
(indent-line-to column)
(save-excursion (indent-line-to column))))
;; The normal case.
- (funcall indent-line-function)))
+ (funcall indent-line-function))))
(defun indent--default-inside-comment ()
(unless (or (> (current-column) (current-indentation))
@@ -144,7 +146,9 @@ prefix argument is ignored."
(indent--default-inside-comment)
(when (or (<= (current-column) (current-indentation))
(not (eq tab-always-indent 'complete)))
- (funcall (default-value 'indent-line-function))))
+ (save-restriction
+ (widen)
+ (funcall (default-value 'indent-line-function)))))
(cond
;; If the text was already indented right, try completion.
@@ -538,7 +542,9 @@ column to indent to; if it is nil, use one of the three methods above."
(forward-line 1)))))
;; Use indent-region-function is available.
(indent-region-function
- (funcall indent-region-function start end))
+ (save-restriction
+ (widen)
+ (funcall indent-region-function start end)))
;; Else, use a default implementation that calls indent-line-function on
;; each line.
(t (indent-region-line-by-line start end)))