[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 277dacbf0a 1/6: Add file exist check in ripgr
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole 277dacbf0a 1/6: Add file exist check in ripgrep-msg and a test case |
Date: |
Sat, 24 Aug 2024 03:58:13 -0400 (EDT) |
branch: externals/hyperbole
commit 277dacbf0a0f56f1966bce32224652ad345ffa97
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: Mats Lidell <mats.lidell@lidells.se>
Add file exist check in ripgrep-msg and a test case
---
ChangeLog | 6 ++++++
hibtypes.el | 5 +++--
test/hibtypes-tests.el | 28 +++++++++++++++++++++++++++-
3 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8c5a236c28..5233c20b93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-08-23 Mats Lidell <matsl@gnu.org>
+
+* hibtypes.el (ripgrep-msg): Add check of file exist.
+
+* test/hibtypes-tests.el (ibtypes::ripgrep-msg-test): Test ripgrep-msg.
+
2024-08-18 Bob Weiner <rsw@gnu.org>
* hywiki.el (hywiki-maybe-at-wikiword-beginning): Fix to handle word
diff --git a/hibtypes.el b/hibtypes.el
index faeaac5ea9..517cca26d7 100644
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 19-Sep-91 at 20:45:31
-;; Last-Mod: 18-Aug-24 at 09:14:53 by Mats Lidell
+;; Last-Mod: 23-Aug-24 at 21:28:35 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -997,7 +997,8 @@ than a helm completion buffer)."
(looking-at "[1-9][0-9]*[-:]\\|--$")))
(unless (or (looking-at "[1-9][0-9]*[-:]\\|--$")
(and (setq file (buffer-substring-no-properties
(line-beginning-position) (line-end-position)))
- (string-empty-p (string-trim file))))
+ (or (string-empty-p (string-trim file))
+ (not (file-exists-p (string-trim file))))))
(ibut:label-set (concat file ":" line-num))
(hact 'hib-link-to-file-line file line-num)))))))
diff --git a/test/hibtypes-tests.el b/test/hibtypes-tests.el
index 5d0c334f70..acac882990 100644
--- a/test/hibtypes-tests.el
+++ b/test/hibtypes-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 20-Feb-21 at 23:45:00
-;; Last-Mod: 5-Aug-24 at 17:37:57 by Mats Lidell
+;; Last-Mod: 10-Aug-24 at 23:27:05 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -297,7 +297,33 @@
;; ipython-stack-frame
;; ripgrep-msg
+(ert-deftest ibtypes::ripgrep-msg-test ()
+ "Verify `ripgrep-msg'."
+ ;; Date is picked up as a line number but file existence test before
+ ;; concluding it is a button save it from being identified as
+ ;; a ripgrep-msg.
+ (with-temp-buffer
+ (insert "one two three\n2024-07-30 line\n")
+ (goto-line 2)
+ (should-not (eq (hattr:get (hbut:at-p) 'actype) 'hib-link-to-file-line))
+ (should-not (ibtypes::ripgrep-msg)))
+ ;; Regular ripgrep-msg case.
+ (with-temp-buffer
+ (insert "hibtypes.el\n20: line\n")
+ (goto-line 2)
+ (mocklet (((hib-link-to-file-line "hibtypes.el" "20") => t)
+ ((file-exists-p "hibtypes.el") => t))
+ (should (eq (hattr:get (hbut:at-p) 'actype) 'hib-link-to-file-line))
+ (should (ibtypes::ripgrep-msg))))
+
+ ;; Regular match but file does not exist case.
+ (with-temp-buffer
+ (insert "unknown-file\n20: line\n")
+ (goto-line 2)
+ (should-not (eq (hattr:get (hbut:at-p) 'actype) 'hib-link-to-file-line))
+ (should-not (ibtypes::ripgrep-msg))))
+
;; grep-msg
;; debugger-source
- [elpa] externals/hyperbole updated (8fa9e4e198 -> a9bc432488), ELPA Syncer, 2024/08/24
- [elpa] externals/hyperbole a9bc432488 6/6: Merge pull request #579 from rswgnu/rsw, ELPA Syncer, 2024/08/24
- [elpa] externals/hyperbole f1ede2a4b7 4/6: Merge pull request #564 from rswgnu/fix-ripgrep-msg-problem, ELPA Syncer, 2024/08/24
- [elpa] externals/hyperbole 4a15dba0ab 5/6: Merge branch 'master' into rsw, ELPA Syncer, 2024/08/24
- [elpa] externals/hyperbole 81a0619202 3/6: Add TagFind to HyWiki and HyRolo menus and more updates, ELPA Syncer, 2024/08/24
- [elpa] externals/hyperbole 277dacbf0a 1/6: Add file exist check in ripgrep-msg and a test case,
ELPA Syncer <=
- [elpa] externals/hyperbole 63eb11702e 2/6: Update after review, ELPA Syncer, 2024/08/24