GNU bug report logs - #79643
hyrolo-yank-reformat-function needs region's end

Previous Next

Package: hyperbole;

Reported by: Yarl <yarl-baudig <at> mailoo.org>

Date: Fri, 17 Oct 2025 08:49:02 UTC

Severity: normal

To reply to this bug, email your comments to 79643 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-hyperbole <at> gnu.org:
bug#79643; Package hyperbole. (Fri, 17 Oct 2025 08:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Yarl <yarl-baudig <at> mailoo.org>:
New bug report received and forwarded. Copy sent to bug-hyperbole <at> gnu.org. (Fri, 17 Oct 2025 08:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Yarl <yarl-baudig <at> mailoo.org>
To: bug-hyperbole <at> gnu.org
Subject: hyrolo-yank-reformat-function needs region's end
Date: Fri, 17 Oct 2025 10:47:49 +0200
Hello,

Below is hyrolo-yank:
--8<---------------cut here---------------start------------->8---
(defun hyrolo-yank (name &optional regexp-flag)
  "Insert at point the first rolo entry with a headline containing NAME.
If the `consult' package is installed, interactively select and complete
the entry to be inserted.

With optional prefix arg, REGEXP-FLAG, treat NAME as a regular expression
instead of a string."
  (interactive (list 
		(hsys-consult-grep-headlines-read-regexp
		 #'hyrolo-consult-grep "Yank rolo headline matching")
		current-prefix-arg))
  (when (string-empty-p name)
    (setq name nil))
  (when (or (null name) (not (stringp name)))
    (error "(hyrolo-yank): Invalid name: `%s'" name))

  (let ((hyrolo-display-buffer (current-buffer))
	(start (point))
	found)
    (save-excursion
      (setq found
	    (if (and (hsys-consult-active-p)
		     (string-match "\\([^ \t\n\r\"'`]*[^ \t\n\r:\"'`0-9]\\): ?\\([1-9][0-9]*\\)[ :]"
				   name))
		(hyrolo-grep-file (match-string-no-properties 1 name)
				  (regexp-quote (substring name (match-end 0)))
				  -1 nil t)
	      (hyrolo-grep (if regexp-flag name (regexp-quote name)) -1 nil nil t))))
    ;; Let user reformat the region just yanked.
    (when (= found 1)
      (funcall hyrolo-yank-reformat-function start (point)))
    found))
--8<---------------cut here---------------end--------------->8---

Because *save-excursion* is used, *start* equals to *(point)* in the
call to *hyrolo-yank-reformat-function*, which only gets the start of
the region just yanked.

Thank you!






This bug report was last modified 20 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.