GNU bug report logs -
#16381
24.3.50; align issue
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16381 in the body.
You can then email your comments to 16381 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16381
; Package
emacs
.
(Tue, 07 Jan 2014 10:53:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
djcb <at> djcbsoftware.nl
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 07 Jan 2014 10:53:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
When trying this with a simple c-program, it seems the `align' function
has changed behavior since 24.3; it no longer (by default at least)
gives at least one space, and in some cases actually breaks the code by
concatenating the type and variable name. E.g. write some like this
(after emacs -Q test.c)
int foo (int bar)
{
char flub;
}
now mark the 'char flub' line, M-x align and we get:
int foo (int bar)
{
charflub;
}
which gcc doesn't really appreciate. In general it seems that align does
not insert at least one space between type and variable in c-mode.
In GNU Emacs 24.3.50.5 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.6)
of 2014-01-07 on borealis
Windowing system distributor `Fedora Project', version 11.0.11404000
System Description: Fedora release 20 (Heisenbug)
Important settings:
value of $LC_ALL: en_US.UTF-8
value of $LC_MESSAGES: en_US.UTF-8
value of $LC_MONETARY: en_DK.utf8
value of $LC_NUMERIC: en_DK.utf8
value of $LC_TIME: en_US.UTF-8
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: C/l
Minor modes in effect:
tooltip-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
abbrev-mode: t
Recent input:
<down-mouse-1> <mouse-1> i n t SPC f o o SPC ( i n
t a <backspace> SPC b a r ) <return> { <return> <return>
{ <backspace> } <up> <up> <return> i n t SPC c u u
x ; <return> c h a r SPC f l u b ; <return> <backspace>
<up> <up> C-SPC <down> <down> M-x <up> <up> a l i g
n <return> <help-echo> <down-mouse-1> <mouse-movement>
<mouse-movement> <drag-mouse-1> <down-mouse-1> <mouse-1>
<down-mouse-1> <mouse-movement> <mouse-movement> <drag-mouse-1>
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> SPC
<down-mouse-1> <mouse-movement> <mouse-movement> <drag-mouse-1>
M-w <down-mouse-1> <mouse-movement> <mouse-movement>
<drag-mouse-1> M-x <up> <return> <down-mouse-1> <drag-mouse-1>
<down-mouse-1> <mouse-movement> <mouse-movement> <drag-mouse-1>
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-movement>
<mouse-movement> <drag-mouse-1> M-w <down-mouse-1>
<mouse-1> C-/ <up> <up> <right> C-k C-k <right> <right>
<right> <right> <right> <right> <up> <right> C-SPC
<down> <left> M-x <up> <return> <down-mouse-1> <mouse-1>
C-/ <left> <left> <left> <left> <left> M-x <up> <return>
<help-echo> <help-echo> <down-mouse-1> <mouse-movement>
<drag-mouse-1> <up> <up> <up> <right> C-SPC <down>
<left> <left> <left> <right> <down> M-x <up> <return>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <menu-bar> <help-menu> <send-emacs-bug
-report>
Recent messages:
Mark set
user-error: Beginning of history; no preceding item [2 times]
Auto-saving...done
Auto-saving...done
<left-fringe> <drag-mouse-1> is undefined
Undo!
Mark set
Undo!
Mark set [2 times]
Auto-saving...done
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message cl-macs gv format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils align vc-git cc-langs cl
cl-loaddefs cl-lib cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs time-date tooltip electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16381
; Package
emacs
.
(Mon, 23 Jun 2014 14:25:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 16381 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16381
; Package
emacs
.
(Mon, 23 Jun 2014 15:39:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 16381 <at> debbugs.gnu.org (full text, mbox):
> 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.
Hmm... I guess it's OK, yes. Thanks,
Stefan
Reply sent
to
Leo Liu <sdl.web <at> gmail.com>
:
You have taken responsibility.
(Mon, 23 Jun 2014 23:16:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
djcb <at> djcbsoftware.nl
:
bug acknowledged by developer.
(Mon, 23 Jun 2014 23:16:03 GMT)
Full text and
rfc822 format available.
Message #16 received at 16381-done <at> debbugs.gnu.org (full text, mbox):
Fixed in 24.4.
On 2014-06-23 11:38 -0400, Stefan Monnier wrote:
> Hmm... I guess it's OK, yes.
Thanks and done.
Leo
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16381
; Package
emacs
.
(Tue, 24 Jun 2014 05:55:03 GMT)
Full text and
rfc822 format available.
Message #19 received at 16381 <at> debbugs.gnu.org (full text, mbox):
I think there is a smilar issue with ruler-mode. Compare:
emacs -Q --eval '(setq ruler-mode-show-tab-stops t)' -f ruler-mode
in 24.3 (tabs marked) and 24.3.91 (no tabs marked).
Leo, any chance you could fix that one too?
There are a handful of other files that use tab-stop-list;
it would be good to check them too.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16381
; Package
emacs
.
(Tue, 24 Jun 2014 13:06:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 16381 <at> debbugs.gnu.org (full text, mbox):
On 2014-06-24 01:54 -0400, Glenn Morris wrote:
> Leo, any chance you could fix that one too?
>
> There are a handful of other files that use tab-stop-list;
> it would be good to check them too.
I did a grep in lisp/ and these are the files using tab-stop-list:
- woman.el
- progmodes/asm-mode.el
- ruler-mode.el
- textmodes/picture.el
The following patch seems to fix all except woman.el. woman.el seems to
use its own interpretation of tab-stop-list i.e. it may not be affected
at all by the change to tab-stop-list. Comments? Leo
=== modified file 'lisp/indent.el'
--- lisp/indent.el 2014-06-23 23:09:20 +0000
+++ lisp/indent.el 2014-06-24 12:22:40 +0000
@@ -677,6 +677,13 @@
(if (<= column last) -1 (/ (- column last 1) step))
(1+ (/ (- column last) step)))))))))
+(defun indent-accumulate-tab-stops (limit)
+ "Get a list of tab stops before LIMIT (inclusive)."
+ (let ((tab 0) (tab-stops))
+ (while (<= (setq tab (indent-next-tab-stop tab)) limit)
+ (push tab tab-stops))
+ (nreverse tab-stops)))
+
(defun tab-to-tab-stop ()
"Insert spaces or tabs to next defined tab-stop column.
The variable `tab-stop-list' is a list of columns at which there are tab stops.
=== modified file 'lisp/progmodes/asm-mode.el'
--- lisp/progmodes/asm-mode.el 2014-02-10 01:34:22 +0000
+++ lisp/progmodes/asm-mode.el 2014-06-24 12:53:03 +0000
@@ -172,7 +172,7 @@
;; Simple `;' comments go to the comment-column.
(and (looking-at "\\s<\\(\\S<\\|\\'\\)") comment-column)
;; The rest goes at the first tab stop.
- (or (car tab-stop-list) tab-width)))
+ (or (indent-next-tab-stop 0))))
(defun asm-colon ()
"Insert a colon; if it follows a label, delete the label's indentation."
=== modified file 'lisp/ruler-mode.el'
--- lisp/ruler-mode.el 2014-06-16 06:37:37 +0000
+++ lisp/ruler-mode.el 2014-06-24 12:58:16 +0000
@@ -476,8 +476,11 @@
(not (member ts tab-stop-list))
(progn
(message "Tab stop set to %d" ts)
- (setq tab-stop-list (sort (cons ts tab-stop-list)
- #'<)))))))))
+ ;; If `tab-stop-list' is empty, populate it with tab
+ ;; stops before TS.
+ (when (null tab-stop-list)
+ (setq tab-stop-list (indent-accumulate-tab-stops (1- ts))))
+ (setq tab-stop-list (sort (cons ts tab-stop-list) #'<)))))))))
(defun ruler-mode-mouse-del-tab-stop (start-event)
"Delete tab stop at the graduation where the mouse pointer is on.
@@ -753,7 +756,7 @@
i (1+ i) 'help-echo ruler-mode-fill-column-help-echo
ruler))
;; Show the `tab-stop-list' markers.
- ((and ruler-mode-show-tab-stops (member j tab-stop-list))
+ ((and ruler-mode-show-tab-stops (= j (indent-next-tab-stop (1- j))))
(aset ruler i ruler-mode-tab-stop-char)
(put-text-property
i (1+ i) 'face 'ruler-mode-tab-stop
=== modified file 'lisp/textmodes/picture.el'
--- lisp/textmodes/picture.el 2014-02-10 01:34:22 +0000
+++ lisp/textmodes/picture.el 2014-06-24 12:45:46 +0000
@@ -418,7 +418,8 @@
(save-excursion
(let (tabs)
(if arg
- (setq tabs (default-value 'tab-stop-list))
+ (setq tabs (or (default-value 'tab-stop-list)
+ (indent-accumulate-tab-stops (window-width))))
(let ((regexp (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]")))
(beginning-of-line)
(let ((bol (point)))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16381
; Package
emacs
.
(Wed, 25 Jun 2014 17:31:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 16381 <at> debbugs.gnu.org (full text, mbox):
I didn't test it, but it looks ok to me. Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16381
; Package
emacs
.
(Wed, 25 Jun 2014 23:58:02 GMT)
Full text and
rfc822 format available.
Message #28 received at submit <at> debbugs.gnu.org (full text, mbox):
On 2014-06-25 13:30 -0400, Glenn Morris wrote:
> I didn't test it, but it looks ok to me. Thanks.
Thanks and installed in emacs-24 branch.
Leo
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 24 Jul 2014 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 301 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.