emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] widen-less b9fbc03: Widen in indent-for-tab-command in the


From: Dmitry Gutov
Subject: [Emacs-diffs] widen-less b9fbc03: Widen in indent-for-tab-command in the normal case, too
Date: Tue, 19 Dec 2017 18:43:09 -0500 (EST)

branch: widen-less
commit b9fbc03b862413bfee2728b1760f959bfc912e56
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    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.
---
 lisp/indent.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lisp/indent.el b/lisp/indent.el
index ccf0e99..400280f 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]