@@ -34,7 +34,7 @@ Nil disables saving.")
3434 " Maximum length of a hyper-button label." )
3535
3636(defun ebut:act (label )
37- " Activates Hyperbole explicit button with LABEL from the current buffer."
37+ " Activate Hyperbole explicit button with LABEL from the current buffer."
3838 (interactive (list (hargs:read-match " Activate explicit button labeled: "
3939 (ebut:alist)
4040 nil t nil 'ebut )))
@@ -52,7 +52,7 @@ as a completion table."
5252
5353(defun ebut:at-p (&optional start-delim end-delim )
5454 " Return explicit Hyperbole button at point or nil.
55- Assumes point is within first line of button label, if at all.
55+ Assume point is within first line of button label, if at all.
5656Optional START-DELIM and END-DELIM are strings that override default
5757button delimiters."
5858 (let ((key (ebut:label-p nil start-delim end-delim)))
@@ -97,10 +97,10 @@ Return entry deleted (a list of attribute values) or nil."
9797 " Return explicit Hyperbole button symbol given by LBL-KEY and BUFFER.
9898KEY-SRC is given when retrieving global buttons and is the full source pathname.
9999
100- Retrieves button data, converts into a button object and returns a symbol
100+ Retrieve button data, convert into a button object and return a symbol
101101which references the button.
102102
103- All arguments are optional. When none are given, returns a symbol for
103+ All arguments are optional. When none are given, return a symbol for
104104the button that point is within or nil. BUFFER defaults to the current
105105buffer."
106106 (hattr:clear 'hbut:current )
@@ -265,14 +265,14 @@ include delimiters when INCLUDE-DELIMS is non-nil)."
265265 (hbut:map but-func ebut:start ebut:end regexp-match include-delims))
266266
267267(defun ebut:modify (&optional lbl-key but-sym )
268- " Modifies existing Hyperbole button from optional LBL-KEY and BUT-SYM.
268+ " Modify existing Hyperbole button from optional LBL-KEY and BUT-SYM.
269269Defaults are the key for any button label at point and `hbut:current' .
270- If successful, returns button's instance number except when instance
271- number is 1, then returns t. On failure, as when button does not exist,
272- returns nil.
270+ If successful, return button's instance number, except when instance
271+ number is 1, then return t. On failure, as when button does not exist,
272+ return nil.
273273
274- If successful, leaves point in button data buffer, so caller should use
275- `save-excursion' . Does not save button data buffer."
274+ If successful, leave point in button data buffer, so caller should use
275+ `save-excursion' . Do not save button data buffer."
276276 (save-excursion
277277 (let ((lbl-instance (hbdata:write lbl-key but-sym)))
278278 (run-hooks 'ebut-modify-hook )
@@ -302,7 +302,7 @@ If CURR-LABEL is nil, the text in the active region is used as the
302302button label, if any, otherwise, an error is signaled.
303303
304304Return instance string appended to label to form a per-buffer unique
305- label; nil if label is already unique. Signals an error when no such
305+ label; nil if label is already unique. Signal an error when no such
306306button is found in the current buffer."
307307 (let* ((lbl-key (ebut:label-to-key curr-label))
308308 (lbl-regexp (ebut:label-regexp lbl-key))
@@ -392,8 +392,8 @@ button is found in the current buffer."
392392
393393(defun ebut:search (string out-buf &optional match-part )
394394 " Write explicit button lines matching STRING to OUT-BUF.
395- Searche across all files into which the user has previously saved explicit buttons.
396- By default, only matches for whole button labels are found ; optional MATCH-PART
395+ Search across all files into which the user has previously saved explicit buttons.
396+ By default, find matches for whole button labels only ; optional MATCH-PART
397397enables partial matches."
398398 (let* ((buffers (mapcar (lambda (dir )
399399 (expand-file-name hattr:filename dir))
@@ -549,7 +549,7 @@ Insert INSTANCE-FLAG after END, before ending delimiter."
549549 " File that stores globally accessible Hyperbole buttons, accessed by name." )
550550
551551(defun gbut:act (label )
552- " Activates Hyperbole global button with LABEL."
552+ " Activate Hyperbole global button with LABEL."
553553 (interactive (list (hargs:read-match " Activate global button labeled: "
554554 (mapcar 'list (gbut:label-list))
555555 nil t nil 'gbut )))
@@ -566,16 +566,16 @@ Insert INSTANCE-FLAG after END, before ending delimiter."
566566(defun gbut:get (&optional lbl-key )
567567 " Return global Hyperbole button symbol given by optional LBL-KEY if found in gbut:file.
568568
569- Retrieves any button data, converts into a button object and returns a symbol
569+ Retrieve any button data, convert into a button object and return a symbol
570570which references the button.
571571
572- All arguments are optional. When none are given, returns a symbol for
572+ All arguments are optional. When none are given, return a symbol for
573573the button that point is within or nil."
574574 (or (ebut:get lbl-key nil gbut:file)
575575 (ibut:get lbl-key nil gbut:file)))
576576
577577(defun gbut:help (label )
578- " Displays help for Hyperbole global button with LABEL."
578+ " Display help for Hyperbole global button with LABEL."
579579 (interactive (list (hargs:read-match " Report on global button labeled: "
580580 (mapcar 'list (gbut:label-list))
581581 nil t nil 'hbut )))
@@ -759,12 +759,19 @@ others who use a different value!")
759759(defun hbut:act (&optional hbut )
760760 " Perform action for optional explicit or implicit Hyperbole button symbol HBUT.
761761Default is 'hbut:current."
762+ (interactive (list (hbut:get (hargs:read-match " Activate labeled Hyperbole button: "
763+ (nconc (ebut:alist) (ibut:alist))
764+ nil t nil 'hbut ))))
762765 (unless hbut
763766 (setq hbut 'hbut:current ))
764- (when hbut
765- (apply hrule:action
766- (hattr:get hbut 'actype )
767- (hattr:get hbut 'args ))))
767+ (cond ((hbut:is-p hbut)
768+ (apply hrule:action
769+ (hattr:get hbut 'actype )
770+ (hattr:get hbut 'args )))
771+ ((and hbut (symbolp hbut))
772+ (hypb:error " (hbut:act): Symbol, %s, has invalid Hyperbole button attributes:\n %S" hbut (hattr:list hbut)))
773+ (t
774+ (hypb:error " (hbut:act): Invalid Hyperbole button: %s" hbut))))
768775
769776(defun hbut:action (hbut )
770777 " Return appropriate action for Hyperbole button symbol HBUT."
@@ -786,8 +793,8 @@ Then use (hbut:act) to activate the button."
786793
787794(defun hbut:comment (start end )
788795 " Comment button label spanning region START to END in current buffer.
789- Usees buffer commenting grammar, if any, otherwise doesn 't comment.
790- Ignores email-related buffers."
796+ Use buffer commenting grammar, if any, otherwise don 't comment.
797+ Ignore email-related buffers."
791798 (save-excursion
792799 (if (and comment-start (not (hmail:mode-is-p))
793800 (not (memq major-mode '(mail-mode message-mode))))
@@ -881,8 +888,8 @@ nil. BUFFER defaults to the current buffer."
881888
882889(defun hbut:key-src (&optional full )
883890 " Return key source (usually unqualified) for current Hyperbole button.
884- Also sets current buffer to key source.
885- With optional FULL when source is a pathname, the full pathname is returned ."
891+ Als sets current buffer to key source.
892+ With optional FULL when source is a pathname, return the full pathname."
886893 (let ((src (cond ((hmail:mode-is-p) (current-buffer ))
887894 ; ; If buffer represents the output of a document
888895 ; ; formatter, e.g. an Info document produced from a
@@ -959,7 +966,7 @@ represent the output of particular document formatters."
959966 src)))
960967
961968(defun hbut:key-to-label (lbl-key )
962- " Unnormalizes LBL-KEY and returns a label string for display."
969+ " Unnormalize LBL-KEY and return a label string for display."
963970 (if lbl-key
964971 (let* ((pos 0 ) (len (length lbl-key)) (lbl) c)
965972 (while (< pos len)
@@ -984,13 +991,13 @@ represent the output of particular document formatters."
984991
985992(defun hbut:label-p (&optional as-label start-delim end-delim pos-flag two-lines-flag )
986993 " Return key for the Hyperbole button label that point is within, else nil.
987- Assumes point is within the first line of any button label. All
988- following arguments are optional. If AS-LABEL is non-nil, label
989- is returned rather than the key derived from the label.
994+ Assume point is within the first line of any button label. All
995+ following arguments are optional. If AS-LABEL is non-nil, return
996+ the label rather than the key derived from the label.
990997START-DELIM and END-DELIM are strings that override default
991- button delimiters. With POS-FLAG non-nil, returns list of
998+ button delimiters. With POS-FLAG non-nil, return list of
992999label-or-key, but-start-position, but-end-position. Positions
993- include delimiters. With TWO-LINES-FLAG non-nil, constrains
1000+ include delimiters. With TWO-LINES-FLAG non-nil, constrain
9941001label search to two lines."
9951002 (or (ebut:label-p as-label start-delim end-delim pos-flag two-lines-flag)
9961003 (ibut:label-p as-label start-delim end-delim pos-flag two-lines-flag)))
@@ -1024,10 +1031,10 @@ label; these default to `ebut:start' and `ebut:end'."
10241031 (setq regexp (concat regexp sep0 (regexp-quote (or end-delim ebut:end))))))))
10251032
10261033(defun hbut:label-to-key (label )
1027- " Normalizes LABEL for use as a Hyperbole button key and returns key.
1028- Eliminates any fill prefix in the middle of the label, replaces `_' with
1029- `__' , removes leading and trailing whitespace and replaces each other
1030- whitespace sequence with `_' ."
1034+ " Normalize LABEL for use as a Hyperbole button key and return key.
1035+ Eliminate any fill prefix in the middle of the label, replace `_' with
1036+ `__' , remove leading and trailing whitespace and replace all other
1037+ whitespace sequences with `_' ."
10311038 (when label
10321039 (setq label (hbut:fill-prefix-remove label)
10331040 ; ; Remove leading and trailing space.
@@ -1038,12 +1045,12 @@ whitespace sequence with `_'."
10381045
10391046(defun hbut:map (but-func &optional start-delim end-delim
10401047 regexp-match include-delims )
1041- " Applies BUT-FUNC to a set of Hyperbole buttons in the visible part of the current buffer.
1048+ " Apply BUT-FUNC to a set of Hyperbole buttons in the visible part of the current buffer.
10421049The set of buttons are those whose labels are delimited by optional START-DELIM and
10431050END-DELIM and that match any optional REGEXP-MATCH.
10441051
10451052START-DELIM defaults to ebut:start; END-DELIM defaults to ebut:end.
1046- If END-DELIM is a symbol, e.g. t, then START-DELIM is taken as a regular
1053+ If END-DELIM is a symbol, e.g. t, then treat START-DELIM as a regular
10471054expression which matches an entire button string.
10481055
10491056BUT-FUNC must take precisely three arguments: the button label, the
@@ -1167,7 +1174,7 @@ Return number of buttons reported on or nil if none."
11671174
11681175(defun hbut:source (&optional full )
11691176 " Return Hyperbole source buffer or file given at point.
1170- If a file, always returns a full path if optional FULL is non-nil."
1177+ If a file, always return a full path if optional FULL is non-nil."
11711178 (goto-char (match-end 0 ))
11721179 (cond ((looking-at " #<buffer \" ?\\ ([^\n\" ]+\\ )\" ?>" )
11731180 (get-buffer (match-string 1 )))
@@ -1228,7 +1235,7 @@ source file for the buttons in the menu, if any.")
12281235
12291236
12301237(defun ibut:act (label )
1231- " Activates Hyperbole implicit button with <[LABEL]> from the current buffer."
1238+ " Activate Hyperbole implicit button with <[LABEL]> from the current buffer."
12321239 (interactive (list (hargs:read-match " Activate implicit button labeled: "
12331240 (ibut:alist)
12341241 nil t nil 'ibut )))
@@ -1329,7 +1336,7 @@ KEY-SRC is given when retrieving global buttons and is the full source pathname.
13291336
13301337Return a symbol which references the button.
13311338
1332- All arguments are optional. When none are given, returns a
1339+ All arguments are optional. When none are given, return a
13331340symbol for the button or button label that point is within or
13341341nil. BUFFER defaults to the current buffer."
13351342 (hattr:clear 'hbut:current )
@@ -1375,15 +1382,15 @@ Map over portion of buffer visible under any current restriction.
13751382BUT-FUNC must take precisely three arguments: the button label, the
13761383start position of the delimited button label and its end position (positions
13771384include delimiters when INCLUDE-DELIMS is non-nil).
1378- If END-DELIM is a symbol, e.g. t, then START-DELIM is taken as a regular
1385+ If END-DELIM is a symbol, e.g. t, then treat START-DELIM as a regular
13791386expression which matches an entire button string."
13801387 (hbut:map but-func ibut:label-start ibut:label-end))
13811388
13821389(defun ibut:rename (old-lbl new-lbl )
1383- " Modifies a label preceding a Hyperbole implicit button in the current buffer given by LBL-KEY.
1384- Signals an error when no such button is found in the current buffer.
1390+ " Modify a label preceding a Hyperbole implicit button in the current buffer given by LBL-KEY.
1391+ Signal an error when no such button is found in the current buffer.
13851392
1386- Leaves point at the start of the button label which may be elsewhere
1393+ Leave point at the start of the button label which may be elsewhere
13871394than the current point; callers should use `save-excursion` to retain
13881395current."
13891396 ; ; !! Need to handle adding instances to labels, similar to ebut:operate.
@@ -1401,7 +1408,7 @@ current."
14011408This is the normalized key form of an optional label that may
14021409precede an implicit button. Use `ibut:at-p' instead to test if
14031410point is on either the implicit button text itself or the label.
1404- Assumes point is within the first line of any button label.
1411+ Assume point is within the first line of any button label.
14051412
14061413All following arguments are optional. If AS-LABEL is non-nil,
14071414label is returned rather than the key derived from the label.
0 commit comments