From: Leo Liu <sdl.web@gmail.com>
To: Glenn Morris <rgm@gnu.org>
Cc: 16381@debbugs.gnu.org
Subject: bug#16381: 24.3.50; align issue
Date: Tue, 24 Jun 2014 21:05:10 +0800 [thread overview]
Message-ID: <m37g46bgqh.fsf@gmail.com> (raw)
In-Reply-To: <vuha3ac0oo.fsf@fencepost.gnu.org> (Glenn Morris's message of "Tue, 24 Jun 2014 01:54:15 -0400")
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)))
next prev parent reply other threads:[~2014-06-24 13:05 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
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 [this message]
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=m37g46bgqh.fsf@gmail.com \
--to=sdl.web@gmail.com \
--cc=16381@debbugs.gnu.org \
--cc=rgm@gnu.org \
/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).