ram-ashwin@YALE.ARPA (Ashwin Ram) (10/25/88)
The following function moves the cursor to the next tab stop. It is
analogous to tab-to-tab-stop, except that it moves the cursor over existing
text, if any, rather than inserting spaces and pushing existing text to the
right. It uses move-to-column-force which is defined in picture.el.
(defun move-to-tab-stop ()
"Move to next defined tab-stop column.
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)
(if abbrev-mode (expand-abbrev))
(let ((tabs tab-stop-list))
(while (and tabs (>= (current-column) (car tabs)))
(setq tabs (cdr tabs)))
(if tabs
(move-to-column-force (car tabs))
(insert ? ))))
I suggest that this should be added to indent.el (where tab-to-tab-stop is).
The reason that I prefer it there instead of inside picture.el is that this
function should be available independent of whether picture-mode is loaded,
since it is often useful outside picture-mode. For the same reason,
move-to-column-force should be moved outside of picture.el. In fact, it
might be a better idea to add an optional argument to move-to-column that
determines its behavior at the end of a line.
picture-tab, in picture.el, should be altered to use move-to-tab-stop since
as written picture-tab is a destructive function. It marks the buffer as
modified even if no modification has occurred (conceptually, only the cursor
has moved). Furthermore, for that reason it cannot be used in read-only
buffers.
-- Ashwin.
ARPA: Ram-Ashwin@cs.yale.edu
UUCP: {decvax,ucbvax,harvard,cmcl2,...}!yale!Ram-Ashwin
BITNET: Ram@yalecs