emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 8217998 1/2: Preserve nonblank whitespace when inde


From: Noam Postavsky
Subject: [Emacs-diffs] master 8217998 1/2: Preserve nonblank whitespace when indenting (Bug#32200)
Date: Sun, 22 Jul 2018 11:08:58 -0400 (EDT)

branch: master
commit 8217998b0d59ec491116250c6a10f46052a21ef8
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Preserve nonblank whitespace when indenting (Bug#32200)
    
    * lisp/indent.el (indent-line-to): Remove only spaces and tabs, not
    any whitespace syntax characters.
---
 lisp/indent.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/indent.el b/lisp/indent.el
index 4506321..73a7d0e 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -292,7 +292,8 @@ indentation by specifying a large negative ARG."
   "Indent current line to COLUMN.
 This function removes or adds spaces and tabs at beginning of line
 only if necessary.  It leaves point at end of indentation."
-  (back-to-indentation)
+  (beginning-of-line 1)
+  (skip-chars-forward " \t")
   (let ((cur-col (current-column)))
     (cond ((< cur-col column)
           (if (>= (- column (* (/ cur-col tab-width) tab-width)) tab-width)
@@ -303,8 +304,10 @@ only if necessary.  It leaves point at end of indentation."
            (delete-region (progn (move-to-column column t) (point))
                           ;; The `move-to-column' call may replace
                           ;; tabs with spaces, so we can't reuse the
-                          ;; previous `back-to-indentation' point.
-                          (progn (back-to-indentation) (point)))))))
+                          ;; previous start point.
+                          (progn (beginning-of-line 1)
+                                 (skip-chars-forward " \t")
+                                 (point)))))))
 
 (defun current-left-margin ()
   "Return the left margin to use for this line.



reply via email to

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