Article View: gnu.emacs.bug
Article #1092move-to-tab-stop and picture-tab
From: Ashwin Ram
Date: Tue, 25 Oct 1988 14:03
Date: Tue, 25 Oct 1988 14:03
37 lines
2063 bytes
2063 bytes
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
Technical Details
Message-ID:
<8810251403.AA09731@ELI.CS.YALE.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!YALE.ARPA!ram-ashwinShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!YALE.ARPA!ram-ashwin From: ram-ashwin@YALE.ARPA (Ashwin Ram) Newsgroups: gnu.emacs.bug Subject: move-to-tab-stop and picture-tab Message-ID: <8810251403.AA09731@ELI.CS.YALE.EDU> Date: 25 Oct 88 14:03:04 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 37