Function: hmouse-drag-thing
hmouse-drag-thing is a byte-compiled function defined in
hui-window.el.
Signature
(hmouse-drag-thing)
Documentation
Return t if drag began at a thing and ended some other place in the same buffer.
If no region is active and a Smart Key drag began at the start/end of a delimited construct and ended at some other point in the same buffer, return t else nil.
Delimited constructs include lists, comments, strings,
arrays/vectors, sets, and markup pair tags, such as <div>
</div>. Point must be on the start or end delimiter or in the
case of markup pair tags, on the first character of either tag.
For strings and comments, point must be on the first line.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui-window.el
(defun hmouse-drag-thing ()
"Return t if drag began at a thing and ended some other place in the same buffer.
If no region is active and a Smart Key drag began at the
start/end of a delimited construct and ended at some other point
in the same buffer, return t else nil.
Delimited constructs include lists, comments, strings,
arrays/vectors, sets, and markup pair tags, such as <div>
</div>. Point must be on the start or end delimiter or in the
case of markup pair tags, on the first character of either tag.
For strings and comments, point must be on the first line."
;; Move point back to Smart Key depress location for testing whether at a thing.
(let ((depress-args (if assist-flag assist-key-depress-args action-key-depress-args))
(release-args (if assist-flag assist-key-release-args action-key-release-args))
(marked-thing)
(ignore-drag))
(save-excursion
(hmouse-goto-depress-point)
(if (and (not (hmouse-use-region-p)) (hui-select-at-delimited-thing-p)
(or (markerp depress-args) (markerp release-args)
(and (not (or (hmouse-drag-window-side) (hmouse-modeline-depress)))
(or (hmouse-drag-between-windows) (hmouse-drag-vertically)
(hmouse-drag-horizontally) (hmouse-drag-diagonally))))
(let ((start-buf (window-buffer (smart-window-of-coords depress-args)))
(end-buf (window-buffer (smart-window-of-coords release-args)))
(start-point (smart-point-of-coords depress-args))
(end-point (smart-point-of-coords release-args)))
;; If it is a click, return nil; if drag end point
;; is within the thing to operate upon, don't set a
;; region, so no operation will be performed but
;; return t (ignore drag).
(not (and (eq start-buf end-buf)
start-point
end-point
(/= start-point end-point)
(setq marked-thing (hui-select-delimited-thing))
(setq ignore-drag (and (> end-point (min (point) (mark)))
(< end-point (max (point) (mark)))))))))
(progn (when (not (hmouse-use-region-p)) (hui-select-delimited-thing))
;; Erase any saved location of a region prior to Smart Key depress since now we have a
;; new region location. This prevents hmouse-kill-and-yank-region from jumping to the
;; old location.
(if assist-flag
(setq assist-key-depress-prev-point nil)
(setq action-key-depress-prev-point nil))
;; Store any new value of point as a result of marking the region, so we can return to it
;; later.
(setq hkey-value (point))
(hmouse-save-region)
t)
(if marked-thing (deactivate-mark))
(when ignore-drag (error "(Hyperbole): Smart Key drag of a delimited thing must end outside of the thing"))
nil))))