Function: pdf-util-track-mouse-dragging

pdf-util-track-mouse-dragging is a macro defined in pdf-util.el.

Signature

(pdf-util-track-mouse-dragging EVENT-RESOLUTION &rest BODY)

Documentation

Read mouse movement events executing BODY.

See also pdf-util-do-events.

This macro should be used inside a command bound to a down-mouse event. It evaluates to t, if at least one event was processed in BODY, otherwise nil. In the latter case, the only event (usually a mouse click event) is unread.

(FN (EVENT RESOLUTION) &rest BODY)

Source Code

;; Defined in /nix/store/63h5z2vmzn0mfavcxi2idi23g5xcgkbl-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20260102.1101/pdf-util.el
(defmacro pdf-util-track-mouse-dragging (event-resolution &rest body)
  "Read mouse movement events executing BODY.

See also `pdf-util-do-events'.

This macro should be used inside a command bound to a down-mouse
event.  It evaluates to t, if at least one event was processed in
BODY, otherwise nil.  In the latter case, the only event (usually
a mouse click event) is unread.

\(FN (EVENT RESOLUTION) &rest BODY\)"
  (declare (indent 1) (debug ((symbolp form) body)))
  (let ((ran-once-p (make-symbol "ran-once-p")))
    `(let (,ran-once-p)
       (track-mouse
         (pdf-util-do-events (,@event-resolution t)
             (mouse-movement-p ,(car event-resolution))
           (setq ,ran-once-p t)
           ,@body))
       (when (and ,ran-once-p
                  unread-command-events)
         (setq unread-command-events
               (butlast unread-command-events)))
       ,ran-once-p)))