Function: artist-select-spray-chars

artist-select-spray-chars is an interactive and byte-compiled function defined in artist.el.gz.

Signature

(artist-select-spray-chars CHARS INITIAL-CHAR)

Documentation

Set current spray characters to be CHARS, starting with INITIAL-CHAR.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
(defun artist-select-spray-chars (chars initial-char)
  "Set current spray characters to be CHARS, starting with INITIAL-CHAR."
  ;; This huge unreadable `interactive'-clause does the following
  ;; 1. Asks for a string of spray-characters
  ;; 2. Asks for the initial character (default is the first),
  ;;    and loops if the answer is not a char within the string in 1.
  (interactive
   (let* ((str  (read-string "Select spray-can characters, lightest first: "
			     (artist-charlist-to-string artist-spray-chars)))
	  (char-list (artist-string-to-charlist str))
	  (initial (let* ((err-msg "")
			  (ok nil)
			  (first-char-as-str (char-to-string (car char-list)))
			  (first-s) (first-c))
		     (while (not ok)
		       (setq first-s
			     (read-string
			      (format (concat "%sSelect initial-character, "
					      "one of \"%s\" (%s): ")
				      err-msg str first-char-as-str)))
		       (if (equal first-s "")
			   (setq first-s first-char-as-str))
		       (setq first-c (car (artist-string-to-charlist first-s)))
		       (setq ok (not (null (member first-c char-list))))
		       (if (not ok)
			   (setq err-msg (format
					  "Not in spray-chars: \"%s\". "
					  (char-to-string first-c)))))
		     first-c)))
     (list char-list initial)))
  (setq artist-spray-chars chars)
  (setq artist-spray-new-char initial-char)
  (message "Spray-chars set to \"%s\", initial: \"%s\""
	   (artist-charlist-to-string chars) (char-to-string initial-char)))