3
3
; ; Author: Bob Weiner
4
4
; ;
5
5
; ; Orig-Date: 21-Apr-24 at 22:41:13
6
- ; ; Last-Mod: 27-Dec-24 at 11:10:28 by Bob Weiner
6
+ ; ; Last-Mod: 27-Dec-24 at 12:44:20 by Bob Weiner
7
7
; ;
8
8
; ; SPDX-License-Identifier: GPL-3.0-or-later
9
9
; ;
@@ -786,12 +786,12 @@ Use `hywiki-get-referent' to determine whether WIKIWORD exists prior to
786
786
calling this function."
787
787
(interactive (list (or (hywiki-word-at)
788
788
(hywiki-word-read-new " Add/Edit HyWikiWord: " ))))
789
- (require 'activities )
789
+ (hypb: require-package 'activities )
790
790
(let ((activity (activities-completing-read :prompt " Resume activity" :default nil )))
791
791
(hywiki-add-referent wikiword (cons 'activity activity))))
792
792
793
- (defun hywiki-display-activity (_wikiword referent )
794
- (activities-resume ( cdr referent) :resetp nil ))
793
+ (defun hywiki-display-activity (_wikiword activity )
794
+ (activities-resume activity :resetp nil ))
795
795
796
796
(defun hywiki-add-bookmark (wikiword )
797
797
" Make WIKIWORD display a bookmark and return the action.
@@ -812,9 +812,8 @@ calling this function."
812
812
(error " (hywiki-add-bookmark): No bookmark specified " )
813
813
(hywiki-add-referent wikiword (cons 'bookmark bookmark)))))
814
814
815
- (defun hywiki-display-bookmark (_wikiword referent )
816
- (let* ((bookmark (cdr referent))
817
- (loc (bookmark-location bookmark)))
815
+ (defun hywiki-display-bookmark (_wikiword bookmark )
816
+ (let ((loc (bookmark-location bookmark)))
818
817
; ; Use Hyperbole-specified display location
819
818
(cond ((bufferp loc)
820
819
(hpath:display-buffer loc))
@@ -842,11 +841,10 @@ calling this function."
842
841
(let ((command (hui:actype nil (format " Command for %s : " wikiword))))
843
842
(hywiki-add-referent wikiword (cons 'command command))))
844
843
845
- (defun hywiki-display-command (wikiword referent )
846
- (let ((command (cdr referent)))
847
- (if (fboundp command)
848
- (actype:act command wikiword)
849
- (error " (hywiki-display-command): Unbound referent command, '%s ' " command))))
844
+ (defun hywiki-display-command (wikiword command )
845
+ (if (fboundp command)
846
+ (actype:act command wikiword)
847
+ (error " (hywiki-display-command): Unbound referent command, '%s ' " command)))
850
848
851
849
(defun hywiki-add-find (wikiword )
852
850
" Make WIKIWORD grep across `hywiki-directory' for matches to itself.
@@ -863,11 +861,10 @@ calling this function."
863
861
(hywiki-word-read-new " Add/Edit HyWikiWord: " ))))
864
862
(hywiki-add-referent wikiword (cons 'find #'hywiki-word-grep )))
865
863
866
- (defun hywiki-display-find (wikiword referent )
867
- (let ((func (cdr referent)))
868
- (if (fboundp func)
869
- (actype:act func wikiword)
870
- (error " (hywiki-display-find): Unbound referent function, '%s ' " func))))
864
+ (defun hywiki-display-find (wikiword func )
865
+ (if (fboundp func)
866
+ (actype:act func wikiword)
867
+ (error " (hywiki-display-find): Unbound referent function, '%s ' " func)))
871
868
872
869
(defun hywiki-add-global-button (wikiword )
873
870
" Make WIKIWORD evaluate a prompted for global button.
@@ -886,8 +883,8 @@ calling this function."
886
883
nil t nil 'gbut )))
887
884
(hywiki-add-referent wikiword (cons 'global-button gbut-name))))
888
885
889
- (defun hywiki-display-global-button (_wikiword referent )
890
- (gbut:act ( cdr referent) ))
886
+ (defun hywiki-display-global-button (_wikiword gbut-name )
887
+ (gbut:act gbut-name ))
891
888
892
889
(defun hywiki-add-hyrolo (wikiword )
893
890
" Make WIKIWORD search and display `hyrolo-file-list' matches.
@@ -905,8 +902,8 @@ calling this function."
905
902
; ; !! TODO: Change PaulAllenWinter to search for "Winter, Paul Allen".
906
903
(hywiki-add-referent wikiword (cons 'hyrolo #'hyrolo-fgrep )))
907
904
908
- (defun hywiki-display-hyrolo (wikiword referent )
909
- (funcall ( cdr referent) wikiword))
905
+ (defun hywiki-display-hyrolo (wikiword search-func )
906
+ (funcall search-func wikiword))
910
907
911
908
(defun hywiki-add-info-index (wikiword )
912
909
" Make WIKIWORD display an Info manual index item and return it.
@@ -951,8 +948,8 @@ calling this function."
951
948
(setq node (format " (%s )%s " (Info-current-filename-sans-extension) node)))
952
949
(hywiki-add-referent wikiword (cons 'info-node node)))))
953
950
954
- (defun hywiki-display-info-node (_wikiword referent )
955
- (Info-goto-node ( cdr referent) ))
951
+ (defun hywiki-display-info-node (_wikiword node )
952
+ (Info-goto-node node ))
956
953
957
954
(defun hywiki-add-key-series (wikiword )
958
955
" Make WIKIWORD invoke a prompted for key series and return it.
@@ -971,8 +968,8 @@ calling this function."
971
968
(setq key-series (concat " {" (string-trim key-series) " }" )))
972
969
(hywiki-add-referent wikiword (cons 'key-series key-series))))
973
970
974
- (defun hywiki-display-key-series (_wikiword referent )
975
- (hact 'kbd-key ( cdr referent) ))
971
+ (defun hywiki-display-key-series (_wikiword key-series )
972
+ (hact 'kbd-key key-series ))
976
973
977
974
(defun hywiki-add-org-id (wikiword )
978
975
" Make WIKIWORD display an Org file or headline with an Org id.
@@ -1004,8 +1001,8 @@ calling this function."
1004
1001
(setq org-id (org-id-get-create )))
1005
1002
(hywiki-add-referent wikiword (cons 'org-id (concat " ID: " org-id)))))))
1006
1003
1007
- (defun hywiki-display-org-id (_wikiword referent )
1008
- (hact 'link-to-org-id ( cdr referent) ))
1004
+ (defun hywiki-display-org-id (_wikiword org-id )
1005
+ (hact 'link-to-org-id org-id ))
1009
1006
1010
1007
(defun hywiki-add-org-roam-node (wikiword )
1011
1008
" Make WIKIWORD display an Org Roam Node and return the action.
@@ -1019,7 +1016,7 @@ Use `hywiki-get-referent' to determine whether WIKIWORD exists prior to
1019
1016
calling this function."
1020
1017
(interactive (list (or (hywiki-word-at)
1021
1018
(hywiki-word-read-new " Add/Edit HyWikiWord: " ))))
1022
- (require 'org-roam )
1019
+ (hypb: require-package 'org-roam )
1023
1020
(let ((org-roam-node (org-roam-node-read)))
1024
1021
(hywiki-add-referent wikiword (cons 'org-roam-node org-roam-node))))
1025
1022
@@ -1098,12 +1095,11 @@ Use `hywiki-get-referent' to determine whether a HyWiki page exists."
1098
1095
(hywiki-display-page normalized-word)))
1099
1096
(t (user-error " (hywiki-create-page-and-display): Invalid HyWikiWord: '%s'; must be capitalized, all alpha" wikiword)))))
1100
1097
1101
- (defun hywiki-display-page (&optional wikiword referent )
1098
+ (defun hywiki-display-page (&optional wikiword file-name )
1102
1099
" Display an optional WIKIWORD page and return the page file.
1103
1100
Use `hywiki-display-page-function' to display the page.
1104
1101
1105
- If REFERENT is provided, its `cdr' is the page file with any #section
1106
- from the WIKIWORD included.
1102
+ If FILE is provided, it includes any #section from the WIKIWORD.
1107
1103
1108
1104
If WIKIWORD is omitted or nil and `hywiki-display-page-function'
1109
1105
is an interactive function, it is called interactively and prompts for
@@ -1112,15 +1108,10 @@ an existing or new HyWikiWord."
1112
1108
(call-interactively hywiki-display-page-function)
1113
1109
(when (null wikiword)
1114
1110
(setq wikiword (hywiki-word-read-new " Find HyWiki page: " )))
1115
- (let ((file (hywiki-get-file
1116
- (cond ((consp referent)
1117
- (cdr referent))
1118
- ((stringp referent)
1119
- referent)
1120
- (t wikiword)))))
1111
+ (let ((file (hywiki-get-file (or file-name wikiword))))
1121
1112
(funcall hywiki-display-page-function file)
1122
1113
; ; Set 'referent attribute of current implicit button
1123
- (hattr:set 'hbut:current 'referent referent )
1114
+ (hattr:set 'hbut:current 'referent ( cons 'page file) )
1124
1115
file)))
1125
1116
1126
1117
(defun hywiki-add-path-link (wikiword &optional file pos )
@@ -1147,8 +1138,8 @@ calling this function."
1147
1138
(when path-link
1148
1139
(hywiki-add-referent wikiword (cons 'path-link path-link)))))
1149
1140
1150
- (defun hywiki-display-path-link (_wikiword referent )
1151
- (funcall hywiki-display-page-function ( cdr referent) ))
1141
+ (defun hywiki-display-path-link (_wikiword path )
1142
+ (funcall hywiki-display-page-function path ))
1152
1143
1153
1144
(defun hywiki-add-sexpression (wikiword )
1154
1145
" Make WIKIWORD evaluate a prompted for sexpression and return it.
@@ -1165,8 +1156,8 @@ calling this function."
1165
1156
(hywiki-add-referent wikiword (cons 'sexpression
1166
1157
(read--expression " Sexpression: " ))))
1167
1158
1168
- (defun hywiki-display-sexpression (_wikiword referent )
1169
- (eval ( cdr referent) ))
1159
+ (defun hywiki-display-sexpression (_wikiword sexpression )
1160
+ (eval sexpression ))
1170
1161
1171
1162
(defun hywiki-add-to-referent (wikiword text position )
1172
1163
" Display WIKIWORD referent and insert TEXT at POSITION.
@@ -2079,10 +2070,6 @@ regexps of wikiwords, if the hash table is out-of-date."
2079
2070
" Return a list of the HyWiki page names."
2080
2071
(hash-map #'cdr (hywiki-get-referent-hasht)))
2081
2072
2082
- (defun hywiki-get-wikiwords-obarray ()
2083
- " Return an obarray of existing HyWikiWords."
2084
- (cdr (hywiki-get-referent-hasht)))
2085
-
2086
2073
(defun hywiki-get-plural-wikiword (wikiword )
2087
2074
" Return the pluralized version of the given WIKIWORD.
2088
2075
`hywiki-allow-plurals-flag' must be non-nil or nil is always returned."
@@ -2539,21 +2526,21 @@ these are handled by the Org mode link handler."
2539
2526
(eq (string-match (concat " \\ `" hywiki-word-with-optional-section-regexp " \\ '" ) word)
2540
2527
0 )))))
2541
2528
2542
- (defun hywiki-word-read-new (&optional prompt )
2543
- " Prompt with completion for and return a new HyWiki page name."
2544
- (let ((completion-ignore-case t ))
2545
- (completing-read (if (stringp prompt) prompt " HyWikiWord: " )
2546
- (hywiki-get-wikiwords-obarray)
2547
- nil nil nil nil (hywiki-word-at))))
2548
-
2549
2529
(defun hywiki-word-read (&optional prompt )
2550
2530
" Prompt with completion for and return an existing HyWiki page name.
2551
2531
If on a page name, immediately pressing RET will use that name as the default."
2552
2532
(let ((completion-ignore-case t ))
2553
2533
(completing-read (if (stringp prompt) prompt " HyWikiWord: " )
2554
- (hywiki-get-wikiwords-obarray )
2534
+ (hywiki-get-referent-hasht )
2555
2535
nil t nil nil (hywiki-word-at))))
2556
2536
2537
+ (defun hywiki-word-read-new (&optional prompt )
2538
+ " Prompt with completion for and return a new HyWiki page name."
2539
+ (let ((completion-ignore-case t ))
2540
+ (completing-read (if (stringp prompt) prompt " HyWikiWord: " )
2541
+ (hywiki-get-referent-hasht)
2542
+ nil nil nil nil (hywiki-word-at))))
2543
+
2557
2544
(defun hywiki-word-highlight-flag-changed (symbol set-to-value operation _where )
2558
2545
" Watch function for variable ``hywiki-word-highlight-flag' .
2559
2546
Function is called with 4 arguments: (SYMBOL SET-TO-VALUE OPERATION WHERE).
0 commit comments