Function: hmouse-choose-windows

hmouse-choose-windows is a byte-compiled function defined in hmouse-drv.el.

Signature

(hmouse-choose-windows FUNC)

Documentation

Mouse click on start and end windows which are then applied to FUNC.

With the start window temporarily selected, run FUNC with the end window as an argument.

Appropriate FUNCs include: hkey-drag, hkey-drag-to, hkey-link, hkey-replace, hkey-swap and hkey-throw.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hmouse-drv.el
(defun hmouse-choose-windows (func)
  "Mouse click on start and end windows which are then applied to FUNC.
With the start window temporarily selected, run FUNC with the end
window as an argument.

Appropriate FUNCs include: hkey-drag, hkey-drag-to, hkey-link,
hkey-replace, hkey-swap and hkey-throw."
  (let* (start-event
	 end-event
	 start-window
	 end-window)
    (message "Click on the %s start window..." func)
    (setq start-window
	  (cl-loop do (setq start-event (read-event))
		   until (and (mouse-event-p start-event)
			      (not (string-match "\\`down-" (symbol-name (car start-event)))))
		   finally return (posn-window (event-start start-event))))
    (message "Now click on the %s end window..." func)
    (setq end-window
	  (cl-loop do (setq end-event (read-event))
		   until (and (mouse-event-p end-event)
			      (not (string-match "\\`down-" (symbol-name (car end-event)))))
		   finally return (posn-window (event-start end-event))))
    (message "Done")
    (with-selected-window start-window
      (funcall func end-window))))