Function: artist-mouse-choose-operation
artist-mouse-choose-operation is an interactive and byte-compiled
function defined in artist.el.gz.
Signature
(artist-mouse-choose-operation EV OP)
Documentation
Choose operation for event EV and operation OP.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
(defun artist-mouse-choose-operation (ev op)
"Choose operation for event EV and operation OP."
(interactive
(progn
(select-window (posn-window (event-start last-input-event)))
(list last-input-event
(if (display-popup-menus-p)
(x-popup-menu t artist-popup-menu-table)
'no-popup-menus))))
(if (eq op 'no-popup-menus)
;; No popup menus. Call `tmm-prompt' instead, but with the
;; up-mouse-button, if any, temporarily disabled, otherwise
;; it'll interfere.
(let* ((key (artist-compute-up-event-key ev))
(orig-button-up-binding (lookup-key (current-global-map) key)))
(unwind-protect
(define-key (current-global-map) key 'artist-do-nothing)
(setq op (tmm-prompt artist-popup-menu-table))
(if orig-button-up-binding
(define-key (current-global-map) key orig-button-up-binding)))))
(let ((draw-fn (artist-go-get-draw-fn-from-symbol (car op)))
(set-fn (artist-fc-get-fn-from-symbol (car op))))
(cond
;; *** It was a draw-function
((not (listp draw-fn))
(let* ((unshifted (artist-go-get-symbol-shift (car op) nil))
(shifted (artist-go-get-symbol-shift (car op) t))
(shift-state (artist-event-is-shifted ev))
(selected-op (if shift-state shifted unshifted))
(keyword (artist-go-get-keyword-from-symbol selected-op)))
(artist-select-operation keyword)))
;; *** It was a set/unset function
((not (listp set-fn))
(call-interactively set-fn)))))