[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 5df7e8802b: Initial HyRolo updates to support
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole 5df7e8802b: Initial HyRolo updates to support forthcoming note taking subsystem |
Date: |
Fri, 7 Oct 2022 15:57:39 -0400 (EDT) |
branch: externals/hyperbole
commit 5df7e8802bae13a0062974b24dffb136f1af2343
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>
Initial HyRolo updates to support forthcoming note taking subsystem
---
ChangeLog | 67 ++++++++++++++++-
HY-TALK/HY-TALK.org | 4 +-
HY-TALK/HYPB | 13 +++-
hib-doc-id.el | 6 +-
hibtypes.el | 8 +-
hui-mini.el | 5 +-
hui.el | 13 ++--
hypb.el | 27 ++++++-
hyrolo-logic.el | 182 ++++++++++++++++++++++++++-------------------
hyrolo.el | 120 +++++++++++++++++++++---------
kotl/kcell.el | 36 +++++++--
kotl/klink.el | 6 +-
kotl/kotl-mode.el | 48 +++++-------
test/demo-tests.el | 11 +--
test/hibtypes-tests.el | 44 +++++------
test/hui-register-tests.el | 2 +-
test/hyrolo-tests.el | 16 ++--
17 files changed, 399 insertions(+), 209 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5547e7ee86..2d6924e5a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-10-06 Bob Weiner <rsw@gnu.org>
+
+* test/hibtypes-tests.el (ibtypes::pathname-path-variable-test): Remove
+ since is a duplicate of 'ibtypes::pathname-directory-test'.
+
2022-10-05 Mats Lidell <matsl@gnu.org>
* hui.el:
@@ -41,12 +46,72 @@
* hload-path.el:
* hinit.el: Shorten docs strings to be within 80 char limit.
+2022-09-30 Bob Weiner <rsw@gnu.org>
+
+* hyrolo-logic.el (hyrolo-not, hyrolo-or, hyrolo-xor, hyrolo-and):
+ Use narrow-to-region and 'hyrolo-next-match-function' to find matches.
+ Also, regexp-quote the pattern as it is a string.
+ (hyrolo-r-not, hyrolo-r-or, hyrolo-r-xor, hyrolo-r-and):
+ Use narrow-to-region and 'hyrolo-next-match-function' to find matches.
+ (hyrolo-fgrep-logical): Add support for using the regex
+ logical functions by prefacing each function with 'r-' in an expression,
+ e.g. (r-and regex1 (r-not regex2)).
+
+* hyrolo.el (hyrolo-verify): Add support for 'hynote-display-buffer'.
+ (hyrolo-grep-file): Change 'regexp' arg to 'pattern' and update
+ doc to mention use of 'hyrolo-next-match-function'.
+
+* kotl/kcell.el (kcell:parse-cell-ref): Extract this from 'kotl-mode:goto-cell'
+ and make an autoload so may be used externally.
+
+2022-09-27 Bob Weiner <rsw@gnu.org>
+
+* kotl/kcell.el (kcell:plist): Change from alias to a function so can include
+ a doc string.
+
+2022-09-26 Bob Weiner <rsw@gnu.org>
+
+* hyrolo.el (hyrolo-next-regexp-match): Add to allow for different
+ hyrolo entry matching functions.
+ (hyrolo-next-match-function): Add.
+ (hyrolo-grep-file): Use above variable.
+
+2022-09-25 Bob Weiner <rsw@gnu.org>
+
+* hyrolo-logic.el (hyrolo-logic): Fix to handle when filename list is used
+ rather than a buffer list.
+
+* hui.el (hui-copy-to-register): Rename 'region' arg to 'region-flag'.
+
+* hyrolo.el (hyrolo-add): Handle markdown-mode which doesn't have a grouping
+ of only space after pound (#) headings.
+ (markdown-mode-hook): Support hyrolo searches in markdown files.
+ (hyrolo-fgrep-file, hyrolo-grep-file, hyrolo-fgrep, hyrolo-grep,
+ hyrolo-word):
+ Add optional 'headline-only' argument.
+* hib-doc-id.el (link-to-doc, doc-id:help): Set new 'headline-only' argument
+ to nil.
+
+2022-09-24 Bob Weiner <rsw@gnu.org>
+
+* hyrolo.el (hyrolo-display-buffer): Change buffer name from "*Hyperbole Rolo*"
+ to "*HyRolo*".
+
+* test/demo-tests.el (demo-hyrolo-test):
+ test/hyrolo-tests.el: Replace all "*Hyperbole Rolo*" with
'hyrolo-display-buffer'.
+
2022-09-19 Mats Lidell <matsl@gnu.org>
* hypb.el (hypb:replace-match-string): Remove unused function.
* hact.el: Use byte-code-function-p.
+2022-09-17 Bob Weiner <rsw@gnu.org>
+
+* kotl/klink.el (klink:cell-ref-regexp): Allow for a comma between
+ the cell reference and a viewspec.
+ kotl/kcell.el (kcell:ref-to-id): Remove any comma.
+
2022-09-14 Mats Lidell <matsl@gnu.org>
* hmouse-sh.el:
@@ -2301,7 +2366,7 @@ V8.0.1 changes ^^^^:
* Makefile (bin): Hide docstring warnings.
-2021-09-26 Robert Weiner <rsw@gnul.org>
+2021-09-26 Bob Weiner <rsw@gnu.org>
* hbut.el (ebut:operate): Rewrote to handle label modification properly and
thereby
fixed
hui-ebut-modify-link-to-www-url-keeping-all-values-should-not-modify-buffer-or-ebut
diff --git a/HY-TALK/HY-TALK.org b/HY-TALK/HY-TALK.org
index 3c2bb0aa98..4292a4cbb6 100644
--- a/HY-TALK/HY-TALK.org
+++ b/HY-TALK/HY-TALK.org
@@ -223,9 +223,9 @@ A Few Common Examples:
* Many More to Learn Across Time
-|-----------------------+------------------------+--------------------------|
+|-----------------------+------------------------+----------------------------|
| Implicit Button Types |
-|-----------------------+------------------------+--------------------------|
+|-----------------------+------------------------+----------------------------|
| action | annot-bib | completion |
| cscope | ctags | debbugs-gnu-mode |
| debbugs-gnu-query | debugger-source | dir-summary |
diff --git a/HY-TALK/HYPB b/HY-TALK/HYPB
index 8c39569cdc..0fb6510a98 100644
--- a/HY-TALK/HYPB
+++ b/HY-TALK/HYPB
@@ -1,3 +1,12 @@
+* Use org-present package to turn Org outline into a presentation
+ you can step through with the space and delete keys.
+
+ Install: <unless (featurep 'org-present) (package-install 'org-present)>
+
+* Enable all Hyperbole keys including {M-RET} in Org mode
+
+ <setq hsys-org-enable-smart-keys t>
+
* How to setup button2 and button3 as Action and Assist Mouse Keys
Add to your Emacs init file:
@@ -12,12 +21,12 @@ or interactively after loading Hyperbole:
** Keypression - overlaying parts of buffer (shows trail of keys)
- Install: <package-install 'keypression>
+ Install: <unless (featurep 'keypression) (package-install 'keypression)>
Activate: <keypression-mode 1>
Deactivate: <keypression-mode 0>
Configure:
- <setq keypression-use-child-frame nil
+ <setq keypression-use-child-frame t
keypression-fade-out-delay 3.0
keypression-frame-justify 'keypression-left-justified
keypression-cast-command-name t
diff --git a/hib-doc-id.el b/hib-doc-id.el
index 028321c951..309314d8c4 100644
--- a/hib-doc-id.el
+++ b/hib-doc-id.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 30-Sep-92 at 19:39:59
-;; Last-Mod: 21-Jul-22 at 11:21:45 by Mats Lidell
+;; Last-Mod: 25-Sep-22 at 02:39:34 by Bob Weiner
;;
;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -125,7 +125,7 @@ an error."
(error "(doc-id-index-entry): You must set the `doc-id-indices'
variable first"))
((let ((hyrolo-entry-regexp doc-id-index-entry-regexp))
(zerop (hyrolo-grep (funcall doc-id-match doc-id)
- 1 doc-id-indices nil 'no-display)))
+ 1 doc-id-indices nil nil 'no-display)))
(error "(doc-id-index-entry): %s not found in document index"
delim-doc-id))
;; Matching index entry has been put into `hyrolo-display-buffer'.
@@ -179,7 +179,7 @@ Also display standard Hyperbole help for implicit button
BUT."
(cond ((null doc-id-indices)
(error "(doc-id-index-entry): You must set the `doc-id-indices'
variable first"))
((zerop (hyrolo-grep (funcall doc-id-match doc-id) 1 doc-id-indices
- nil 'no-display))
+ nil nil 'no-display))
(error
"(doc-id-index-entry): No document index entry found for %s%s%s"
doc-id-start doc-id doc-id-end)))
diff --git a/hibtypes.el b/hibtypes.el
index 094a06ce62..176005c1f4 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: 3-Oct-22 at 20:01:40 by Mats Lidell
+;; Last-Mod: 6-Oct-22 at 18:56:22 by Bob Weiner
;;
;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -1430,6 +1430,12 @@ arg1 ... argN '>'. For example, <mail nil
\"user@somewhere.org\">."
(special-form-p actype-sym))
actype-sym)))
(when actype
+ ;; For <hynote> buttons, need to double quote each argument so
+ ;; 'read' does not change the idstamp 02 to 2.
+ (when (and (memq actype '(hy hynote))
+ (string-match-p " " lbl))
+ (setq lbl (replace-regexp-in-string "\"\\(.*\\)\\'" "\\1\""
+ (combine-and-quote-strings
(split-string lbl) "\" \""))))
(setq action (read (concat "(" lbl ")"))
args (cdr action))
;; Ensure action uses an fboundp symbol if executing a
diff --git a/hui-mini.el b/hui-mini.el
index 1862a9cd9d..e1b5a761fd 100644
--- a/hui-mini.el
+++ b/hui-mini.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 15-Oct-91 at 20:13:17
-;; Last-Mod: 15-Sep-22 at 00:01:16 by Mats Lidell
+;; Last-Mod: 6-Oct-22 at 18:56:05 by Bob Weiner
;;
;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -407,7 +407,8 @@ documentation, not the full text."
"Go to top-level SECTION in personal button file; add the section if
necessary."
(let* ((hypb-personal-file (expand-file-name hbmap:filename hbmap:dir-user))
(hyrolo-file-list (list hypb-personal-file))
- (hyrolo-add-hook)) ;; Prevent addition of dates when add navigation
sections
+ (hyrolo-add-hook)
+ (hyrolo-edit-hook)) ;; Prevent addition of dates when add navigation
sections
(if (= 1 (hyrolo-fgrep section 1 nil t t))
(hpath:find (concat hypb-personal-file "#" section))
(hyrolo-add section))))
diff --git a/hui.el b/hui.el
index 453354040e..08bd9338c3 100644
--- a/hui.el
+++ b/hui.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 19-Sep-91 at 21:42:03
-;; Last-Mod: 4-Oct-22 at 23:44:39 by Mats Lidell
+;; Last-Mod: 6-Oct-22 at 18:55:54 by Bob Weiner
;;
;; Copyright (C) 1991-2021 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -49,12 +49,11 @@
;; Derived from copy-to-register of "register.el"
;;;###autoload
-(defun hui-copy-to-register (register start end &optional delete-flag region)
- "Copy region or thing into register REGISTER.
-With prefix arg, delete as well.
+(defun hui-copy-to-register (register start end &optional delete-flag
region-flag)
+ "Copy region or thing into REGISTER. With prefix arg, delete as well.
Called from program, takes five args: REGISTER, START, END, DELETE-FLAG,
-and REGION. START and END are buffer positions indicating what to copy.
-The optional argument REGION if non-nil, indicates that we're not just
+and REGION-FLAG. START and END are buffer positions indicating what to copy.
+The optional argument REGION-FLAG if non-nil, indicates that we're not just
copying some text between START and END, but we're copying the region.
Interactively, reads the register using `register-read-with-preview'.
@@ -90,7 +89,7 @@ point; see `hui:delimited-selectable-thing'."
(when (and delete-flag start end)
(delete-region start end))))
thing)
- ((and start end region)
+ ((and start end region-flag)
(funcall region-extract-function delete-flag))
((and start end)
(filter-buffer-substring start end delete-flag))
diff --git a/hypb.el b/hypb.el
index d151dfddae..7d9dd811b9 100644
--- a/hypb.el
+++ b/hypb.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 6-Oct-91 at 03:42:38
-;; Last-Mod: 3-Oct-22 at 20:33:54 by Mats Lidell
+;; Last-Mod: 6-Oct-22 at 18:55:39 by Bob Weiner
;;
;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -781,6 +781,31 @@ If ARG <= 0, turn search only visible text."
(message "I-search will %ssearch invisible text"
(if isearch-invisible "" "not "))))
+;; Next function originally from `org-id-uuid' sans org dependency.
+(defun hypb:uuid ()
+ "Return string with random (version 4) universally unique id."
+ (let ((rnd (md5 (format "%s%s%s%s%s%s%s"
+ (random)
+ (time-convert nil 'list)
+ (user-uid)
+ (emacs-pid)
+ (user-full-name)
+ user-mail-address
+ (recent-keys)))))
+ (format "%s-%s-4%s-%s%s-%s"
+ (substring rnd 0 8)
+ (substring rnd 8 12)
+ (substring rnd 13 16)
+ (format "%x"
+ (logior
+ #b10000000
+ (logand
+ #b10111111
+ (string-to-number
+ (substring rnd 16 18) 16))))
+ (substring rnd 18 20)
+ (substring rnd 20 32))))
+
(defun hypb:user-name ()
"Return the current user's email or login name (sans any domain name)."
(if (string-match "@" hyperb:user-email)
diff --git a/hyrolo-logic.el b/hyrolo-logic.el
index c2287dd5ec..f8eab3027f 100644
--- a/hyrolo-logic.el
+++ b/hyrolo-logic.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 13-Jun-89 at 22:57:33
-;; Last-Mod: 14-Sep-22 at 22:36:25 by Mats Lidell
+;; Last-Mod: 6-Oct-22 at 18:55:17 by Bob Weiner
;;
;; Copyright (C) 1989-2022 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -87,7 +87,7 @@ A complex example of EXPR might be:
which means:
Match neither `time' nor `card'
or
- Match exactly one of `french balloons' or `spanish'
+ Match exactly one of (`french' and 'balloons') or (`spanish').
and
Match `teacher' and `pet'.
@@ -106,6 +106,12 @@ single argument."
(setq expr (replace-regexp-in-string "\(xor " "\(@ " expr nil t))
(setq expr (replace-regexp-in-string "\(not " "\(! " expr nil t))
(setq expr (replace-regexp-in-string "\(and " "\(& " expr nil t))
+
+ (setq expr (replace-regexp-in-string "\(r-or " "\(r-| " expr nil t))
+ (setq expr (replace-regexp-in-string "\(r-xor " "\(r-@ " expr nil t))
+ (setq expr (replace-regexp-in-string "\(r-not " "\(r-! " expr nil t))
+ (setq expr (replace-regexp-in-string "\(r-and " "\(r-& " expr nil t))
+
(setq expr (replace-regexp-in-string
"\"\\([^\"]*\\)\"" "{\\1}" expr nil nil))
(setq expr (replace-regexp-in-string
@@ -124,6 +130,12 @@ single argument."
(setq expr (replace-regexp-in-string "\(@ " "\(hyrolo-xor start end "
expr nil t))
(setq expr (replace-regexp-in-string "\(! " "\(hyrolo-not start end "
expr nil t))
(setq expr (replace-regexp-in-string "\(& " "\(hyrolo-and start end "
expr nil t))
+
+ (setq expr (replace-regexp-in-string "\(r-| " "\(hyrolo-r-or start end
" expr nil t))
+ (setq expr (replace-regexp-in-string "\(r-@ " "\(hyrolo-r-xor start end
" expr nil t))
+ (setq expr (replace-regexp-in-string "\(r-! " "\(hyrolo-r-not start end
" expr nil t))
+ (setq expr (replace-regexp-in-string "\(r-& " "\(hyrolo-r-and start end
" expr nil t))
+
(setq expr (format "(hyrolo-logic (quote %s) nil %s %s %s)"
expr count-only include-sub-entries
no-sub-entries-out))
(setq total-matches (eval (read expr))))
@@ -150,8 +162,10 @@ Return the number of evaluations of SEXP that match
entries."
(erase-buffer))))
(result
(mapcar
- (lambda (buf)
- (hyrolo-map-logic sexp buf count-only include-sub-entries
+ (lambda (buf-or-file)
+ (setq buf-or-file (or (get-buffer buf-or-file)
+ (funcall hyrolo-find-file-noselect-function
buf-or-file)))
+ (hyrolo-map-logic sexp buf-or-file count-only include-sub-entries
no-sub-entries-out))
(cond ((null in-bufs) hyrolo-file-list)
((listp in-bufs) in-bufs)
@@ -242,114 +256,130 @@ evaluations of SEXP that match entries."
(defun hyrolo-not (start end &rest pat-list)
"Logical <not> rolo entry filter. PAT-LIST is a list of pattern elements.
Each element may be t, nil, or a string."
- (let ((pat))
- (while (and pat-list
- (or (null (setq pat (car pat-list)))
- (and (stringp pat)
- (goto-char start)
- (not (search-forward pat end t)))))
- (setq pat-list (cdr pat-list)))
- (not pat-list)))
-
-(defun hyrolo-or (start end &rest pat-list)
- "Logical <or> rolo entry filter. PAT-LIST is a list of pattern elements.
-Each element may be t, nil, or a string."
- (if (memq t pat-list)
- t
+ (save-restriction
+ (narrow-to-region start end)
(let ((pat))
(while (and pat-list
(or (null (setq pat (car pat-list)))
(and (stringp pat)
(goto-char start)
- (not (search-forward pat end t)))))
+ (not (funcall hyrolo-next-match-function
(regexp-quote pat) nil)))))
(setq pat-list (cdr pat-list)))
- (if pat-list t nil))))
+ (not pat-list))))
+
+(defun hyrolo-or (start end &rest pat-list)
+ "Logical <or> rolo entry filter. PAT-LIST is a list of pattern elements.
+Each element may be t, nil, or a string."
+ (if (memq t pat-list)
+ t
+ (save-restriction
+ (narrow-to-region start end)
+ (let ((pat))
+ (while (and pat-list
+ (or (null (setq pat (car pat-list)))
+ (and (stringp pat)
+ (goto-char start)
+ (not (funcall hyrolo-next-match-function
(regexp-quote pat) nil)))))
+ (setq pat-list (cdr pat-list)))
+ (if pat-list t nil)))))
(defun hyrolo-xor (start end &rest pat-list)
"Logical <xor> rolo entry filter. PAT-LIST is a list of pattern elements.
Each element may be t, nil, or a string."
- (let ((pat)
- (matches 0))
- (while (and pat-list
- (or (not (setq pat (car pat-list)))
- (and (or (eq pat t)
- (not (goto-char start))
- (search-forward pat end t))
- (setq matches (1+ matches)))
- t)
- (< matches 2))
- (setq pat-list (cdr pat-list)))
- (= matches 1)))
+ (save-restriction
+ (narrow-to-region start end)
+ (let ((pat)
+ (matches 0))
+ (while (and pat-list
+ (or (not (setq pat (car pat-list)))
+ (and (or (eq pat t)
+ (not (goto-char start))
+ (funcall hyrolo-next-match-function
(regexp-quote pat) nil))
+ (setq matches (1+ matches)))
+ t)
+ (< matches 2))
+ (setq pat-list (cdr pat-list)))
+ (= matches 1))))
(defun hyrolo-and (start end &rest pat-list)
"Logical <and> rolo entry filter. PAT-LIST is a list of pattern elements.
Each element may be t, nil, or a string."
(unless (memq nil pat-list)
- (let ((pat))
- (while (and pat-list
- (setq pat (car pat-list))
- (or (eq pat t)
- (not (goto-char start))
- (search-forward pat end t)))
- (setq pat-list (cdr pat-list)))
- (not pat-list))))
+ (save-restriction
+ (narrow-to-region start end)
+ (let ((pat))
+ (while (and pat-list
+ (setq pat (car pat-list))
+ (or (eq pat t)
+ (not (goto-char start))
+ (funcall hyrolo-next-match-function (regexp-quote pat)
nil)))
+ (setq pat-list (cdr pat-list)))
+ (not pat-list)))))
;; Work with regular expression patterns rather than strings
(defun hyrolo-r-not (start end &rest pat-list)
"Logical <not> rolo entry filter. PAT-LIST is a list of pattern elements.
Each element may be t, nil, or a regular expression."
- (let ((pat))
- (while (and pat-list
- (or (null (setq pat (car pat-list)))
- (and (stringp pat)
- (goto-char start)
- (not (re-search-forward pat end t)))))
- (setq pat-list (cdr pat-list)))
- (not pat-list)))
-
-(defun hyrolo-r-or (start end &rest pat-list)
- "Logical <or> rolo entry filter. PAT-LIST is a list of pattern elements.
-Each element may be t, nil, or a regular expression."
- (if (memq t pat-list)
- t
+ (save-restriction
+ (narrow-to-region start end)
(let ((pat))
(while (and pat-list
(or (null (setq pat (car pat-list)))
(and (stringp pat)
(goto-char start)
- (not (re-search-forward pat end t)))))
+ (not (funcall hyrolo-next-match-function pat nil)))))
(setq pat-list (cdr pat-list)))
- (if pat-list t nil))))
+ (not pat-list))))
+
+(defun hyrolo-r-or (start end &rest pat-list)
+ "Logical <or> rolo entry filter. PAT-LIST is a list of pattern elements.
+Each element may be t, nil, or a regular expression."
+ (if (memq t pat-list)
+ t
+ (save-restriction
+ (narrow-to-region start end)
+ (let ((pat))
+ (while (and pat-list
+ (or (null (setq pat (car pat-list)))
+ (and (stringp pat)
+ (goto-char start)
+ (not (funcall hyrolo-next-match-function pat
nil)))))
+ (setq pat-list (cdr pat-list)))
+ (if pat-list t nil)))))
(defun hyrolo-r-xor (start end &rest pat-list)
"Logical <xor> rolo entry filter. PAT-LIST is a list of pattern elements.
Each element may be t, nil, or a regular expression."
- (let ((pat)
- (matches 0))
- (while (and pat-list
- (or (not (setq pat (car pat-list)))
- (and (or (eq pat t)
- (not (goto-char start))
- (re-search-forward pat end t))
- (setq matches (1+ matches)))
- t)
- (< matches 2))
- (setq pat-list (cdr pat-list)))
- (= matches 1)))
+ (save-restriction
+ (narrow-to-region start end)
+ (let ((pat)
+ (matches 0))
+ (while (and pat-list
+ (or (not (setq pat (car pat-list)))
+ (and (or (eq pat t)
+ (not (goto-char start))
+ (funcall hyrolo-next-match-function pat nil))
+ (setq matches (1+ matches)))
+ t)
+ (< matches 2))
+ (setq pat-list (cdr pat-list)))
+ (= matches 1))))
(defun hyrolo-r-and (start end &rest pat-list)
"Logical <and> rolo entry filter. PAT-LIST is a list of pattern elements.
Each element may be t, nil, or a regular expression."
(unless (memq nil pat-list)
- (let ((pat))
- (while (and pat-list
- (setq pat (car pat-list))
- (or (eq pat t)
- (not (goto-char start))
- (re-search-forward pat end t)))
- (setq pat-list (cdr pat-list)))
- (not pat-list))))
+ (save-restriction
+ (narrow-to-region start end)
+ (let ((pat))
+ (while (and pat-list
+ (setq pat (car pat-list))
+ (or (eq pat t)
+ (not (goto-char start))
+ (funcall hyrolo-next-match-function pat nil)))
+ (setq pat-list (cdr pat-list)))
+ (not pat-list)))))
(provide 'hyrolo-logic)
diff --git a/hyrolo.el b/hyrolo.el
index 4d252265b6..6b20059acc 100644
--- a/hyrolo.el
+++ b/hyrolo.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 7-Jun-89 at 22:08:29
-;; Last-Mod: 3-Oct-22 at 22:59:30 by Mats Lidell
+;; Last-Mod: 6-Oct-22 at 23:16:06 by Bob Weiner
;;
;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -94,6 +94,13 @@ executable must be found as well (for Oauth security)."
:type 'boolean
:group 'hyperbole-rolo)
+(defvar hyrolo-next-match-function #'hyrolo-next-regexp-match
+ "Value is the function to find next match within a HyRolo file.
+Must take two arguments, `match-pattern' and `headline-only-flag'.
+Must leave point within any matched entry or return nil when no
+match is found.")
+
+
;;; ************************************************************************
;;; Public declarations
;;; ************************************************************************
@@ -291,6 +298,9 @@ entry which begins with the parent string."
(save-excursion
(re-search-forward
hyrolo-entry-name-regexp nil t)
(point))))
+ (when (and (eq major-mode #'markdown-mode)
+ (string-match "\\`.*#+" entry-spc))
+ (setq entry-spc (substring entry-spc (length (match-string 0
entry-spc)))))
(cond ((string-lessp entry name)
(hyrolo-to-entry-end t entry-level-len))
((string-lessp name entry)
@@ -415,14 +425,16 @@ Return entry name if found, else nil."
(error "(hyrolo-edit-entry): Move to an entry to edit it"))))
;;;###autoload
-(defun hyrolo-fgrep (string &optional max-matches hyrolo-file count-only
no-display)
+(defun hyrolo-fgrep (string &optional max-matches hyrolo-file count-only
headline-only no-display)
"Display rolo entries matching STRING or a logical match expression.
Return count of matches.
+
To a maximum of optional prefix arg MAX-MATCHES, in file(s) from optional
HYROLO-FILE or `hyrolo-file-list'. Default is to find all matching entries.
Each entry is displayed with all of its sub-entries. Optional COUNT-ONLY
-non-nil means don't retrieve and don't display matching entries. Optional
-NO-DISPLAY non-nil means retrieve entries but don't display.
+non-nil skips retrieval of matching entries. Optional HEADLINE-ONLY searches
+only the first line of entries, not the full text. Optional NO-DISPLAY non-nil
+retrieves entries but does not display them.
Nil value of MAX-MATCHES means find all matches, t value means find all
matches but omit file headers, negative values mean find up to the inverse of
@@ -442,7 +454,7 @@ the logical sexpression matching."
(when (zerop (setq total-matches (hyrolo-fgrep-logical string
count-only nil t)))
(hyrolo-fgrep-logical string count-only t t)))
(setq total-matches (hyrolo-grep (regexp-quote string) max-matches
- hyrolo-file count-only no-display)))
+ hyrolo-file count-only headline-only
no-display)))
(if (called-interactively-p 'interactive)
(message "%s matching entr%s found in rolo."
(if (= total-matches 0) "No" total-matches)
@@ -485,14 +497,16 @@ If ARG is zero, move to the beginning of the current
line."
(forward-visible-line arg))
;;;###autoload
-(defun hyrolo-grep (regexp &optional max-matches hyrolo-file-or-bufs
count-only no-display)
+(defun hyrolo-grep (regexp &optional max-matches hyrolo-file-or-bufs
count-only headline-only no-display)
"Display rolo entries matching REGEXP and return count of matches.
To a maximum of prefix arg MAX-MATCHES, in buffer(s) from
optional HYROLO-FILE-OR-BUFS or hyrolo-file-list. Default is to
find all matching entries. Each entry is displayed with all of
its sub-entries. Optional COUNT-ONLY non-nil means don't
-retrieve and don't display matching entries. Optional NO-DISPLAY
-non-nil means retrieve entries but don't display.
+retrieve and don't display matching entries. Optional
+HEADLINE-ONLY searches only the first line of entries, not the
+full text. Optional NO-DISPLAY non-nil retrieves entries but
+does not display.
Nil value of MAX-MATCHES means find all matches, t value means find all matches
but omit file headers, negative values mean find up to the inverse of that
@@ -520,7 +534,8 @@ Return number of entries matched. See also documentation
for the variable
hyrolo-buf)
(unless count-only
(setq buffer-read-only nil)
- (or inserting (erase-buffer)))
+ (unless inserting
+ (erase-buffer)))
(while (and (setq file (car hyrolo-file-list))
(or (not (integerp max-matches))
(< total-matches (max max-matches (- max-matches)))))
@@ -535,7 +550,7 @@ Return number of entries matched. See also documentation
for the variable
((and (hyrolo-google-contacts-p) (equal file
google-contacts-buffer-name))
(hyrolo-retrieve-google-contacts (regexp-quote
regexp))
(hyrolo-google-contacts-grep-file file regexp
max-matches count-only))
- (t (hyrolo-grep-file file regexp max-matches
count-only)))
+ (t (hyrolo-grep-file file regexp max-matches
count-only headline-only)))
total-matches (+ total-matches num-matched))
(when (integerp max-matches)
(setq max-matches
@@ -607,12 +622,16 @@ expression rather than string."
(hyrolo-isearch-for-regexp hyrolo-match-regexp t)))
(defun hyrolo-verify ()
- "Verify point is in a rolo match buffer."
+ "Verify point is in a HyRolo or HyNote match buffer."
(when (not (member (buffer-name) (list hyrolo-display-buffer
(and (car hyrolo-file-list)
- (file-name-nondirectory (car
hyrolo-file-list))))))
- (error "(HyRolo): Use this command in the %s match buffer"
- hyrolo-display-buffer)))
+ (file-name-nondirectory (car
hyrolo-file-list)))
+ (when (boundp 'hynote-display-buffer)
+ hynote-display-buffer)
+ (when (boundp 'hynote-file-list)
+ (and (car hynote-file-list)
+ (file-name-nondirectory (car
hynote-file-list)))))))
+ (error "(HyRolo): Use this command in HyRolo/HyNote match buffers or
primary file buffers")))
;;;###autoload
(defun hyrolo-kill (name &optional file)
@@ -905,13 +924,14 @@ matched entries."
(widen)))
;;;###autoload
-(defun hyrolo-word (string &optional max-matches hyrolo-file count-only
no-display)
+(defun hyrolo-word (string &optional max-matches hyrolo-file count-only
headline-only no-display)
"Display rolo entries with whole word match for STRING.
To a maximum of optional prefix arg MAX-MATCHES, in file(s) from optional
HYROLO-FILE or hyrolo-file-list. Default is to find all matching entries.
Each
-entry is displayed with all of its sub-entries. Optional COUNT-ONLY non-nil
-means don't retrieve and don't display matching entries. Optional NO-DISPLAY
-non-nil means retrieve entries but don't display.
+entry is displayed with all of its sub-entries. Optional COUNT-ONLY
+non-nil skips retrieval of matching entries. Optional HEADLINE-ONLY searches
+only the first line of entries, not the full text. Optional NO-DISPLAY non-nil
+retrieves entries but does not display them.
Nil value of MAX-MATCHES means find all matches, t value means find all matches
but omit file headers, negative values mean find up to the inverse of that
@@ -922,7 +942,7 @@ hyrolo-file-list."
(interactive "sFind rolo whole word matches of: \nP")
(let ((total-matches (hyrolo-grep (format "\\b%s\\b" (regexp-quote string))
max-matches
- hyrolo-file count-only no-display)))
+ hyrolo-file count-only headline-only
no-display)))
(when (called-interactively-p 'interactive)
(message "%s matching entr%s found in the rolo."
(if (= total-matches 0) "No" total-matches)
@@ -1279,34 +1299,50 @@ returned to the number given."
"String/logical HyRolo search over files matching FILE-REGEXP in rest of
DIRS."
(hyrolo-search-directories #'hyrolo-fgrep file-regexp dirs))
-(defun hyrolo-fgrep-file (hyrolo-file-or-buf string &optional max-matches
count-only)
+(defun hyrolo-fgrep-file (hyrolo-file-or-buf string &optional max-matches
count-only headline-only)
"Retrieve entries in HYROLO-FILE-OR-BUF matching STRING.
Retrieve a maximum of optional MAX-MATCHES.
-Nil value of MAX-MATCHES means find all matches, t value means find all matches
-but omit file headers, negative values mean find up to the inverse of that
-number of entries and omit file headers. Optional COUNT-ONLY non-nil
-means don't retrieve matching entries.
+
+Nil value of MAX-MATCHES means find all matches, t value means
+find all matches but omit file headers, negative values mean find
+up to the inverse of that number of entries and omit file
+headers. Optional COUNT-ONLY non-nil omits matching entry
+display. Optional HEADLINE-ONLY non-nil searches headlines
+only (first line of entries), rather than entire entries.
Return number of matching entries found."
- (hyrolo-grep-file hyrolo-file-or-buf (regexp-quote string) max-matches
count-only))
+ (hyrolo-grep-file hyrolo-file-or-buf (regexp-quote string) max-matches
count-only headline-only))
;;;###autoload
(defun hyrolo-grep-directories (file-regexp &rest dirs)
"Regexp HyRolo search over files matching FILE-REGEXP in rest of DIRS."
(hyrolo-search-directories #'hyrolo-grep file-regexp dirs))
-(defun hyrolo-grep-file (hyrolo-file-or-buf regexp &optional max-matches
count-only)
+(defun hyrolo-next-regexp-match (regexp headline-only)
+ "In a HyRolo source buffer, move past the next occurrence of REGEXP or
return nil."
+ (re-search-forward regexp
+ (when headline-only
+ (save-excursion (end-of-visible-line) (point)))
+ t))
+
+(defun hyrolo-grep-file (hyrolo-file-or-buf pattern &optional max-matches
count-only headline-only)
"Retrieve entries in HYROLO-FILE-OR-BUF matching REGEXP.
-Retrieve a maximum of optional MAX-MATCHES.
-Nil value of MAX-MATCHES means find all matches, t value means find all matches
-but omit file headers, negative values mean find up to the inverse of that
-number of entries and omit file headers. Optional COUNT-ONLY non-nil
-means don't retrieve matching entries.
+PATTERN is searched for using the function given by
+`hyrolo-next-match-function', so it can be a text property for
+example, rather than just a regexp matching buffer text.
+
+Retrieve a maximum of optional MAX-MATCHES. Nil value of
+MAX-MATCHES means find all matches, t value means find all
+matches but omit file headers, negative values mean find up to
+the inverse of that number of entries and omit file headers.
+Optional COUNT-ONLY non-nil skips display of matching entries.
+Optional HEADLINE-ONLY non-nil searches only the first line of
+entries, rather than the full text.
Return number of matching entries found."
;;
- ;; Save regexp as last rolo search expression.
- (setq hyrolo-match-regexp regexp)
+ ;; Save pattern as last rolo search expression.
+ (setq hyrolo-match-regexp pattern)
;;
(let ((new-buf-p) (actual-buf)
;; Disable magit-auto-revert-mode-enable-in-buffers for hyrolo
@@ -1341,7 +1377,7 @@ Return number of matching entries found."
(let (case-fold-search)
(re-search-forward hyrolo-entry-regexp nil t)
(while (and (or (null max-matches) (< num-found max-matches))
- (re-search-forward regexp nil t))
+ (funcall hyrolo-next-match-function pattern
headline-only))
(re-search-backward hyrolo-entry-regexp nil t)
(setq start (point)
next-entry-exists nil)
@@ -1370,7 +1406,7 @@ Return number of matching entries found."
(set-buffer actual-buf))))
(setq num-found (1+ num-found))
(or count-only
- (hyrolo-add-match hyrolo-display-buffer regexp start
(point)))))))
+ (hyrolo-add-match hyrolo-display-buffer pattern start
(point)))))))
(hyrolo-kill-buffer actual-buf)
num-found)
0)))
@@ -1781,7 +1817,7 @@ Calls the functions given by `hyrolo-mode-hook'.
;;; ************************************************************************
(define-obsolete-variable-alias 'rolo-display-buffer 'hyrolo-display-buffer
"06.00")
-(defvar hyrolo-display-buffer "*Hyperbole Rolo*"
+(defvar hyrolo-display-buffer "*HyRolo*"
"Buffer used to display set of last matching rolo entries.")
(defvar hyrolo-entry-group-number 1
@@ -1799,6 +1835,18 @@ This pattern must match the beginning of a line.
hierarchy. `hyrolo-entry-trailing-space-group-number' must capture
the whitespace following the entry hierarchy level.")
+;; Support hyrolo searches in markdown files
+(add-hook 'markdown-mode-hook
+ (lambda ()
+ (make-local-variable 'hyrolo-entry-regexp)
+ (make-local-variable 'hyrolo-entry-group-number)
+ (make-local-variable 'hyrolo-entry-trailing-space-group-number)
+ (setq hyrolo-entry-regexp markdown-regex-header
+ hyrolo-entry-group-number 4
+ ;; `hyrolo-add' handles removing # prefix from
+ ;; trailing-space grouping below
+ hyrolo-entry-trailing-space-group-number 4)))
+
(defconst hyrolo-hdr-format
(concat
"======================================================================\n"
diff --git a/kotl/kcell.el b/kotl/kcell.el
index d826ee0b00..0a84ff4e5b 100644
--- a/kotl/kcell.el
+++ b/kotl/kcell.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 1-May-93
-;; Last-Mod: 15-Jul-22 at 23:24:10 by Mats Lidell
+;; Last-Mod: 1-Oct-22 at 15:11:43 by Bob Weiner
;;
;; Copyright (C) 1993-2022 Free Software Foundation, Inc.
;; See the "../HY-COPY" file for license information.
@@ -16,6 +16,10 @@
;; along with a persistent representation called kcell-data for writing to
;; files. Node text content is stored separately in the kview for
efficiency.
;;
+;; To obtain the kcell at a point in the buffer, use `kcell-view:cell'.
+;; To move point to a specific cell given a reference string, use
+;; `kotl-mode:goto-cell' or `kview:goto-cell-id'.
+;;
;; For compatibility between kcell and kcell-data representations,
;; the unique per Koutline permanent idstamp for each kcell is also stored
;; separately. This also allows fast retrieval.
@@ -70,7 +74,28 @@ idstamp-counter."
"Is OBJECT a kcell?"
(and (listp object) (plist-get object 'creator)))
-(defalias 'kcell:plist 'identity)
+;;;###autoload
+(defun kcell:parse-cell-ref (cell-ref)
+ "Parse CELL-REF string and return list of strings (<cell-id> <viewspec>).
+If any item in the list is missing, it is nil."
+ (let (cell-id
+ kvspec)
+ ;; !! Todo: Remove any relative specs and view specs from
+ ;; cell-ref to form cell-id. Really should account for Augment-style
+ ;; relative specs here, but we don't yet support them.
+ (if (and (stringp cell-ref)
+ (string-match "\\(\\.[a-zA-Z]+\\)?\\([|:][^|: \t\n\r\f]
*\\)\\|\\.[a-zA-Z]+"
+ cell-ref))
+ (setq cell-id (substring cell-ref 0 (match-beginning 0))
+ kvspec (when (match-beginning 2)
+ (match-string 2 cell-ref)))
+ (setq cell-id cell-ref
+ kvspec nil))
+ (list cell-id kvspec)))
+
+(defun kcell:plist (kcell)
+ "Return the property list of KCELL."
+ (identity kcell))
;;;###autoload
(defun kcell:ref-to-id (cell-ref &optional kviewspec-flag)
@@ -95,8 +120,8 @@ or any of the following string forms:
:viewspec - an augment viewspec, ignored for now.
Optionally, any of these id forms (or the relative form) may be followed by
-zero or more whitespace characters, a | and some view specification
-characters.
+zero or more whitespace characters and optionally a comma, followed by
+the '|' character and some view specification characters.
Augment capabilities not yet implemented and ignored for now:
1. Augment viewspec characters preceded by a colon
@@ -110,7 +135,8 @@ Augment capabilities not yet implemented and ignored for
now:
((stringp cell-ref)
(let (kviewspec
idstamp-string)
- (setq cell-ref (replace-regexp-in-string "\\s-+" "" cell-ref nil
t))
+ ;; Remove whitespace and any comma
+ (setq cell-ref (replace-regexp-in-string "\\s-*,?\\s-*" ""
cell-ref nil t))
(if (string-equal cell-ref "0")
"0"
;; Ignore Augment :viewspec.
diff --git a/kotl/klink.el b/kotl/klink.el
index f716d39989..2e5a3b028c 100644
--- a/kotl/klink.el
+++ b/kotl/klink.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 15-Nov-93 at 12:15:16
-;; Last-Mod: 29-Aug-22 at 01:12:26 by Bob Weiner
+;; Last-Mod: 18-Sep-22 at 09:55:49 by Bob Weiner
;;
;; Copyright (C) 1993-2022 Free Software Foundation, Inc.
;; See the "../HY-COPY" file for license information.
@@ -349,7 +349,9 @@ Assume point is in klink referent buffer, where the klink
points."
;;; ************************************************************************
(defvar klink:cell-ref-regexp
- "[|:0-9a-zA-Z][|:.*~=0-9a-zA-Z \t\n\r]*"
+ (concat "[0-9a-zA-Z][.*~=0-9a-zA-Z \t\n\r]*\\s-*,\\s-*"
+ "[|:.*~=0-9a-zA-Z \t\n\r]+"
+ "\\|[|: 0-9a-zA-Z][|:.*~=0-9a-zA-Z \t\n\r]*")
"Regexp matching a cell reference including relative and view specs.
Contains no groupings.")
diff --git a/kotl/kotl-mode.el b/kotl/kotl-mode.el
index 2005859a73..e2e5520439 100644
--- a/kotl/kotl-mode.el
+++ b/kotl/kotl-mode.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 6/30/93
-;; Last-Mod: 3-Oct-22 at 22:25:42 by Mats Lidell
+;; Last-Mod: 6-Oct-22 at 18:30:31 by Bob Weiner
;;
;; Copyright (C) 1993-2022 Free Software Foundation, Inc.
;; See the "../HY-COPY" file for license information.
@@ -1797,12 +1797,12 @@ part of the paragraph, or the end of the buffer."
(kotl-mode:backward-word (- arg)))
(point))
-(defun kotl-mode:goto-cell (cell-ref &optional error-p)
+(defun kotl-mode:goto-cell (cell-ref &optional error-flag)
"Move point to start of cell given by CELL-REF (see `kcell:ref-to-id').
Return point if CELL-REF is found within current view, else nil.
-(See the doc for `kcell:ref-to-id', for valid formats).
+See the doc for `kcell:ref-to-id', for valid formats.
-With optional second arg ERROR-P non-nil, or if called
+With optional second arg ERROR-FLAG non-nil, or if called
interactively, will signal an error if CELL-REF is not found
within current view.
@@ -1818,35 +1818,23 @@ for CELL-REF."
(or (kcell:ref-to-id cell-ref t)
(error "(kotl-mode:goto-cell): Invalid cell reference, `%s'"
cell-ref)))
(let* ((opoint (point))
- (found)
- cell-id kvspec)
+ (found))
(if (and (stringp cell-ref) (eq ?| (aref cell-ref 0)))
;; This is a standalone view spec, not a cell reference.
(progn (kvspec:activate cell-ref) (setq found (point)))
-
- ;; !! Todo: Remove any relative specs and view specs from
- ;; cell-ref to form cell-id. Really should account for Augment-style
- ;; relative specs here, but we don't yet support them.
- (if (and (stringp cell-ref)
- (string-match "\\(\\.[a-zA-Z]+\\)?\\([|:].*\\)\\|\\.[a-zA-Z]+"
- cell-ref))
- (setq cell-id (substring cell-ref 0 (match-beginning 0))
- kvspec (when (match-beginning 2)
- (match-string 2 cell-ref)))
- (setq cell-id cell-ref kvspec nil))
-
- (goto-char (point-min))
- (when (or (integerp cell-id)
- (eq ?0 (aref cell-id 0)))
- ;; is an idstamp
- (when (kview:goto-cell-id cell-id)
- (setq found (point))))
- (if found
- ;; Activate any viewspec associated with cell-ref.
- (when kvspec (kvspec:activate kvspec))
- (goto-char opoint)
- (when (or error-p (called-interactively-p 'interactive))
- (error "(kotl-mode:goto-cell): No `%s' cell in this view" cell-ref))))
+ (cl-destructuring-bind (cell-id kvspec) (kcell:parse-cell-ref cell-ref)
+ (goto-char (point-min))
+ (when (or (integerp cell-id)
+ (eq ?0 (aref cell-id 0)))
+ ;; Is an idstamp
+ (when (kview:goto-cell-id cell-id)
+ (setq found (point))))
+ (if found
+ ;; Activate any viewspec associated with cell-ref.
+ (when kvspec (kvspec:activate kvspec))
+ (goto-char opoint)
+ (when (or error-flag (called-interactively-p 'interactive))
+ (error "(kotl-mode:goto-cell): No `%s' cell in this view"
cell-ref)))))
found))
(defun kotl-mode:head-cell ()
diff --git a/test/demo-tests.el b/test/demo-tests.el
index 5c8d87219b..b63bd151e0 100644
--- a/test/demo-tests.el
+++ b/test/demo-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 30-Jan-21 at 12:00:00
-;; Last-Mod: 24-Jul-22 at 09:18:04 by Bob Weiner
+;; Last-Mod: 24-Sep-22 at 12:40:19 by Bob Weiner
;;
;; Copyright (C) 2021 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -23,6 +23,7 @@
(require 'hload-path)
(require 'hypb)
(require 'hib-social)
+(require 'hyrolo)
(require 'eww)
(require 'compile)
(require 'el-mock)
@@ -120,7 +121,7 @@
(should (get-buffer help-buffer))
(hy-test-helpers:kill-buffer help-buffer)))))
-;; Hy-control
+;; HyControl
(ert-deftest demo-window-grid-22-test ()
(skip-unless (not noninteractive))
(unwind-protect
@@ -141,15 +142,15 @@
(should (eq 9 (length (window-list)))))
(hy-test-helpers:kill-buffer "DEMO")))
-;; Hy-rolo
-(ert-deftest demo-hy-rolo-test ()
+;; HyRolo
+(ert-deftest demo-hyrolo-test ()
(skip-unless (not noninteractive))
(unwind-protect
(with-temp-buffer
(load (expand-file-name "hyrolo-demo.el" hyperb:dir))
(should (hact 'kbd-key "C-x 4 r work RET"))
(hy-test-helpers:consume-input-events)
- (should (string= "*Hyperbole Rolo*" (buffer-name)))
+ (should (string= (buffer-name) hyrolo-display-buffer))
(should (search-forward "Dunn, John")))
(hyrolo-demo-quit)))
diff --git a/test/hibtypes-tests.el b/test/hibtypes-tests.el
index 8e5899c248..75fd0da7ad 100644
--- a/test/hibtypes-tests.el
+++ b/test/hibtypes-tests.el
@@ -146,17 +146,6 @@
(hy-test-helpers:should-last-message "Loading")
(hy-test-helpers:should-last-message "hy-test-dependencies.el")))
-(ert-deftest ibtypes::pathname-directory-test ()
- "Pathname with directory opens dired."
- (unwind-protect
- (with-temp-buffer
- (insert "\"/tmp\"")
- (goto-char 2)
- (ibtypes::pathname)
- (should (string= "tmp" (buffer-name)))
- (should (eq major-mode 'dired-mode)))
- (kill-buffer "tmp")))
-
(ert-deftest ibtypes::pathname-dot-slash-in-other-folder-test ()
"Invalid pathname that starts with ./ triggers an error when resolved."
(with-temp-buffer
@@ -180,22 +169,23 @@
(set-buffer help-buffer)
(should (string-match "actype:.*link-to-file" (buffer-string))))))
-(ert-deftest ibtypes::pathname-path-variable-test ()
- "Goto file at point in path variable."
- (unwind-protect
- (with-temp-buffer
- (insert "\"/var/lib:/bar:/tmp:/foo\"")
- (goto-char 16)
- (ibtypes::pathname)
- ;; (when (car (hattr:get 'hbut:current 'args))
- ;; (set-buffer (find-file-noselect (car (hattr:get 'hbut:current
'args)))))
- (should (string= "tmp" (buffer-name)))
- (should (eq major-mode 'dired-mode)))
- (when (and (get-buffer "tmp")
- (buffer-live-p (get-buffer "tmp")))
- (kill-buffer (get-buffer "tmp")))))
-
-;; Function in buffer XEmac functionality. Is there somethign similar in Emacs?
+(ert-deftest ibtypes::pathname-directory-test ()
+ "Goto directory at point in path variable and open Dired."
+ (let (visited-buf)
+ (unwind-protect
+ (with-temp-buffer
+ (insert "\"/var/lib:/bar:/tmp:/foo\"")
+ (goto-char 16)
+ (ibtypes::pathname)
+ (setq visited-buf (current-buffer))
+ (should (string-prefix-p "tmp" (buffer-name)))
+ (should (eq major-mode 'dired-mode)))
+ (when (and visited-buf
+ (buffer-live-p visited-buf))
+ (kill-buffer visited-buf)))))
+
+;; !! Todo: XEmacs has a library to jump to a function definition in the
current buffer.
+;; What is the equivalent GNU Emacs one?
;; ibtypes::annot-bib
(ert-deftest ibtypes::annot-bib-test ()
diff --git a/test/hui-register-tests.el b/test/hui-register-tests.el
index a688571e0a..ac576cc70f 100644
--- a/test/hui-register-tests.el
+++ b/test/hui-register-tests.el
@@ -92,7 +92,7 @@
(should (ebut:at-p))
(action-key)
(should (equal major-mode 'dired-mode))
- (should (equal default-directory "/tmp/"))))
+ (should (member default-directory '("/tmp/" "/private/tmp/")))))
(delete-file file1)
(delete-file file2))))
diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el
index 7f532feb18..1e77e1018d 100644
--- a/test/hyrolo-tests.el
+++ b/test/hyrolo-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 19-Jun-21 at 22:42:00
-;; Last-Mod: 29-Aug-22 at 02:05:34 by Bob Weiner
+;; Last-Mod: 24-Sep-22 at 12:27:35 by Bob Weiner
;;
;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -49,7 +49,7 @@
(load "../hyrolo-demo")
(should (hact 'kbd-key "C-x 4r work RET"))
(hy-test-helpers:consume-input-events)
- (should (string= (buffer-name) "*Hyperbole Rolo*"))
+ (should (string= (buffer-name) hyrolo-display-buffer))
(should (looking-at "======"))
(forward-line 5)
(should (looking-at "\\*.*Work")))
@@ -63,7 +63,7 @@
(load "../hyrolo-demo")
(should (hact 'kbd-key "C-x 4r work RET TAB"))
(hy-test-helpers:consume-input-events)
- (should (string= (buffer-name) "*Hyperbole Rolo*"))
+ (should (string= (buffer-name) hyrolo-display-buffer))
(should (looking-at "Work")))
(hyrolo-demo-quit)))
@@ -75,7 +75,7 @@
(load "../hyrolo-demo")
(should (hact 'kbd-key "C-x 4r work RET TAB"))
(hy-test-helpers:consume-input-events)
- (should (string= (buffer-name) "*Hyperbole Rolo*"))
+ (should (string= (buffer-name) hyrolo-display-buffer))
(should (looking-at "Work"))
(should (hact 'kbd-key "h"))
@@ -101,7 +101,7 @@
(load "../hyrolo-demo")
(should (hact 'kbd-key "C-x 4r work RET TAB"))
(hy-test-helpers:consume-input-events)
- (should (string= (buffer-name) "*Hyperbole Rolo*"))
+ (should (string= (buffer-name) hyrolo-display-buffer))
(should (looking-at "work"))
(should (hact 'kbd-key "o"))
@@ -127,7 +127,7 @@
(load "../hyrolo-demo")
(should (hact 'kbd-key "C-x 4r work RET TAB"))
(hy-test-helpers:consume-input-events)
- (should (string= (buffer-name) "*Hyperbole Rolo*"))
+ (should (string= (buffer-name) hyrolo-display-buffer))
(should (looking-at "Work"))
(should (hact 'kbd-key ">"))
@@ -152,7 +152,7 @@ and {b} the previous same level cell."
(load "../hyrolo-demo")
(should (hact 'kbd-key "C-x 4r com RET TAB"))
(hy-test-helpers:consume-input-events)
- (should (string= (buffer-name) "*Hyperbole Rolo*"))
+ (should (string= (buffer-name) hyrolo-display-buffer))
(should (hact 'kbd-key "<"))
(should (equal (point) (point-min)))
@@ -176,7 +176,7 @@ and {b} the previous same level cell."
(should (hact 'kbd-key "C-x 4r com RET TAB"))
(hy-test-helpers:consume-input-events)
- (should (string= (buffer-name) "*Hyperbole Rolo*"))
+ (should (string= (buffer-name) hyrolo-display-buffer))
(should (hact 'kbd-key "<"))
(should (equal (point) (point-min)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/hyperbole 5df7e8802b: Initial HyRolo updates to support forthcoming note taking subsystem,
ELPA Syncer <=