branch: externals/hyperbole
commit 2ec55777c0ed3149233a6e57db98f8258f8ba62a
Merge: 492157002f 3004f2c3f0
Author: Robert Weiner <[email protected]>
Commit: GitHub <[email protected]>

    Merge pull request #874 from rswgnu/rsw
    
    hywiki.el - Add support for Org '#+TITLE:' lines as a section names
---
 ChangeLog | 18 +++++++++++++++++-
 hpath.el  |  9 +++++----
 hywiki.el | 14 +++++++-------
 3 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index eb765289f8..7bd105b41b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2026-02-28  Bob Weiner  <[email protected]>
+
+* hywiki.el (hywiki-completion-at-point): Remove 'hywiki-get-singular-wikiword'
+    call because it can be wrong.
+            (hywiki-completion-exit-function): Allow completion function to
+    send any number of arguments (unused right now).
+
+2026-02-27  Bob Weiner  <[email protected]>
+
+* hpath.el (hpath:outline-section-pattern): Add support for Org '#+TITLE:'
+    lines.  Also, allow leading spaces
+* hywiki.el (hywiki-completion-at-point): Add support for Org '#+TITLE:'
+    lines as section headers.
+            (hywiki-completion-at-point): Remove grep -r arg since don't
+    need to recurse in 'hywiki-directory'.
+
 2026-02-27  Mats Lidell  <[email protected]>
 
 * test/hywiki-yki-tests.el (hywiki-test--insert-with-point): Remove. Reuse
@@ -5,7 +21,7 @@
     (hywiki-test--get-buffer-text-with-point-and-highlight): Change to a
     more lifelike test that behaves the same in batch as interactively to
     solve the issue with the failing test for now. Use
-    hywiki-tests--insert-by-char and remove not needed hywiki-mode calls. 
+    hywiki-tests--insert-by-char and remove not needed hywiki-mode calls.
 
 2026-02-26  Bob Weiner  <[email protected]>
 
diff --git a/hpath.el b/hpath.el
index 5a830de20e..948dee758d 100644
--- a/hpath.el
+++ b/hpath.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     1-Nov-91 at 00:44:23
-;; Last-Mod:      1-Jan-26 at 18:17:35 by Mats Lidell
+;; Last-Mod:     28-Feb-26 at 00:44:36 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -691,9 +691,10 @@ Contains a %s for replacement of a specific section name.")
 (defconst hpath:markdown-suffix-regexp "\\.[mM][dD]"
   "Regexp that matches to a Markdown file suffix.")
 
-(defconst hpath:outline-section-pattern "^\\*+[ \t]+%s[ 
\t]*\\([\[<\({[:punct:]]+\\|$\\)"
+(defconst hpath:outline-section-pattern "^\\(\\*+\\|#\\+TITLE:\\)[ \t]+%s[ 
\t]*\\([\[<\({[:punct:]]+\\|$\\)"
   "Bol-anchored, no leading spaces regexp matching an Emacs outline section 
header.
-Contains a %s for replacement of a specific section name.")
+Also supports Org '#+TITLE:' lines and headings as sections.  Contains a %s
+for replacement of a specific section name.")
 
 (defvar hpath:prefix-regexp "\\`[-!&][ ]*"
   "Regexp matching command characters which may precede a pathname.
@@ -904,7 +905,7 @@ if (hpath:remote-available-p) returns nil."
                     (string-match hpath:string-url-regexp3 path))
                 (if (string-match-p "\\`s?ftp\\'"
                                     (match-string-no-properties 
hpath:hostname-grpn path))
-                    
+
                     (concat
                      "/" user "@"
                      ;; site
diff --git a/hywiki.el b/hywiki.el
index cef81098b3..173d748b12 100644
--- a/hywiki.el
+++ b/hywiki.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    21-Apr-24 at 22:41:13
-;; Last-Mod:     27-Feb-26 at 00:25:56 by Bob Weiner
+;; Last-Mod:     28-Feb-26 at 01:39:39 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -277,7 +277,7 @@ Use nil for no HyWiki mode indicator."
   "List of referent type symbols that support # and :L line number suffixes.")
 
 (defvar hywiki-file-suffix ".org"
-  "File suffix (including period) to use when creating HyWiki pages.")
+  "File suffix string (including period) to use when creating HyWiki pages.")
 
 ;;;###autoload
 (defun hywiki-let-directory (option value)
@@ -1490,13 +1490,13 @@ Each candidate is an alist with keys: file, line, text, 
and display."
                             (not (hywiki-non-hook-context-p))
                             (hywiki-word-at t t)))
          (ref (nth 0 ref-start-end))
-         (partial-page-name (hywiki-get-singular-wikiword ref))
          (start (nth 1 ref-start-end))
-         (end (nth 2 ref-start-end)))
+         (end (nth 2 ref-start-end))
+         (partial-page-name ref))
     (when start
       (let* ((default-directory hywiki-directory)
-             (cmd (format "grep -nEH -r '^[ \t]*\\*+ +' ./*%s*%s"
-                          partial-page-name
+             (cmd (format "grep -nEH '^([ \t]*\\*+|#\\+TITLE:) +' ./*%s*%s"
+                          (regexp-quote partial-page-name)
                           hywiki-file-suffix))
              (output (shell-command-to-string cmd))
              (lines (split-string output "\n" t))
@@ -3971,7 +3971,7 @@ occurs with one of these hooks, the problematic hook is 
removed."
   (hywiki-get-referent-hasht)
   (hywiki-maybe-directory-updated))
 
-(defun hywiki-completion-exit-function ()
+(defun hywiki-completion-exit-function (&rest _)
   "Function called when HyWiki reference completion ends."
   (hywiki-maybe-highlight-reference))
 

Reply via email to