Commit 83d208a5 authored by Leo Liu's avatar Leo Liu
Browse files

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.
parent 30a42a5b
2014-06-25 Leo Liu <sdl.web@gmail.com>
* 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.
* indent.el (indent-accumulate-tab-stops): New function.
2014-06-25 Stefan Monnier <monnier@iro.umontreal.ca> 2014-06-25 Stefan Monnier <monnier@iro.umontreal.ca>
   
* emacs-lisp/package.el (package-list-unsigned): New var (bug#17625). * emacs-lisp/package.el (package-list-unsigned): New var (bug#17625).
......
...@@ -677,6 +677,13 @@ If PREV is non-nil, return the previous one instead." ...@@ -677,6 +677,13 @@ If PREV is non-nil, return the previous one instead."
(if (<= column last) -1 (/ (- column last 1) step)) (if (<= column last) -1 (/ (- column last 1) step))
(1+ (/ (- column last) 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 () (defun tab-to-tab-stop ()
"Insert spaces or tabs to next defined tab-stop column. "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. The variable `tab-stop-list' is a list of columns at which there are tab stops.
......
...@@ -172,7 +172,7 @@ Special commands: ...@@ -172,7 +172,7 @@ Special commands:
;; Simple `;' comments go to the comment-column. ;; Simple `;' comments go to the comment-column.
(and (looking-at "\\s<\\(\\S<\\|\\'\\)") comment-column) (and (looking-at "\\s<\\(\\S<\\|\\'\\)") comment-column)
;; The rest goes at the first tab stop. ;; The rest goes at the first tab stop.
(or (car tab-stop-list) tab-width))) (or (indent-next-tab-stop 0))))
(defun asm-colon () (defun asm-colon ()
"Insert a colon; if it follows a label, delete the label's indentation." "Insert a colon; if it follows a label, delete the label's indentation."
......
...@@ -477,8 +477,9 @@ START-EVENT is the mouse click event." ...@@ -477,8 +477,9 @@ START-EVENT is the mouse click event."
(not (member ts tab-stop-list)) (not (member ts tab-stop-list))
(progn (progn
(message "Tab stop set to %d" ts) (message "Tab stop set to %d" ts)
(setq tab-stop-list (sort (cons ts tab-stop-list) (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) (defun ruler-mode-mouse-del-tab-stop (start-event)
"Delete tab stop at the graduation where the mouse pointer is on. "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,7 +755,7 @@ Optional argument PROPS specifies other text properties to apply."
i (1+ i) 'help-echo ruler-mode-fill-column-help-echo i (1+ i) 'help-echo ruler-mode-fill-column-help-echo
ruler)) ruler))
;; Show the `tab-stop-list' markers. ;; 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) (aset ruler i ruler-mode-tab-stop-char)
(put-text-property (put-text-property
i (1+ i) 'face 'ruler-mode-tab-stop i (1+ i) 'face 'ruler-mode-tab-stop
......
...@@ -418,7 +418,8 @@ stops computed are displayed in the minibuffer with `:' at each stop." ...@@ -418,7 +418,8 @@ stops computed are displayed in the minibuffer with `:' at each stop."
(save-excursion (save-excursion
(let (tabs) (let (tabs)
(if arg (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) "]"))) (let ((regexp (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]")))
(beginning-of-line) (beginning-of-line)
(let ((bol (point))) (let ((bol (point)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment