]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix a few packages to work with nil tab-stop-list
authorLeo Liu <sdl.web@gmail.com>
Wed, 25 Jun 2014 23:53:37 +0000 (07:53 +0800)
committerLeo Liu <sdl.web@gmail.com>
Wed, 25 Jun 2014 23:53:37 +0000 (07:53 +0800)
* 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.

lisp/ChangeLog
lisp/indent.el
lisp/progmodes/asm-mode.el
lisp/ruler-mode.el
lisp/textmodes/picture.el

index 7a46cf11a15776e10f18ed2f4112de53774b7a6a..386e0660c5f26538fa8ce22c0bb191d4dd452ace 100644 (file)
@@ -1,3 +1,14 @@
+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>
 
        * emacs-lisp/package.el (package-list-unsigned): New var (bug#17625).
index 7df927ff808fe7e3bf464093b047f644abc212a5..20820701b3b91803ebeff050438a4d5a7d1b3b83 100644 (file)
@@ -677,6 +677,13 @@ If PREV is non-nil, return the previous one instead."
                             (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.
index ab7612082d58af09e61cd2c82acd2f9034f3544b..3532b4a03f1b72f9f8be38bc27678350802f5a48 100644 (file)
@@ -172,7 +172,7 @@ Special commands:
    ;; 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."
index 9e32a2f5c642ce4b91e8a30bb13d9e7e9e96c5fb..bcd9c5463a161b6285c6905f354aa94cf7215d2d 100644 (file)
@@ -477,8 +477,9 @@ START-EVENT is the mouse click event."
                (not (member ts tab-stop-list))
                (progn
                  (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)
   "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."
          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
index b11b773dee147a79fa3a4f63a07096075c6c763c..94d02bebb6ad7bbaafebc4fb3cf082bb59a07eae 100644 (file)
@@ -418,7 +418,8 @@ stops computed are displayed in the minibuffer with `:' at each stop."
   (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)))