bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#16381: 24.3.50; align issue


From: Leo Liu
Subject: bug#16381: 24.3.50; align issue
Date: Mon, 23 Jun 2014 22:24:34 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (CentOS 6.5)

On 2014-01-07 12:51 +0200, address@hidden wrote:
> int foo (int bar)
> {
>   char flub;
>  
> }
>
> now mark the 'char flub' line, M-x align and we get:
>
> int foo (int bar)
> {
>   charflub;
>  
> }

This is broken by defaulting tab-stop-list to nil in revno: 114577.
Stefan, can I fix it as follows in emacs-24? Thanks, Leo.

=== modified file 'lisp/align.el'
--- lisp/align.el       2014-03-24 16:54:24 +0000
+++ lisp/align.el       2014-06-23 14:22:10 +0000
@@ -1130,13 +1130,8 @@
       column
     (if (not tab-stop)
        (+ column spacing)
-      (let ((stops tab-stop-list))
-       (while stops
-         (if (and (> (car stops) column)
-                  (= (setq spacing (1- spacing)) 0))
-             (setq column (car stops)
-                   stops nil)
-           (setq stops (cdr stops)))))
+      (dotimes (_ spacing)
+       (setq column (indent-next-tab-stop column)))
       column)))
 
 (defsubst align-column (pos)

=== modified file 'lisp/indent.el'
--- lisp/indent.el      2014-02-10 01:34:22 +0000
+++ lisp/indent.el      2014-06-23 12:43:33 +0000
@@ -249,7 +249,7 @@
   (indent-rigidly--pop-undo)
   (let* ((current (indent-rigidly--current-indentation beg end))
         (rtl (eq (current-bidi-paragraph-direction) 'right-to-left))
-        (next (indent--next-tab-stop current (if rtl nil 'prev))))
+        (next (indent-next-tab-stop current (if rtl nil 'prev))))
     (indent-rigidly beg end (- next current))))
 
 (defun indent-rigidly-right-to-tab-stop (beg end)
@@ -258,7 +258,7 @@
   (indent-rigidly--pop-undo)
   (let* ((current (indent-rigidly--current-indentation beg end))
         (rtl (eq (current-bidi-paragraph-direction) 'right-to-left))
-        (next (indent--next-tab-stop current (if rtl 'prev))))
+        (next (indent-next-tab-stop current (if rtl 'prev))))
     (indent-rigidly beg end (- next current))))
 
 (defun indent-line-to (column)
@@ -654,7 +654,7 @@
       (setq tab-stop-list tabs))
   (message "Tab stops installed"))
 
-(defun indent--next-tab-stop (column &optional prev)
+(defun indent-next-tab-stop (column &optional prev)
   "Return the next tab stop after COLUMN.
 If PREV is non-nil, return the previous one instead."
   (let ((tabs tab-stop-list))
@@ -684,7 +684,7 @@
   (interactive)
   (and abbrev-mode (= (char-syntax (preceding-char)) ?w)
        (expand-abbrev))
-  (let ((nexttab (indent--next-tab-stop (current-column))))
+  (let ((nexttab (indent-next-tab-stop (current-column))))
     (delete-horizontal-space t)
     (indent-to nexttab)))
 
@@ -693,7 +693,7 @@
 The variable `tab-stop-list' is a list of columns at which there are tab stops.
 Use \\[edit-tab-stops] to edit them interactively."
   (interactive)
-  (let ((nexttab (indent--next-tab-stop (current-column))))
+  (let ((nexttab (indent-next-tab-stop (current-column))))
     (let ((before (point)))
       (move-to-column nexttab t)
       (save-excursion





reply via email to

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