Function: viper-mouse-click-insert-word
viper-mouse-click-insert-word is an interactive and byte-compiled
function defined in viper-mous.el.gz.
Signature
(viper-mouse-click-insert-word CLICK ARG)
Documentation
Insert word clicked or double-clicked on.
With prefix argument, N, insert that many words.
This command must be bound to a mouse click.
The double-click action of the same mouse button must not be bound
(or it must be bound to the same function).
See viper-surrounding-word for the definition of a word in this case.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emulation/viper-mous.el.gz
(defun viper-mouse-click-insert-word (click arg)
"Insert word clicked or double-clicked on.
With prefix argument, N, insert that many words.
This command must be bound to a mouse click.
The double-click action of the same mouse button must not be bound
\(or it must be bound to the same function).
See `viper-surrounding-word' for the definition of a word in this case."
(interactive "e\nP")
(if viper-frame-of-focus ;; to handle clicks in another frame
(select-frame viper-frame-of-focus))
(if (save-excursion
(or (not (eq (key-binding viper-mouse-down-insert-key-parsed)
'viper-mouse-catch-frame-switch))
(not (eq (key-binding viper-mouse-up-insert-key-parsed)
'viper-mouse-click-insert-word))))
() ; do nothing, if binding isn't right or not over text
;; turn arg into a number
(cond ((integerp arg) nil)
;; prefix arg is a list when one hits C-u then command
((and (listp arg) (integerp (car arg)))
(setq arg (car arg)))
(t (setq arg 1)))
(if (not (eq (key-binding viper-mouse-down-insert-key-parsed)
'viper-mouse-catch-frame-switch))
() ; do nothing
(let (click-count interrupting-event)
(if (and
(viper-multiclick-p)
;; This trick checks if there is a pending mouse event if so, we
;; use this latter event and discard the current mouse click If
;; the next pending event is not a mouse event, we execute the
;; current mouse event
(progn
(setq interrupting-event (read-event))
(viper-mouse-event-p last-input-event)))
(progn ; interrupted wait
(setq viper-global-prefix-argument arg))
;; uninterrupted wait or the interrupting event wasn't a mouse event
(setq click-count (event-click-count click))
(if (> click-count 1)
(setq arg viper-global-prefix-argument
viper-global-prefix-argument nil))
(insert (viper-mouse-click-get-word click arg click-count))
(if (and interrupting-event
(eventp interrupting-event)
(not (viper-mouse-event-p interrupting-event)))
(viper-set-unread-command-events interrupting-event))
)))))