Function: hui:copy-to-register

hui:copy-to-register is an autoloaded, interactive and byte-compiled function defined in hui.el.

Signature

(hui:copy-to-register REGISTER START END &optional DELETE-FLAG REGION-FLAG INTERACTIVE-FLAG)

Documentation

Copy region or thing into REGISTER. With prefix arg, delete as well.

Called from program, takes five args: REGISTER, START, END, DELETE-FLAG, and REGION-FLAG. START and END are buffer positions indicating what to copy. The optional argument REGION-FLAG if non-nil, indicates that we're not just copying some text between START and END, but we're copying the region.

Interactively, reads the register using register-read-with-preview.

If called interactively, transient-mark-mode(var)/transient-mark-mode(fun) is non-nil, and there is no active region, copy any delimited selectable thing at point; see hui:delimited-selectable-thing.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui.el
;;; ************************************************************************
;;; Public Commands Bound to Keys
;;; ************************************************************************

;; Derived from copy-to-register of "register.el"
;;;###autoload
(defun hui:copy-to-register (register start end &optional delete-flag region-flag interactive-flag)
  "Copy region or thing into REGISTER.  With prefix arg, delete as well.
Called from program, takes five args: REGISTER, START, END, DELETE-FLAG,
and REGION-FLAG.  START and END are buffer positions indicating what to copy.
The optional argument REGION-FLAG if non-nil, indicates that we're not just
copying some text between START and END, but we're copying the region.

Interactively, reads the register using `register-read-with-preview'.

If called interactively, `transient-mark-mode' is non-nil, and
there is no active region, copy any delimited selectable thing at
point; see `hui:delimited-selectable-thing'."
  (interactive (list (register-read-with-preview "Copy to register: ")
		     (when mark-active (region-beginning))
		     (when mark-active (region-end))
		     current-prefix-arg
		     t
		     t))
  (let (thing-and-bounds
	thing
	str)
    (prog1 (setq str
		 ;; If called interactively, transient-mark-mode is
		 ;; enabled, and no region is active, copy thing at
		 ;; point, current kcell ref when in kotl-mode or
		 ;; button if on an ibut or ebut.
		 (cond ((and interactive-flag
			     transient-mark-mode
			     (not (use-region-p))
                             (or (ebut:label-p) (ibut:label-p)))
                        (hui-register-struct-at-point))
                       ((and interactive-flag
			     transient-mark-mode
			     (not (use-region-p))
			     (prog1 (setq thing-and-bounds
					  (hui:selectable-thing-and-bounds)
					  thing (nth 1 thing-and-bounds)
					  start (nth 2 thing-and-bounds)
					  end   (nth 3 thing-and-bounds))
			       (when (and delete-flag start end)
				 (delete-region start end))))
			thing)
		       ((and start end region-flag)
			(funcall region-extract-function delete-flag))
		       ((and start end)
			(filter-buffer-substring start end delete-flag))
		       (t ;; no region
			(signal 'mark-inactive nil))))
      (set-register register str)
      (setq deactivate-mark t)
      (cond (delete-flag)
	    (interactive-flag
	     (cond (thing
		    (message "Saved selectable thing: %s" thing))
		   ((mark t)
		    (indicate-copied-region))))))))