Function: artist-select-operation
artist-select-operation is an interactive and byte-compiled function
defined in artist.el.gz.
Signature
(artist-select-operation OP-STR)
Documentation
Select drawing operation OP-STR.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
(defun artist-select-operation (op-str)
"Select drawing operation OP-STR."
(interactive (list (completing-read "Select operation: "
artist-key-compl-table)))
(let* ((op-symbol (artist-mt-get-symbol-from-keyword op-str))
(draw-how (if op-symbol
(artist-go-get-draw-how-from-symbol op-symbol)
nil)))
;; First check that the string was valid
(if (null op-symbol)
(error "Unknown drawing method: %s" op-str))
;; Second, check that we are not about to switch to a different
;; kind of shape (do that only if we are drawing with keys;
;; otherwise this function cannot get called).
(if (and artist-key-is-drawing
(not (equal artist-key-draw-how draw-how)))
(error "Cannot switch to a different kind of shape while drawing"))
;; If we were drawing, undraw the shape
(if (and artist-key-is-drawing
artist-rubber-banding)
(artist-key-undraw-common))
;; Set the current operation and draw-how
(setq artist-curr-go op-symbol)
(setq artist-key-draw-how draw-how)
;; If we were drawing, redraw the shape (but don't if shape
;; is drawn by setting only one point)
(if (and artist-key-is-drawing
artist-rubber-banding
(not (eq artist-key-draw-how 1)))
(artist-key-draw-common)))
;; Feedback
(artist-mode-line-show-curr-operation artist-key-is-drawing))