Function: ghostel--mouse-begin-drag-tracking

ghostel--mouse-begin-drag-tracking is a natively compiled function defined in ghostel.el.

Signature

(ghostel--mouse-begin-drag-tracking EVENT)

Documentation

Arm live motion forwarding for a drag started by EVENT.

Records the held button, enables Emacs motion events by setting the variable track-mouse(var)/track-mouse(fun), and installs ghostel--mouse-drag-map as a transient map so each intermediate mouse-movement event is forwarded to the terminal by ghostel--mouse-drag-motion. The map stays active until the next non-motion command (the button release, which keep-pred detects).

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--mouse-begin-drag-tracking (event)
  "Arm live motion forwarding for a drag started by EVENT.
Records the held button, enables Emacs motion events by setting the variable
`track-mouse', and installs `ghostel--mouse-drag-map' as a transient map so
each intermediate `mouse-movement' event is forwarded to the terminal by
`ghostel--mouse-drag-motion'.  The map stays active until the next non-motion
command (the button release, which `keep-pred' detects)."
  (setq ghostel--mouse-drag-button (ghostel--mouse-button-number event)
        ghostel--mouse-drag-last-cell nil)
  (let ((old-track-mouse track-mouse)
        (buffer (current-buffer)))
    (setq track-mouse 'dragging)
    (set-transient-map
     ghostel--mouse-drag-map
     (lambda () (eq this-command 'ghostel--mouse-drag-motion))
     (lambda ()
       (with-current-buffer buffer
         (setq track-mouse old-track-mouse
               ghostel--mouse-drag-button nil
               ghostel--mouse-drag-last-cell nil))))))