Function: hkey-insert-region

hkey-insert-region is a byte-compiled function defined in hmouse-drv.el.

Signature

(hkey-insert-region DEPRESS-WINDOW RELEASE-WINDOW THROW-REGION-FLAG DISPLAY-DELAY)

Documentation

Throw any active (highlighted) region from DEPRESS-WINDOW to RELEASE-WINDOW.

If THROW-REGION-FLAG is non-nil, the region is thrown even if not active, unless the buffers in DEPRESS-WINDOW and RELEASE-WINDOW are the same, then the region is not thrown. Highlight the thrown region for DISPLAY-DELAY seconds.

Return t if thrown, else nil.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hmouse-drv.el
(defun hkey-insert-region (depress-window release-window throw-region-flag display-delay)
  "Throw any active (highlighted) region from DEPRESS-WINDOW to RELEASE-WINDOW.
If THROW-REGION-FLAG is non-nil, the region is thrown even if not
active, unless the buffers in DEPRESS-WINDOW and RELEASE-WINDOW are
the same, then the region is not thrown.
Highlight the thrown region for DISPLAY-DELAY seconds.

Return t if thrown, else nil."
  (when (or (use-region-p) throw-region-flag)
    (cond ((or (not (window-live-p depress-window))
	       (not (window-live-p release-window)))
	   (user-error "(hkey-insert-region): Invalid window: depress window: '%s'; release window: '%s'"
		       depress-window release-window))
	  ((> (region-end) (region-beginning))
	   ;; Non-empty region
	   (if (and (eq (window-buffer depress-window) (window-buffer release-window))
		    (<= (region-beginning) (window-point release-window))
		    (>= (region-end) (window-point release-window)))
	       (user-error "(hkey-insert-region): Can't throw region to a point within the region")
	     (let* ((orig-buf (current-buffer))
		    (orig-start (region-beginning))
		    (orig-end (region-end))
		    (len (- orig-end orig-start))
		    insert-start
		    insert-end)
	       (select-window release-window 'mark-for-redisplay)
	       (setq insert-start (point)
		     insert-end (+ insert-start len))
	       (insert-buffer-substring orig-buf orig-start orig-end)
	       (hmouse-pulse-region insert-start insert-end)
	       (sit-for display-delay)
	       t)))
	  (t (user-error "(hkey-insert-region): Can't throw an empty region")))))