emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole 4026c7cefd 7/7: Merge pull request #516 from


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 4026c7cefd 7/7: Merge pull request #516 from rswgnu/rsw
Date: Mon, 15 Apr 2024 06:58:14 -0400 (EDT)

branch: externals/hyperbole
commit 4026c7cefd9820b4478d71bc1ccf97b9c139adf8
Merge: 0bab6487ea 409db374d1
Author: Robert Weiner <rsw@gnu.org>
Commit: GitHub <noreply@github.com>

    Merge pull request #516 from rswgnu/rsw
    
    Xref-based LSP support for any prog language; command-line search of HyRolos
---
 ChangeLog     |  14 +++++++
 MANIFEST      |   7 +++-
 Makefile      |   4 +-
 hmouse-tag.el |  24 ++++++++++-
 hsys-xref.el  |   7 +++-
 hui-mouse.el  | 128 ++++++++++++++++++++++++++++++----------------------------
 6 files changed, 117 insertions(+), 67 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2f18b37e28..78e07d7d54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,20 @@
 
 2024-04-14  Bob Weiner  <rsw@gnu.org>
 
+* hyrolo.py: Add this file for command-line search for string matches in HyRolo
+    files.
+ Makefile (HYPERBOLE_FILES): Add hyrolo.py.
+
+* hui-mouse.el (hkey-alist):
+  hmouse-tag.el (smart-prog-at-tag-p, smart-prog-tag): Add default
+    handlers for programming languages that have xref support but no other
+    specific Hyperbole features.
+
+* hsys-xref.el (hsys-xref-identifier-at-point, hsys-xref-item-at-point): Add so
+     do not expose any internal xref call outside of this library.
+  hui-mouse.el (hsys-xref): Switch to using 'hsys-xref-item-at-point' and add
+    (require 'hsys-xref).
+
 * hbut.el (ibut:create): Set 'name-start' and 'name-end' location attributes
     when previously set in call of 'ibut:set-name-and-label-key-p'.
 
diff --git a/MANIFEST b/MANIFEST
index 371c52ebde..3fc33c06fa 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -61,8 +61,6 @@ hpath.el             - GNU Hyperbole support routines for 
handling UNIX paths
 htz.el               - Timezone-based time and date support for GNU Hyperbole
 hypb.el              - Miscellaneous GNU Hyperbole support features
 hypb-ert.el          - Hyperbole test runner action button types
-hyrolo.el            - Hierarchical, multi-file, easy-to-use record management 
system
-hyrolo-logic.el      - Logic functions for GNU Hyperbole Rolo files
 hywconfig.el         - Save ring of window configurations
 set.el               - General mathematical operators for unordered sets
 
@@ -75,6 +73,11 @@ hsmail.el            - GNU Hyperbole buttons in mail 
composer: mail
 kotl/MANIFEST        - Summary of Koutliner files
 kotl/EXAMPLE.kotl    - Sample Koutline document explaining Koutliner features
 
+* --- HYPERBOLE ROLO ---
+hyrolo.el            - Hierarchical, multi-file, easy-to-use record management 
system
+hyrolo.py            - Output file header and matching entries from HyRolo 
files via the command-line
+hyrolo-logic.el      - Logic functions for GNU Hyperbole Rolo files
+
 * --- USENET NEWS SUPPORT ---
 hgnus.el             - GNU Hyperbole buttons in news reader/poster: GNUS
 
diff --git a/Makefile b/Makefile
index bff095a1c1..940d0100d1 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 # Author:       Bob Weiner
 #
 # Orig-Date:    15-Jun-94 at 03:42:38
-# Last-Mod:      7-Apr-24 at 10:40:38 by Bob Weiner
+# Last-Mod:     14-Apr-24 at 23:00:20 by Bob Weiner
 #
 # Copyright (C) 1994-2023  Free Software Foundation, Inc.
 # See the file HY-COPY for license information.
@@ -209,7 +209,7 @@ HYPERBOLE_FILES = dir info html $(EL_SRC) $(EL_KOTL) \
        $(HY-TALK) .mailmap ChangeLog COPYING Makefile HY-ABOUT HY-ANNOUNCE \
         HY-CONCEPTS.kotl HY-NEWS \
        HY-WHY.kotl INSTALL DEMO DEMO-ROLO.otl FAST-DEMO MANIFEST README.md 
TAGS _hypb \
-        .hypb smart-clib-sym topwin.py hyperbole-banner.png 
$(man_dir)/hkey-help.txt \
+        .hypb hyrolo.py smart-clib-sym topwin.py hyperbole-banner.png 
$(man_dir)/hkey-help.txt \
        $(man_dir)/hyperbole.texi $(man_dir)/hyperbole.css
 
 TEST_ERT_FILES = $(wildcard test/*tests.el) $(wildcard test/hy-test-*.el)
diff --git a/hmouse-tag.el b/hmouse-tag.el
index 890ee70fff..a836235dcf 100644
--- a/hmouse-tag.el
+++ b/hmouse-tag.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    24-Aug-91
-;; Last-Mod:      9-Apr-24 at 23:19:17 by Bob Weiner
+;; Last-Mod:     14-Apr-24 at 21:27:25 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -960,6 +960,28 @@ When optional NO-FLASH, do not flash."
             (buffer-substring-no-properties (match-beginning 2) (match-end 2))
             (match-beginning 2) (match-end 2)))))))
 
+;; smart-prog language default support functions
+;;;###autoload
+(defun smart-prog-at-tag-p (&optional no-flash)
+  "Return programming language tag name that point is within, else nil.
+When optional NO-FLASH, do not flash.
+Uses `xref' for identifier recognition."
+  (when (derived-mode-p 'prog-mode)
+    (let ((identifier (hsys-xref-identifier-at-point)))
+      (when identifier
+       (setq identifier (substring-no-properties identifier))
+       (if no-flash
+           identifier
+         (smart-flash-tag identifier (point) (match-end 0)))
+       identifier))))
+
+;;;###autoload
+(defun smart-prog-tag (&optional identifier next)
+  "Jump to definition of optional programming IDENTIFIER or the one at point.
+Optional second arg NEXT means jump to next matching tag."
+  (smart-tags-display (or identifier (hsys-xref-identifier-at-point)) next)
+  t)
+
 (defun smart-jedi-find-file (file line column other-window)
   "Function that read a source FILE for jedi navigation.
 It takes these arguments: (file-to-read other-window-flag
diff --git a/hsys-xref.el b/hsys-xref.el
index 4be90a04be..d633699af1 100644
--- a/hsys-xref.el
+++ b/hsys-xref.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    24-Aug-91
-;; Last-Mod:     21-Jan-24 at 12:42:59 by Bob Weiner
+;; Last-Mod:     14-Apr-24 at 19:03:32 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -48,6 +48,9 @@
   "Return the first definition of string IDENTIFIER."
   (car (hsys-xref-definitions identifier)))
 
+(defun hsys-xref-identifier-at-point ()
+  (xref-backend-identifier-at-point (xref-find-backend)))
+
 (defun hsys-xref-item-buffer (item)
   "Return the buffer in which xref ITEM is defined."
   (marker-buffer (save-excursion (xref-location-marker (xref-item-location 
item)))))
@@ -66,6 +69,8 @@
    (max (point-min) (if (eolp) (1- (point)) (point)))
    'xref-item))
 
+(defalias 'hsys-xref-item-at-point #'xref--item-at-point)
+
 (provide 'hsys-xref)
 
 ;;; hsys-xref.el ends here
diff --git a/hui-mouse.el b/hui-mouse.el
index 016892db25..6c56873ada 100644
--- a/hui-mouse.el
+++ b/hui-mouse.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    04-Feb-89
-;; Last-Mod:      4-Feb-24 at 10:07:05 by Bob Weiner
+;; Last-Mod:     15-Apr-24 at 00:08:13 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -39,12 +39,13 @@
 ;;; Other required Elisp libraries
 ;;; ************************************************************************
 
-(require 'ert-results nil t) ;; Action Key support in ERT result buffers
+(require 'ert-results nil t) ;; Optional Action Key support in ERT result 
buffers
 ;; Library in next line (for code optionally used in `smart-eol') uses
 ;; `repeat-map' which was not added to the "repeat.el" library in Emacs 27.1,
 ;; so don't use if it fails to load properly.
 (ignore-errors (require 'hsys-flymake))
 (require 'hload-path)
+(require 'hsys-xref)
 (require 'hsys-org)
 (require 'hbut)
 (unless (fboundp 'smart-info)
@@ -318,7 +319,7 @@ Its default value is `smart-scroll-down'.  To disable it, 
set it to
     ;;
     ;; If in an xref buffer on a listing of matching identifier lines, go to
     ;; the source line referenced by the current entry.
-    ((and (fboundp 'xref--item-at-point) (xref--item-at-point))
+    ((hsys-xref-item-at-point)
      . ((xref-goto-xref) . (xref-show-location-at-point)))
     ;;
     ;; The Smart Menu system is an attractive in-buffer menu system
@@ -574,7 +575,12 @@ Its default value is `smart-scroll-down'.  To disable it, 
set it to
     ;;
     ;; Todotxt
     ((eq major-mode 'todotxt-mode)
-     . ((smart-todotxt) . (smart-todotxt-assist))))
+     . ((smart-todotxt) . (smart-todotxt-assist)))
+    ;;
+    ;; Any other programming modes not specially supported
+    ;; Use xref which supports various Language Servers
+    ((setq hkey-value (smart-prog-at-tag-p))
+     . ((smart-prog-tag hkey-value) . (smart-prog-tag hkey-value))))
   "Alist of predicates and form-conses for the Action and Assist Keyboard Keys.
 Each element is: (PREDICATE-FORM . (ACTION-KEY-FORM . ASSIST-KEY-FORM)).
 When the Action or Assist Key is pressed, the first or second form,
@@ -2071,63 +2077,6 @@ With optional POS, use that instead of point."
         (and selective-display (eq (following-char) ?\r)))
     t))
 
-;;; ************************************************************************
-;;; smart-todotxt functions
-;;; ************************************************************************
-
-(defun smart-todotxt ()
-  "Use a single key or mouse key to manipulate `todotxt' items.
-
-If key is pressed:
- (1) at the end of buffer, bury buffer
- (2) on a todo item, toggle the completion"
-  (interactive)
-  (cond ((smart-eobp) (todotxt-bury))
-       (t (todotxt-complete-toggle))))
-
-(defun smart-todotxt-assist ()
-  "Use a single assist key or mouse assist key to manipulate `todotxt' items.
-
-If key is pressed:
- (1) at the end of buffer, archive completed items
- (2) on a todo item, edit it"
-
-  (interactive)
-  (cond ((smart-eobp) (todotxt-archive))
-       (t (todotxt-edit-item))))
-
-;;;###autoload
-(defun smart-eobp ()
-  "Return t if point is past the last visible buffer line with text."
-  (and (or (eobp)
-          ;; On a blank line and nothing but whitespace until eob
-          (save-excursion
-            (beginning-of-line)
-            (looking-at "[ \t\n\r\f]+\\'")))
-       (or (not (smart-outline-char-invisible-p))
-          (not (smart-outline-char-invisible-p (1- (point)))))))
-
-(defun smart-eolp ()
-  "Return t if point is at the end of a visible line but not the end of the 
buffer."
-  ;; smart-helm handles eol for helm buffers
-  (unless (or (and (smart-helm-alive-p) (equal (helm-buffer-get) 
(buffer-name)))
-             ;; Allow for org global cycling at start of buffer on a
-             ;; non-heading line in Hyperbole doc files when
-             ;; displayed from Hyperbole menu items.
-             (smart-org-bob-and-non-heading-p)
-             ;; If there is a flymake diagnostic issue at eol,
-             ;; drop through this clause to handle it later.
-             (and (featurep 'hsys-flymake)
-                  (boundp 'flymake-mode)
-                  flymake-mode
-                  (eolp)
-                  (hsys-flymake-get-issue-at-position)))
-    (if (eq major-mode 'kotl-mode)
-       (and (not (kotl-mode:eobp)) (kotl-mode:eolp t))
-      (and (not (smart-eobp)) (eolp)
-          (or (not (smart-outline-char-invisible-p))
-              (not (smart-outline-char-invisible-p (1- (point)))))))))
-
 ;;; ************************************************************************
 ;;; smart-push-button functions
 ;;; ************************************************************************
@@ -2206,6 +2155,63 @@ If assist key is pressed:
         (goto-char (point-max)))
        (t (tar-flag-deleted 1))))
 
+;;; ************************************************************************
+;;; smart-todotxt functions
+;;; ************************************************************************
+
+(defun smart-todotxt ()
+  "Use a single key or mouse key to manipulate `todotxt' items.
+
+If key is pressed:
+ (1) at the end of buffer, bury buffer
+ (2) on a todo item, toggle the completion"
+  (interactive)
+  (cond ((smart-eobp) (todotxt-bury))
+       (t (todotxt-complete-toggle))))
+
+(defun smart-todotxt-assist ()
+  "Use a single assist key or mouse assist key to manipulate `todotxt' items.
+
+If key is pressed:
+ (1) at the end of buffer, archive completed items
+ (2) on a todo item, edit it"
+
+  (interactive)
+  (cond ((smart-eobp) (todotxt-archive))
+       (t (todotxt-edit-item))))
+
+;;;###autoload
+(defun smart-eobp ()
+  "Return t if point is past the last visible buffer line with text."
+  (and (or (eobp)
+          ;; On a blank line and nothing but whitespace until eob
+          (save-excursion
+            (beginning-of-line)
+            (looking-at "[ \t\n\r\f]+\\'")))
+       (or (not (smart-outline-char-invisible-p))
+          (not (smart-outline-char-invisible-p (1- (point)))))))
+
+(defun smart-eolp ()
+  "Return t if point is at the end of a visible line but not the end of the 
buffer."
+  ;; smart-helm handles eol for helm buffers
+  (unless (or (and (smart-helm-alive-p) (equal (helm-buffer-get) 
(buffer-name)))
+             ;; Allow for org global cycling at start of buffer on a
+             ;; non-heading line in Hyperbole doc files when
+             ;; displayed from Hyperbole menu items.
+             (smart-org-bob-and-non-heading-p)
+             ;; If there is a flymake diagnostic issue at eol,
+             ;; drop through this clause to handle it later.
+             (and (featurep 'hsys-flymake)
+                  (boundp 'flymake-mode)
+                  flymake-mode
+                  (eolp)
+                  (hsys-flymake-get-issue-at-position)))
+    (if (eq major-mode 'kotl-mode)
+       (and (not (kotl-mode:eobp)) (kotl-mode:eolp t))
+      (and (not (smart-eobp)) (eolp)
+          (or (not (smart-outline-char-invisible-p))
+              (not (smart-outline-char-invisible-p (1- (point)))))))))
+
 (provide 'hui-mouse)
 
 ;;; hui-mouse.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]