[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole a17d305749 1/2: Expand smart-org to handle op
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole a17d305749 1/2: Expand smart-org to handle opening and closing src block/result hdrs |
Date: |
Sat, 3 Dec 2022 10:57:45 -0500 (EST) |
branch: externals/hyperbole
commit a17d305749429f75863d78c20cc14b3f5bfae4de
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>
Expand smart-org to handle opening and closing src block/result hdrs
Fix hpath:expand-with-variable to expand local files properly.
Add Ruby traceback messages to grep-msg ibtype.
---
ChangeLog | 21 +++++++++++++++++++++
hibtypes.el | 9 ++++++---
hpath.el | 48 ++++++++++++++++++++++++++----------------------
hsys-org.el | 14 +++++++++++---
hui-mouse.el | 47 ++++++++++++++++++++++++++++++++++-------------
hyperbole.el | 4 ++--
man/hyperbole.texi | 34 +++++++++++++++++++++++-----------
man/version.texi | 4 ++--
test/hsys-org-tests.el | 10 +++++++++-
9 files changed, 134 insertions(+), 57 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 54d180b177..52a1449def 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2022-12-03 Bob Weiner <rsw@gnu.org>
+
+* hpath.el (hpath:expand-with-variable): Fix to expand from local dir first
+ before using dirs in hpath:expand-with-variable.
+
+* hibtypes.el (grep-msg): Add support for Ruby traceback stack messages.
+
+* hsys-org.el (hsys-org-src-block-start-at-p): Add.
+ test/hsys-org-tests.el (hsys-org:src-block-start-at-p): Test it.
+
+2022-12-02 Bob Weiner <rsw@gnu.org>
+
+* man/hyperbole.texi (Implicit Button Types): Update Smart Key Org mode
description.
+ hui-mouse.el (smart-org): Add doc for :dir path handling and for removing
code
+ block results with the Assist Key. Also, make the Smart Keys work the same
+ when point is on a #+RESULTS headers as they do when on a code header.
+
2022-11-27 Bob Weiner <rsw@gnu.org>
* hmouse-tag.el (smart-tags-org-src-block-p): Add and use in
'smart-tags-file-list'
@@ -50,6 +67,10 @@
* hact.el (htype:symbol): Add as autoload since used in "hsys-youtube.el"
autoloads.
+2022-11-22 Bob Weiner <rsw@gnu.org>
+
+* hsys-youtube.el: Add all public functions as autoloads.
+
2022-11-21 Bob Weiner <rsw@gnu.org>
* hycontrol.el (framemove, windmove): Conditionally requires these libs
diff --git a/hibtypes.el b/hibtypes.el
index 65c1589c22..381673e7e5 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: 26-Nov-22 at 11:44:48 by Bob Weiner
+;; Last-Mod: 3-Dec-22 at 01:08:43 by Bob Weiner
;;
;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -928,8 +928,10 @@ in grep and shell buffers."
(looking-at "Compiling \\(\\S-+\\)\\.\\.\\.$")
(looking-at "Loading \\(\\S-+\\) (\\S-+)\\.\\.\\.$")
;; Grep matches (allowing for Emacs Lisp vars with : in
- ;; name within the pathname), UNIX C compiler and Introl 68HC11 C
compiler errors
+ ;; name within the pathname), Ruby, UNIX C compiler and Introl
68HC11 C compiler errors
(looking-at "\\([^ \t\n\r\"'`]*[^ \t\n\r:\"'`]\\):
?\\([1-9][0-9]*\\)[ :]")
+ ;; Ruby tracebacks
+ (looking-at "[ \t]+[1-9][0-9]*: from \\([^ \t\n\r\"'`]*[^
\t\n\r:\"'`]\\):\\([1-9][0-9]*\\):in")
;; Grep matches, UNIX C compiler and Introl 68HC11 C
;; compiler errors, allowing for file names with
;; spaces followed by a null character rather than a :
@@ -1437,7 +1439,8 @@ arg1 ... argN '>'. For example, <mail nil
\"user@somewhere.org\">."
(when (and (memq actype '(hy hynote))
(string-match-p " " lbl))
(setq lbl (replace-regexp-in-string "\"\\(.*\\)\\'" "\\1\""
- (combine-and-quote-strings
(split-string lbl) "\" \""))))
+ (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/hpath.el b/hpath.el
index 6dc0d4556f..a75b9269c3 100644
--- a/hpath.el
+++ b/hpath.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 1-Nov-91 at 00:44:23
-;; Last-Mod: 6-Nov-22 at 11:43:43 by Bob Weiner
+;; Last-Mod: 3-Dec-22 at 02:20:47 by Bob Weiner
;;
;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -1258,9 +1258,9 @@ it, else return nil."
(defun hpath:expand-with-variable (path)
"Prepend to relative PATH the ${load var name} from
`hpath:auto-variable-alist'.
-When PATH is relative, prepend to it the first file matching regexp in
-`hpath:auto-variable-alist' sans any compression suffix in
-`hpath:compressed-suffix-regexp'.
+When PATH is relative, try to expand in local directory first. If that fails,
+prepend to it the first file matching regexp in `hpath:auto-variable-alist'
sans
+any compression suffix in `hpath:compressed-suffix-regexp'.
If PATH is absolute, return it unchanged."
(when (stringp path)
(let ((auto-variable-alist hpath:auto-variable-alist)
@@ -1270,24 +1270,28 @@ If PATH is absolute, return it unchanged."
regexp
variable
variable-name)
- (unless (or (file-name-absolute-p path)
- (hpath:url-p path)
- (string-match-p hpath:variable-regexp path))
- (while auto-variable-alist
- (setq regexp (caar auto-variable-alist)
- variable (cdar auto-variable-alist)
- auto-variable-alist (cdr auto-variable-alist)
- variable-name (if (and variable (symbolp variable))
- (symbol-name variable)
- variable))
- (when (and path variable (string-match regexp path))
- (when (and (not (string-match (regexp-quote variable-name) path))
- (or (and (stringp variable) (getenv variable))
- (and (symbolp variable) (boundp variable))))
- (when (string-match "\\`\\.[\\/]" path)
- (setq path (substring path (match-end 0))))
- (setq path (format "${%s}/%s" variable path)))
- (setq auto-variable-alist nil))))
+ (if (file-exists-p path)
+ ;; Path is either absolute or relative to current directory
+ ;; so don't expand into hpath:auto-variable-alist paths.
+ (setq path (expand-file-name path))
+ (unless (or (file-name-absolute-p path)
+ (hpath:url-p path)
+ (string-match-p hpath:variable-regexp path))
+ (while auto-variable-alist
+ (setq regexp (caar auto-variable-alist)
+ variable (cdar auto-variable-alist)
+ auto-variable-alist (cdr auto-variable-alist)
+ variable-name (if (and variable (symbolp variable))
+ (symbol-name variable)
+ variable))
+ (when (and path variable (string-match regexp path))
+ (when (and (not (string-match (regexp-quote variable-name) path))
+ (or (and (stringp variable) (getenv variable))
+ (and (symbolp variable) (boundp variable))))
+ (when (string-match "\\`\\.[\\/]" path)
+ (setq path (substring path (match-end 0))))
+ (setq path (format "${%s}/%s" variable path)))
+ (setq auto-variable-alist nil)))))
(concat path compression-suffix))))
(defun hpath:file-line-and-column (path-line-and-col)
diff --git a/hsys-org.el b/hsys-org.el
index adfd1fdae8..6c509d33a5 100644
--- a/hsys-org.el
+++ b/hsys-org.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 2-Jul-16 at 14:54:14
-;; Last-Mod: 28-Nov-22 at 02:03:20 by Bob Weiner
+;; Last-Mod: 3-Dec-22 at 02:33:37 by Bob Weiner
;;
;; Copyright (C) 2016-2021 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -202,8 +202,16 @@ Return the (start . end) buffer positions of the region."
"Return non-nil if point is on the first line of an Org block definition."
(save-excursion
(forward-line 0)
- (or (looking-at org-block-regexp)
- (looking-at org-dblock-start-re))))
+ (let ((case-fold-search t))
+ (or (looking-at org-block-regexp)
+ (looking-at org-dblock-start-re)))))
+
+(defun hsys-org-src-block-start-at-p ()
+ "Return non-nil if point is on the first line of an Org source block
definition."
+ (save-excursion
+ (forward-line 0)
+ (let ((case-fold-search t))
+ (looking-at org-babel-src-block-regexp))))
(defun hsys-org-link-at-p ()
"Return non-nil iff point is on an Org mode link.
diff --git a/hui-mouse.el b/hui-mouse.el
index b1b2606d84..86e3232edf 100644
--- a/hui-mouse.el
+++ b/hui-mouse.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 04-Feb-89
-;; Last-Mod: 28-Nov-22 at 02:35:34 by Bob Weiner
+;; Last-Mod: 3-Dec-22 at 00:21:51 by Bob Weiner
;;
;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -1680,15 +1680,18 @@ When the Action Key is pressed:
6. When on a Hyperbole button, activate the button.
- 7. With point on the first line of a code block definition, execute the
- code block via the Org mode standard binding of {C-c C-c},
- (org-ctrl-c-ctrl-c).
+ 7. With point on the :dir path of a code block definition, display the
+ directory given by the path.
+
+ 8. With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
+ or #+end_example header, execute the code block via the Org mode
+ standard binding of {C-c C-c}, (org-ctrl-c-ctrl-c).
- 8. When point is on an outline heading in Org mode, cycle the view of the
- subtree at point.
+ 9. When point is on an Org mode heading, cycle the view of the subtree
+ at point.
- 9. In any other context besides the end of a line, the Action Key invokes
- the Org mode standard binding of {M-RET}, (org-meta-return).
+ 10. In any other context besides the end of a line, invoke the Org mode
+ standard binding of {M-RET}, (org-meta-return).
When the Assist Key is pressed, it behaves just like the Action Key except
in these contexts:
@@ -1699,10 +1702,16 @@ in these contexts:
2. If on an Org mode link or agenda item, display Hyperbole
context-sensitive help.
- 3. On a Hyperbole button, performs the Assist Key function, generally
+ 3. On a Hyperbole button, perform the Assist Key function, generally
showing help for the button.
- 4. Not on a Hyperbole button but on an Org mode heading, cycle
+ 4. With point on the :dir value of a code block definition, display
+ a help summary of this implicit directory button.
+
+ 5. With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
+ or #+end_example header, remove source block results.
+
+ 6. Not on a Hyperbole button but on an Org mode heading, cycle
through views of the whole buffer outline.
To disable ALL Hyperbole support within Org major and minor modes, set the
@@ -1748,8 +1757,20 @@ handled by the separate implicit button type,
`org-link-outside-org-mode'."
;; Fall through until Hyperbole button context and
;; activate normally.
nil)
- ((hsys-org-block-start-at-p)
- (hact 'org-ctrl-c-ctrl-c)
+ ((or (hsys-org-src-block-start-at-p)
+ (save-excursion (forward-line 0)
+ (or (looking-at org-babel-result-regexp)
+ (looking-at "^[
]*#\\+\\(end_src\\|begin_example\\|end_example\\)"))))
+ (hact (lambda ()
+ (save-excursion
+ (unless (hsys-org-src-block-start-at-p)
+ (re-search-backward org-babel-src-block-regexp
nil t))
+ (cond ((not assist-flag)
+ (org-ctrl-c-ctrl-c))
+ ((org-babel-where-is-src-block-result)
+ (org-babel-remove-result)
+ (message "Code block results removed."))
+ (t (message "No results to remove for this
code block."))))))
t)
((hsys-org-heading-at-p)
(if (not assist-flag)
@@ -1778,7 +1799,7 @@ handled by the separate implicit button type,
`org-link-outside-org-mode'."
nil)
((equal (hsys-org-get-value :language) "python")
(setq hkey-value (smart-python-at-tag-p))
- (hact 'smart-python hkey-value 'next-tag))
+ (hact 'smart-python hkey-value ''next-tag))
(t
(when (hsys-org-meta-return-shared-p)
(hact 'hsys-org-meta-return))
diff --git a/hyperbole.el b/hyperbole.el
index 4bbf0db382..8568c4e9eb 100644
--- a/hyperbole.el
+++ b/hyperbole.el
@@ -5,8 +5,8 @@
;; Author: Bob Weiner
;; Maintainer: Bob Weiner <rsw@gnu.org>, Mats Lidell <matsl@gnu.org>
;; Created: 06-Oct-92 at 11:52:51
-;; Last-Mod: 6-Aug-22 at 21:23:08 by Mats Lidell
-;; Released: 01-May-22
+;; Last-mod: 3-Dec-22 at 02:37:07 by Bob Weiner
+;; Released: 03-Dec-22
;; Version: 8.0.1pre
;; Keywords: comm, convenience, files, frames, hypermedia, languages,
mail, matching, mouse, multimedia, outlines, tools, wp
;; Package: hyperbole
diff --git a/man/hyperbole.texi b/man/hyperbole.texi
index 4642c77aa5..cebfde5352 100644
--- a/man/hyperbole.texi
+++ b/man/hyperbole.texi
@@ -7,7 +7,7 @@
@c Author: Bob Weiner
@c
@c Orig-Date: 6-Nov-91 at 11:18:03
-@c Last-Mod: 26-Nov-22 at 18:17:54 by Bob Weiner
+@c Last-Mod: 3-Dec-22 at 02:35:10 by Bob Weiner
@c %**start of header (This is for running Texinfo on a region.)
@setfilename hyperbole.info
@@ -156,7 +156,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</P>
<PRE>
Edition 8.0.1pre
-Printed November 26, 2022.
+Printed December 3, 2022.
Published by the Free Software Foundation, Inc.
Author: Bob Weiner
@@ -198,7 +198,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@example
Edition 8.0.1pre
-November 26, 2022
+December 3, 2022
Published by the Free Software Foundation, Inc.
Author: Bob Weiner
@@ -2155,17 +2155,21 @@ Follow Org mode external links.
When on a Hyperbole button, activate the button.
@item
-With point on the first line of a code block definition, execute the
-code block via the Org mode standard binding of @bkbd{C-c C-c},
-@code{org-ctrl-c-ctrl-c}.
-
+With point on the :dir path of a code block definition, display the
+directory given by the path.
+
+@item
+With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
+or #+end_example header, execute the code block via the Org mode
+standard binding of @bkbd{C-c C-c}, @code{org-ctrl-c-ctrl-c}.
+
@item
-When point is on an outline heading in Org mode, cycle the view of the
-subtree at point.
+When point is on an Org mode heading, cycle the view of the subtree
+at point.
@item
-In any other context besides the end of a line, the Action Key invokes
-the Org mode standard binding of @bkbd{M-@key{RET}}, @code{org-meta-return}.
+In any other context besides the end of a line, invoke the Org mode
+standard binding of @bkbd{M-@key{RET}}, @code{org-meta-return}.
@end enumerate
@noindent
@@ -2185,6 +2189,14 @@ context-sensitive help.
On a Hyperbole button, performs the Assist Key function, generally
showing help for the button.
+@item
+With point on the :dir value of a code block definition, display
+a help summary of this implicit directory button.
+
+@item
+With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
+or #+end_example header, remove any associated results.
+
@item
Not on a Hyperbole button but on an Org mode heading, cycle
through views of the whole buffer outline.
diff --git a/man/version.texi b/man/version.texi
index 6bb7eaffe4..bb438555ae 100644
--- a/man/version.texi
+++ b/man/version.texi
@@ -1,4 +1,4 @@
-@set UPDATED November, 2022
-@set UPDATED-MONTH November 2022
+@set UPDATED December, 2022
+@set UPDATED-MONTH December 2022
@set EDITION 8.0.1pre
@set VERSION 8.0.1pre
diff --git a/test/hsys-org-tests.el b/test/hsys-org-tests.el
index ef8f2b0728..685554c900 100644
--- a/test/hsys-org-tests.el
+++ b/test/hsys-org-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 23-Apr-21 at 20:55:00
-;; Last-Mod: 26-Nov-22 at 14:27:43 by Bob Weiner
+;; Last-Mod: 3-Dec-22 at 00:12:39 by Bob Weiner
;;
;; Copyright (C) 2021 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
@@ -53,6 +53,14 @@
(goto-char 1)
(should (hsys-org-block-start-at-p))))
+(ert-deftest hsys-org:src-block-start-at-p ()
+ "Should be t if point is on the start of a source block."
+ (with-temp-buffer
+ (org-mode)
+ (insert "#+BEGIN_SRC python\n text\n#+END_SRC\n")
+ (goto-char 1)
+ (should (hsys-org-src-block-start-at-p))))
+
(ert-deftest hsys-org:org-link-at-p ()
"Should be t if point is within an org-link."
(with-temp-buffer