Function: hmouse-kill-and-yank-region

hmouse-kill-and-yank-region is a byte-compiled function defined in hui-window.el.

Signature

(hmouse-kill-and-yank-region)

Documentation

Kill the marked region and yank it at the point of release.

Kill the marked region near where the Smart Key was depressed and yank it at the point of release. Signals an error if either depress or release buffer is read-only.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui-window.el
(defun hmouse-kill-and-yank-region ()
  "Kill the marked region and yank it at the point of release.
Kill the marked region near where the Smart Key was depressed and
yank it at the point of release.
Signals an error if either depress or release buffer is read-only."
  (when hkey-region
    ;; Move point back to Smart Key depress buffer.
    (hmouse-goto-depress-point)
    (if buffer-read-only
	;; In this case, we want an error that will terminate execution so that
	;; hkey-region is not reset to nil.  This allows the user to fix the
	;; problem and then to try killing again.
	(error "(hmouse-kill-and-yank-region): Use {%s} to enable killing from this buffer"
	       (hmouse-read-only-toggle-key))
      ;; Depress and release may be in the same buffer, in which case,
      ;; save the release point that may change as a result of
      ;; the kill; also, before the kill, restore the point to where it
      ;; was when the region was set.
      (hmouse-goto-release-point)
      (let ((release-point (point-marker))
	    (release-window (if assist-flag assist-key-release-window action-key-release-window)))
	(if buffer-read-only
	    ;; In this case, we want an error that will terminate execution so that
	    ;; hkey-region is not reset to nil.  This allows the user to fix the
	    ;; problem and then to try yanking again.
	    (error "(hmouse-kill-and-yank-region): Use {%s} to enable yanking into this buffer"
		   (hmouse-read-only-toggle-key))
	  ;; Region may be in another buffer, so move there if so.
	  (hmouse-goto-region-prev-point)
	  ;; Now kill and yank the region into the Smart Key release buffer.
	  (kill-region (or hkey-value (point)) (mark))
	  ;; Permanently return to release point
	  (select-frame-set-input-focus (window-frame release-window))
	  (select-window release-window)
	  (goto-char release-point)
	  ;; Protect from indentation errors
	  (ignore-errors (hmouse-insert-region)))))))