aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2014-06-26 07:53:37 +0800
committerLeo Liu2014-06-26 07:53:37 +0800
commit83d208a5dd293caae48beb9d36dd45529375631a (patch)
treee8075fee7dc607ebfa34779edf3e929c8fca6b63
parent30a42a5bedfbfaab72da862826f43291fe771ce8 (diff)
downloademacs-83d208a5dd293caae48beb9d36dd45529375631a.tar.gz
emacs-83d208a5dd293caae48beb9d36dd45529375631a.zip
Fix a few packages to work with nil tab-stop-list
* indent.el (indent-accumulate-tab-stops): New function. * textmodes/picture.el (picture-set-tab-stops): * ruler-mode.el (ruler-mode-mouse-add-tab-stop) (ruler-mode-ruler): Fix to work with nil tab-stop-list. * progmodes/asm-mode.el (asm-calculate-indentation): Use indent-next-tab-stop.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/indent.el7
-rw-r--r--lisp/progmodes/asm-mode.el2
-rw-r--r--lisp/ruler-mode.el7
-rw-r--r--lisp/textmodes/picture.el3
5 files changed, 25 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7a46cf11a15..386e0660c5f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12014-06-25 Leo Liu <sdl.web@gmail.com>
2
3 * textmodes/picture.el (picture-set-tab-stops):
4 * ruler-mode.el (ruler-mode-mouse-add-tab-stop)
5 (ruler-mode-ruler): Fix to work with nil tab-stop-list.
6
7 * progmodes/asm-mode.el (asm-calculate-indentation): Use
8 indent-next-tab-stop.
9
10 * indent.el (indent-accumulate-tab-stops): New function.
11
12014-06-25 Stefan Monnier <monnier@iro.umontreal.ca> 122014-06-25 Stefan Monnier <monnier@iro.umontreal.ca>
2 13
3 * emacs-lisp/package.el (package-list-unsigned): New var (bug#17625). 14 * emacs-lisp/package.el (package-list-unsigned): New var (bug#17625).
diff --git a/lisp/indent.el b/lisp/indent.el
index 7df927ff808..20820701b3b 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -677,6 +677,13 @@ If PREV is non-nil, return the previous one instead."
677 (if (<= column last) -1 (/ (- column last 1) step)) 677 (if (<= column last) -1 (/ (- column last 1) step))
678 (1+ (/ (- column last) step))))))))) 678 (1+ (/ (- column last) step)))))))))
679 679
680(defun indent-accumulate-tab-stops (limit)
681 "Get a list of tab stops before LIMIT (inclusive)."
682 (let ((tab 0) (tab-stops))
683 (while (<= (setq tab (indent-next-tab-stop tab)) limit)
684 (push tab tab-stops))
685 (nreverse tab-stops)))
686
680(defun tab-to-tab-stop () 687(defun tab-to-tab-stop ()
681 "Insert spaces or tabs to next defined tab-stop column. 688 "Insert spaces or tabs to next defined tab-stop column.
682The variable `tab-stop-list' is a list of columns at which there are tab stops. 689The variable `tab-stop-list' is a list of columns at which there are tab stops.
diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el
index ab7612082d5..3532b4a03f1 100644
--- a/lisp/progmodes/asm-mode.el
+++ b/lisp/progmodes/asm-mode.el
@@ -172,7 +172,7 @@ Special commands:
172 ;; Simple `;' comments go to the comment-column. 172 ;; Simple `;' comments go to the comment-column.
173 (and (looking-at "\\s<\\(\\S<\\|\\'\\)") comment-column) 173 (and (looking-at "\\s<\\(\\S<\\|\\'\\)") comment-column)
174 ;; The rest goes at the first tab stop. 174 ;; The rest goes at the first tab stop.
175 (or (car tab-stop-list) tab-width))) 175 (or (indent-next-tab-stop 0))))
176 176
177(defun asm-colon () 177(defun asm-colon ()
178 "Insert a colon; if it follows a label, delete the label's indentation." 178 "Insert a colon; if it follows a label, delete the label's indentation."
diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el
index 9e32a2f5c64..bcd9c5463a1 100644
--- a/lisp/ruler-mode.el
+++ b/lisp/ruler-mode.el
@@ -477,8 +477,9 @@ START-EVENT is the mouse click event."
477 (not (member ts tab-stop-list)) 477 (not (member ts tab-stop-list))
478 (progn 478 (progn
479 (message "Tab stop set to %d" ts) 479 (message "Tab stop set to %d" ts)
480 (setq tab-stop-list (sort (cons ts tab-stop-list) 480 (when (null tab-stop-list)
481 #'<))))))))) 481 (setq tab-stop-list (indent-accumulate-tab-stops (1- ts))))
482 (setq tab-stop-list (sort (cons ts tab-stop-list) #'<)))))))))
482 483
483(defun ruler-mode-mouse-del-tab-stop (start-event) 484(defun ruler-mode-mouse-del-tab-stop (start-event)
484 "Delete tab stop at the graduation where the mouse pointer is on. 485 "Delete tab stop at the graduation where the mouse pointer is on.
@@ -754,7 +755,7 @@ Optional argument PROPS specifies other text properties to apply."
754 i (1+ i) 'help-echo ruler-mode-fill-column-help-echo 755 i (1+ i) 'help-echo ruler-mode-fill-column-help-echo
755 ruler)) 756 ruler))
756 ;; Show the `tab-stop-list' markers. 757 ;; Show the `tab-stop-list' markers.
757 ((and ruler-mode-show-tab-stops (member j tab-stop-list)) 758 ((and ruler-mode-show-tab-stops (= j (indent-next-tab-stop (1- j))))
758 (aset ruler i ruler-mode-tab-stop-char) 759 (aset ruler i ruler-mode-tab-stop-char)
759 (put-text-property 760 (put-text-property
760 i (1+ i) 'face 'ruler-mode-tab-stop 761 i (1+ i) 'face 'ruler-mode-tab-stop
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index b11b773dee1..94d02bebb6a 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -418,7 +418,8 @@ stops computed are displayed in the minibuffer with `:' at each stop."
418 (save-excursion 418 (save-excursion
419 (let (tabs) 419 (let (tabs)
420 (if arg 420 (if arg
421 (setq tabs (default-value 'tab-stop-list)) 421 (setq tabs (or (default-value 'tab-stop-list)
422 (indent-accumulate-tab-stops (window-width))))
422 (let ((regexp (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]"))) 423 (let ((regexp (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]")))
423 (beginning-of-line) 424 (beginning-of-line)
424 (let ((bol (point))) 425 (let ((bol (point)))