Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
2026-10-01 Bob Weiner <rsw@gnu.org>

* test/hyrolo-tests.el (hyrolo-tests--gen-kotl-outline): Fix kotl tests
that previously got no results from kotl calls and so undercounted
matches. Set the proper number to fix tests.

2026-09-30 Bob Weiner <rsw@gnu.org>

* hsys-consult.el (hsys-consult-entry-regexp): Add support for Koutline
cell relative ids trailing separators.

* hyrolo.el (hyrolo-grep-file): Add check to not add 'hyrolo-entry-regexp'
prefix to patterns that already contain the prefix. This fixes
'hyrolo-yank' for 'kotl-mode' entries.
kotl/kview.el (kview:outline-regexp): Allow for regexp quoted
backslashes in front of a period at the start of
'kview:default-label-separator' so works properly when used in
'hyrolo-entry-regexp' in 'hyrolo-grep-file' call from 'hyrolo-yank'.
test/hyrolo-tests.el (hyrolo-tests--yank): Add test from Mats that
now passes.

* hyrolo.el (hyrolo-display-buffer): Clarify that this can be a buffer
or buffer name.
(hyrolo-display-buffer-name): Add and use where a string
type is required.

* man/hy-package.el:
man/hy-straight.el: Remove configuration from these two files.
man/use-package: Finish reference 'use-package' configuration here.
Expand Down
4 changes: 2 additions & 2 deletions hibtypes.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 19-Sep-91 at 20:45:31
;; Last-Mod: 29-Sep-26 at 16:11:57 by Bob Weiner
;; Last-Mod: 30-Sep-26 at 17:04:10 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -333,7 +333,7 @@ in all buffers."
;; Don't want this to trigger in a mail/news summary buffer.
(not (or (hmail:lister-p) (hnews:lister-p))))
(when (boundp 'hyrolo-display-buffer)
(equal (buffer-name) hyrolo-display-buffer))
(equal (buffer-name) (hyrolo-display-buffer-name)))
(and (hypb:buffer-file-name)
(boundp 'hyrolo-file-list)
(set:member (current-buffer)
Expand Down
17 changes: 11 additions & 6 deletions hsys-consult.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 4-Jul-24 at 09:57:18
;; Last-Mod: 20-Jul-26 at 01:52:39 by Bob Weiner
;; Last-Mod: 1-Oct-26 at 00:36:12 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand All @@ -28,11 +28,12 @@
;; Don't (require 'consult) here since want to create that dependency only
;; when a function within this library is called.

(require 'find-func)
(require 'hbut)
(require 'hargs)
(require 'hproperty)
(require 'hsys-org-roam)
(require 'find-func)
(require 'kview) ;; For `kview:outline-regexp'

;;; ************************************************************************
;;; Public declarations
Expand Down Expand Up @@ -69,8 +70,12 @@
;;; Public variables
;;; ************************************************************************

(defvar hsys-consult-entry-regexp "^[*#]+ "
"Regexp prefix to match to multi-line entries with `consult-grep'.")
;; This regexp is used interactively by `consult-grep' and can easily break
;; if changed. The groupings and not anchoring `kview:outline-regexp' to
;; the beginning of the line are necessary for matching to work properly.
;; -- RSW, 2026-10-01
(defvar hsys-consult-entry-regexp (concat "\\(\\(^[*#]+ \\)\\|" kview:outline-regexp "\\)")
"`consult-grep' regexp to match to the first line of multi-line entries.")

(defvar hsys-consult-exit-value nil
"Value from a user-defined exit-hook sent to `hsys-consult-get-exit-value'.")
Expand Down Expand Up @@ -153,7 +158,7 @@ optional REGEXP up to MAX-MATCHES in PATH-LIST.
Use ripgrep (rg) if found, otherwise, plain grep. Initialize search with
optional REGEXP and interactively prompt for changes. Limit matches per
file to the absolute value of MAX-MATCHES, if given and not 0. If 0, match
to headlines only (lines that start with a '^[*#]+' regexp).
to headlines only (lines that start with `hsys-consult-entry-regexp').

With optional PROMPT string, use this as the first part of the grep prompt;
omit any trailing colon and space in the prompt."
Expand Down Expand Up @@ -270,7 +275,7 @@ Use ripgrep (rg) if found, otherwise, plain grep to search Org files within
`org-roam-directory'. Initialize search with optional REGEXP and
interactively prompt for changes. Limit matches per file to the absolute
value of MAX-MATCHES, if given and not 0. If 0, match to the start of
headline text only (lines that start with the '^[*#]+' regexp)."
headline text only (lines that start with `hsys-consult-entry-regexp')."
(interactive "i\nP")
(hsys-consult--org-roam-call-function
(lambda ()
Expand Down
28 changes: 22 additions & 6 deletions hyrolo.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 7-Jun-89 at 22:08:29
;; Last-Mod: 12-Sep-26 at 13:57:08 by Mats Lidell
;; Last-Mod: 30-Sep-26 at 17:28:37 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -171,7 +171,8 @@ their standard major modes perform.")
:group 'hyperbole-hyrolo)

(defvar hyrolo-display-buffer "*HyRolo*"
"Buffer used to display set of last matching rolo entries.")
"Buffer or buffer name used to display set of last matching HyRolo entries.
Call `hyrolo-display-buffer-name' to get its buffer name value.")

(defvar hyrolo-source-buffer nil
"The source file associated with (point) within the HyRolo display buffer.
Expand Down Expand Up @@ -579,6 +580,16 @@ omit any trailing colon and space in the prompt."
"Grep HyRolo headlines"
"Grep HyRolo files")))))

;;;###autoload
(defun hyrolo-display-buffer-name ()
"Return `hyrolo-display-buffer's name or signal an error if an invalid type."
(cond ((stringp hyrolo-display-buffer)
hyrolo-display-buffer)
((bufferp hyrolo-display-buffer)
(buffer-name hyrolo-display-buffer))
(t (error "(hyrolo-display-buffer-name): `hyrolo-display-buffer' must be a string or buffer but is of type: %s"
(type-of hyrolo-display-buffer)))))

;;;###autoload
(defun hyrolo-display-matches (&optional display-buf return-to-buffer)
"Display optional DISPLAY-BUF buffer of previously found rolo matches.
Expand Down Expand Up @@ -844,7 +855,7 @@ If ARG is zero, move to the beginning of the current line."

(defsubst hyrolo-hdr-at-p ()
"Return pos if point is at the start of a `hyrolo-mode' file header, else nil."
(text-property-any (point) (1+ (point)) :hyrolo-hdr t))
(text-property-any (point) (min (1+ (point)) (point-max)) :hyrolo-hdr t))

;;;###autoload
(defun hyrolo-get-entry (name &optional regexp-flag exclude-sub-entries)
Expand Down Expand Up @@ -1303,12 +1314,16 @@ Raise an error if a match is not found."

(define-derived-mode hyrolo-outline-mode outline-mode "HyRoloOtl"
"Set major mode for HyRolo searches of outlines with selective display.
Emacs outline files with extensions of .otl and .outl use this mode
automatically.

The difference from `outline-mode' is that it does not change the hidden
state of any entries when invoked, as it is used in the HyRolo display
matches buffer when moving through entries.

Headings are lines which start with asterisks: one for major headings,
two for subheadings, etc. Lines not starting with asterisks are body lines.
By default, headings are lines which start with asterisks: one for major
headings, two for subheadings, etc. Lines not starting with asterisks are
body lines.

Body text or subheadings under a heading can be made temporarily
invisible, or visible again. Invisible lines are attached to the end
Expand Down Expand Up @@ -2184,7 +2199,8 @@ Return number of matching entries found."
"#+[ \t]+\\|"
(regexp-quote "^") "\\|"
(regexp-quote "\\`") "\\)")
pattern)))
pattern))
(not (string-match-p hyrolo-entry-regexp pattern)))
;; If matching only to headlines and pattern is not already
;; anchored to the beginning of lines, add a file-type-specific
;; headline prefix regexp to the pattern to match.
Expand Down
8 changes: 4 additions & 4 deletions kotl/kotl-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 6/30/93
;; Last-Mod: 29-Sep-26 at 19:20:34 by Bob Weiner
;; Last-Mod: 1-Oct-26 at 01:39:17 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -231,7 +231,7 @@ It provides the following keys:
;; Used by kimport.el functions.
(unless (and (boundp 'kotl-previous-mode) kotl-previous-mode
(eq kotl-previous-mode #'kotl-mode)
(not (string-prefix-p hyrolo-display-buffer (buffer-name))))
(not (string-prefix-p (hyrolo-display-buffer-name) (buffer-name))))
(setq hyrolo-entry-regexp (concat "^" kview:outline-regexp)
hyrolo-hdr-and-entry-regexp (concat hyrolo-hdr-prefix-regexp hyrolo-entry-regexp)
hyrolo-entry-group-number 2
Expand Down Expand Up @@ -284,7 +284,7 @@ It provides the following keys:
;; May be a portion of a Koutline in a HyRolo match buffer; we set
;; kotl-mode then to use its local variable settings but don't want
;; to do any of the following formatting.
(if (string-prefix-p hyrolo-display-buffer (buffer-name))
(if (string-prefix-p (hyrolo-display-buffer-name) (buffer-name))
(unless (and (boundp 'kotl-kview) (kview:is-p kotl-kview))
(kview:create (buffer-name))) ;; sets buffer-local `kotl-kview'
;; If buffer has not yet been formatted for editing, format it.
Expand All @@ -311,7 +311,7 @@ It provides the following keys:
(with-suppressed-warnings ((free-vars kotl-previous-mode))
(setq kotl-previous-mode 'kotl-mode))
(run-mode-hooks 'kotl-mode-hook)
(unless (string-prefix-p hyrolo-display-buffer (buffer-name))
(unless (string-prefix-p (hyrolo-display-buffer-name) (buffer-name))
(add-hook 'change-major-mode-hook #'kotl-mode:show-all nil t))))

;;;###autoload
Expand Down
7 changes: 4 additions & 3 deletions kotl/kview.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 6/30/93
;; Last-Mod: 24-Sep-26 at 16:47:15 by Bob Weiner
;; Last-Mod: 1-Oct-26 at 01:36:36 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -93,8 +93,9 @@ Default value is \". \"."
:type 'string
:group 'hyperbole-koutliner)

(defconst kview:outline-regexp (concat "\\( *\\)\\([0-9][0-9a-z.]*\\)\\("
(regexp-quote kview:default-label-separator)
(defconst kview:outline-regexp (concat "\\(\\s-*\\)\\([0-9][0-9a-z.]*\\)"
"\\([\\\\]*"
(regexp-quote kview:default-label-separator)
"\\)")
"Koutline view `outline-regexp' value that handles all label formats.")

Expand Down
4 changes: 2 additions & 2 deletions test/demo-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 30-Jan-21 at 12:00:00
;; Last-Mod: 29-Sep-26 at 02:06:23 by Bob Weiner
;; Last-Mod: 30-Sep-26 at 17:04:16 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -151,7 +151,7 @@
(with-temp-buffer
(load (expand-file-name "hyrolo-demo.el" hyperb:dir))
(should (hact 'kbd-key "C-x 4 r work RET"))
(should (string= (buffer-name) hyrolo-display-buffer))
(should (string= (buffer-name) (hyrolo-display-buffer-name)))
(should (search-forward "Dunn, John")))
(hyrolo-demo-quit)))

Expand Down
Loading
Loading