summaryrefslogtreecommitdiff
path: root/lisp/indent.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/indent.el')
-rw-r--r--lisp/indent.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/indent.el b/lisp/indent.el
index d5ba0bd8491..400280f615a 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))
@@ -140,11 +142,11 @@ prefix argument is ignored."
(old-indent (current-indentation)))
;; Indent the line.
- (or (not (eq (funcall indent-line-function) 'noindent))
+ (or (not (eq (indent--funcall-widened indent-line-function) 'noindent))
(indent--default-inside-comment)
(when (or (<= (current-column) (current-indentation))
(not (eq tab-always-indent 'complete)))
- (funcall (default-value 'indent-line-function))))
+ (indent--funcall-widened (default-value 'indent-line-function))))
(cond
;; If the text was already indented right, try completion.
@@ -166,6 +168,11 @@ prefix argument is ignored."
(< (point) end-marker))
(indent-rigidly (point) end-marker indentation-change))))))))))
+(defun indent--funcall-widened (func)
+ (save-restriction
+ (widen)
+ (funcall func)))
+
(defun insert-tab (&optional arg)
(let ((count (prefix-numeric-value arg)))
(if (and abbrev-mode
@@ -538,7 +545,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)))