Widen in indent-for-tab-command in the normal case, too

Fixing this obvious omission.
* lisp/indent.el (indent--funcall-widened): New function.
(indent-for-tab-command): Use it.
This commit is contained in:
Dmitry Gutov 2017-12-20 01:42:49 +02:00
parent 446faf3efa
commit b9fbc03b86

View file

@ -142,13 +142,11 @@ prefix argument is ignored."
(old-indent (current-indentation))) (old-indent (current-indentation)))
;; Indent the line. ;; 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) (indent--default-inside-comment)
(when (or (<= (current-column) (current-indentation)) (when (or (<= (current-column) (current-indentation))
(not (eq tab-always-indent 'complete))) (not (eq tab-always-indent 'complete)))
(save-restriction (indent--funcall-widened (default-value 'indent-line-function))))
(widen)
(funcall (default-value 'indent-line-function)))))
(cond (cond
;; If the text was already indented right, try completion. ;; If the text was already indented right, try completion.
@ -170,6 +168,11 @@ prefix argument is ignored."
(< (point) end-marker)) (< (point) end-marker))
(indent-rigidly (point) end-marker indentation-change)))))))))) (indent-rigidly (point) end-marker indentation-change))))))))))
(defun indent--funcall-widened (func)
(save-restriction
(widen)
(funcall func)))
(defun insert-tab (&optional arg) (defun insert-tab (&optional arg)
(let ((count (prefix-numeric-value arg))) (let ((count (prefix-numeric-value arg)))
(if (and abbrev-mode (if (and abbrev-mode