]> git.eshelyaron.com Git - emacs.git/commitdiff
Widen in indent-for-tab-command in the normal case, too
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 19 Dec 2017 23:42:49 +0000 (01:42 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 19 Dec 2017 23:42:49 +0000 (01:42 +0200)
Fixing this obvious omission.
* lisp/indent.el (indent--funcall-widened): New function.
(indent-for-tab-command): Use it.

lisp/indent.el

index ccf0e99c08b2908e551ffea779c1713a4651306a..400280f615a1d87ce02aa25c171c2081454fae8e 100644 (file)
@@ -142,13 +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)))
-            (save-restriction
-              (widen)
-              (funcall (default-value 'indent-line-function)))))
+            (indent--funcall-widened (default-value 'indent-line-function))))
 
       (cond
        ;; If the text was already indented right, try completion.
@@ -170,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