unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo Liu <sdl.web@gmail.com>
To: djcb@djcbsoftware.nl
Cc: 16381@debbugs.gnu.org
Subject: bug#16381: 24.3.50; align issue
Date: Mon, 23 Jun 2014 22:24:34 +0800	[thread overview]
Message-ID: <m3r42fog9p.fsf@gmail.com> (raw)
In-Reply-To: <87ha9gvzdq.fsf@borealis.i-did-not-set--mail-host-address--so-tickle-me> (djcb@djcbsoftware.nl's message of "Tue, 07 Jan 2014 12:51:13 +0200")

On 2014-01-07 12:51 +0200, djcb@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





  reply	other threads:[~2014-06-23 14:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07 10:51 bug#16381: 24.3.50; align issue djcb
2014-06-23 14:24 ` Leo Liu [this message]
2014-06-23 15:38   ` Stefan Monnier
2014-06-23 23:15     ` Leo Liu
2014-06-24  5:54       ` Glenn Morris
2014-06-24 13:05         ` Leo Liu
2014-06-25 17:30           ` Glenn Morris
2014-06-25 23:56             ` Leo Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3r42fog9p.fsf@gmail.com \
    --to=sdl.web@gmail.com \
    --cc=16381@debbugs.gnu.org \
    --cc=djcb@djcbsoftware.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).