Function: picture-set-tab-stops

picture-set-tab-stops is an interactive and byte-compiled function defined in picture.el.gz.

Signature

(picture-set-tab-stops &optional ARG)

Documentation

Set value of tab-stop-list according to context of this line.

This controls the behavior of M-x picture-tab (picture-tab). A tab stop is set at every column occupied by an "interesting character" that is preceded by whitespace. Interesting characters are defined by the variable picture-tab-chars, see its documentation for an example of usage. With ARG, just (re)set tab-stop-list to its default value. The tab stops computed are displayed in the minibuffer with : at each stop.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/picture.el.gz
(defun picture-set-tab-stops (&optional arg)
  "Set value of `tab-stop-list' according to context of this line.
This controls the behavior of \\[picture-tab].  A tab stop is set at
every column occupied by an \"interesting character\" that is preceded
by whitespace.  Interesting characters are defined by the variable
`picture-tab-chars', see its documentation for an example of usage.
With ARG, just (re)set `tab-stop-list' to its default value.  The tab
stops computed are displayed in the minibuffer with `:' at each stop."
  (interactive "P")
  (save-excursion
    (let (tabs)
      (if arg
	  (setq tabs (or (default-value 'tab-stop-list)
			 (indent-accumulate-tab-stops (window-width))))
	(let ((regexp (concat "[ \t]+[" picture-tab-chars "]")))
	  (beginning-of-line)
	  (let ((bol (point)))
	    (end-of-line)
	    (while (re-search-backward regexp bol t)
	      (skip-chars-forward " \t")
	      (setq tabs (cons (current-column) tabs)))
	    (if (null tabs)
		(error "No characters in set [%s] on this line"
		       picture-tab-chars)))))
      (setq tab-stop-list tabs)
      (let ((blurb (make-string (1+ (nth (1- (length tabs)) tabs)) ?\ )))
	(while tabs
	  (aset blurb (car tabs) ?:)
	  (setq tabs (cdr tabs)))
	(message blurb)))))