Function: hmouse-item-to-window
hmouse-item-to-window is a byte-compiled function defined in
hui-window.el.
Signature
(hmouse-item-to-window &optional NEW-WINDOW-FLAG)
Documentation
Display item/action of Action Key depress at the release location.
Return non-nil if item is displayed or action is executed; nil otherwise.
Item is a buffer, file menu item or a Hyperbole button (execute its action).
Release location may be an Emacs window or outside of Emacs, in which case a new frame with a single window is created to display the item. If the release is inside Emacs and the optional NEW-WINDOW-FLAG is non-nil, the release window is sensibly split before the buffer is displayed. Otherwise, the buffer is simply displayed in the release window.
If depress is on the top fixed header line or to the right of any item, this moves the menu buffer itself to the release location.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui-window.el
(defun hmouse-item-to-window (&optional new-window-flag)
"Display item/action of Action Key depress at the release location.
Return non-nil if item is displayed or action is executed; nil
otherwise.
Item is a buffer, file menu item or a Hyperbole button (execute its
action).
Release location may be an Emacs window or outside of Emacs, in
which case a new frame with a single window is created to display
the item. If the release is inside Emacs and the optional
NEW-WINDOW-FLAG is non-nil, the release window is sensibly split
before the buffer is displayed. Otherwise, the buffer is simply
displayed in the release window.
If depress is on the top fixed header line or to the right of any
item, this moves the menu buffer itself to the release location."
(let* ((w1 action-key-depress-window)
;; Release may be outside of an Emacs window in which case,
;; create a new frame and window.
(w2 (or action-key-release-window (frame-selected-window (hycontrol-make-frame))))
(w1-ref)
(pos)
(at-button-flag))
(when (and (window-live-p w1) (window-live-p w2))
(unwind-protect
(progn (select-window w1)
(if (eq (posn-area (event-start action-key-depress-args)) 'header-line)
;; Drag from fixed header-line means move this menu buffer
;; to release window.
(progn (setq w1-ref (current-buffer))
(hmouse-pulse-buffer)
(sit-for 0.05)
(bury-buffer))
;; Otherwise, move the current menu item to the release window.
(setq w1-ref (or (eval (cadr (assq major-mode hmouse-drag-item-mode-forms)))
(when (setq at-button-flag (hbut:at-p))
(hbut:action 'hbut:current))))
(when w1-ref (hmouse-pulse-line) (sit-for 0.05))))
(hypb:select-window-frame w2)
(when (and new-window-flag action-key-release-window)
(hmouse-split-window))))
(unwind-protect
(progn
(when (and w1-ref (not (stringp w1-ref)) (sequencep w1-ref)
(buffer-live-p (seq-elt w1-ref 0))
(integerp (seq-elt w1-ref 1)))
;; w1-ref is a list or vector of `buffer' and `position' elements.
(setq pos (seq-elt w1-ref 1)
w1-ref (seq-elt w1-ref 0)))
(cond ((not w1-ref)
(if (not (window-live-p w1))
(error "(hmouse-item-to-window): Action Mouse Key item drag must start in a live window")
(error "(hmouse-item-to-window): No item to display at start of Action Mouse Key drag")))
(at-button-flag
(let ((hpath:display-where 'this-window))
(hbut:act)))
((buffer-live-p w1-ref) ;; Must be a buffer, not a buffer name
(set-window-buffer w2 w1-ref)
(set-buffer w1-ref))
((and (stringp w1-ref) (file-readable-p w1-ref))
(set-window-buffer w2 (set-buffer (find-file-noselect w1-ref))))
(t (error "(hmouse-item-to-window): Cannot find or read `%s'" w1-ref)))
(if pos
(progn (goto-char pos)
(hmouse-pulse-line))
(hmouse-pulse-buffer)))
;; If helm is active, end in the minibuffer window.
(if (smart-helm-alive-p)
(smart-helm-to-minibuffer)))))