GNU bug report logs - #16381
24.3.50; align issue

Previous Next

Package: emacs;

Reported by: djcb <at> djcbsoftware.nl

Date: Tue, 7 Jan 2014 10:53:02 UTC

Severity: important

Tags: confirmed

Found in version 24.3.50

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Leo Liu <sdl.web <at> gmail.com>
To: djcb <at> djcbsoftware.nl
Cc: 16381 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#16381: 24.3.50; align issue
Date: Mon, 23 Jun 2014 22:24:34 +0800
On 2014-01-07 12:51 +0200, djcb <at> djcbsoftware.nl 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




This bug report was last modified 11 years and 28 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.