branch: externals/hyperbole commit 48210fb5355d3693ead7c330905014228f9e6f0f Author: Bob Weiner <r...@gnu.org> Commit: Bob Weiner <r...@gnu.org>
Fix hyrolo-to-entry-beginning Fix byte-compiler warnings --- ChangeLog | 5 +++++ hsettings.el | 3 ++- hsys-org-roam.el | 7 ++++++- hsys-org.el | 15 +++++++------- hui-treemacs.el | 14 ++++++------- hui-window.el | 3 ++- hypb.el | 7 ++++--- hyrolo.el | 61 +++++++++++++++++++------------------------------------- 8 files changed, 54 insertions(+), 61 deletions(-) diff --git a/ChangeLog b/ChangeLog index 59127db689..07e3c65004 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-01-15 Bob Weiner <r...@gnu.org> + +* hyrolo.el (hyrolo-to-entry-beginning): Rewrite to move properly. + (hyrolo-move-backward): Remove, no longer used. + 2024-01-16 Mats Lidell <ma...@gnu.org> * test/hyrolo-tests.el diff --git a/hsettings.el b/hsettings.el index 4ab963c378..93f973e492 100644 --- a/hsettings.el +++ b/hsettings.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 15-Apr-91 at 00:48:49 -;; Last-Mod: 3-Oct-23 at 17:22:51 by Mats Lidell +;; Last-Mod: 15-Jan-24 at 23:57:25 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -26,6 +26,7 @@ ;;; Other required Elisp libraries ;;; ************************************************************************ +(require 'cl-lib) (require 'hversion) (require 'hvar) (require 'browse-url) diff --git a/hsys-org-roam.el b/hsys-org-roam.el index b0cd08321e..96103f2478 100644 --- a/hsys-org-roam.el +++ b/hsys-org-roam.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 26-Feb-23 at 11:20:15 by Bob Weiner -;; Last-Mod: 6-Jan-24 at 00:54:15 by Mats Lidell +;; Last-Mod: 15-Jan-24 at 23:54:00 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -22,6 +22,11 @@ ;; assign them UUIDs required for indexing by Org Roam. ;;; Code: +;;; ************************************************************************ +;;; Other required Elisp libraries +;;; ************************************************************************ + +(require 'package) ;;; ************************************************************************ ;;; Public declarations diff --git a/hsys-org.el b/hsys-org.el index c797f0228f..69c9c969db 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: 14-Jan-24 at 12:07:26 by Bob Weiner +;; Last-Mod: 16-Jan-24 at 00:16:13 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -35,6 +35,7 @@ (require 'org) (require 'org-element) (require 'org-fold nil t) +(require 'org-macs) (require 'package) ;; Avoid any potential library name conflict by giving the load directory. (require 'set (expand-file-name "set" hyperb:dir)) @@ -50,13 +51,13 @@ :type 'function :group 'org) -;; `org-show-context' is obsolete as of Org 9.6, use `org-fold-show-context' -;; instead. -(unless (fboundp #'org-fold-show-context) - (with-suppressed-warnings ((obsolete org-show-context)) - (defalias 'org-fold-show-context #'org-show-context))) - (defvar hyperbole-mode-map) ; "hyperbole.el" +(defvar org--inhibit-version-check) ; "org-macs.el" + +(declare-function org-babel-get-src-block-info "org-babel") +(declare-function org-fold-show-context "org-fold") +(declare-function org-link-open-from-string "ol") +(declare-function outline-on-heading-p "outline") (declare-function smart-eobp "hui-mouse") (declare-function smart-eolp "hui-mouse") diff --git a/hui-treemacs.el b/hui-treemacs.el index 77ba6a3725..c7f7c8df21 100644 --- a/hui-treemacs.el +++ b/hui-treemacs.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 19-Nov-17 -;; Last-Mod: 3-Oct-23 at 23:01:16 by Mats Lidell +;; Last-Mod: 16-Jan-24 at 00:21:50 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -21,12 +21,12 @@ ;;; Other required Elisp libraries ;;; ************************************************************************ -(when (or (require 'treemacs nil t) - (and (require 'package) - (package-installed-p 'treemacs) - (package-activate 'treemacs))) +(require 'package) +(require 'seq) -(require 'treemacs) +(or (require 'treemacs nil t) + (and (package-installed-p 'treemacs) + (package-activate 'treemacs))) (defvar treemacs-version) @@ -141,4 +141,4 @@ Suitable for use as a value of `action-key-modeline-buffer-id-function'." (provide 'hui-treemacs) ;;; hui-treemacs.el ends here -) + diff --git a/hui-window.el b/hui-window.el index 98d7b03fb3..5ebca1cf84 100644 --- a/hui-window.el +++ b/hui-window.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 21-Sep-92 -;; Last-Mod: 27-Dec-23 at 23:59:25 by Bob Weiner +;; Last-Mod: 15-Jan-24 at 23:52:17 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -30,6 +30,7 @@ (require 'hycontrol) ;; If installed, use pulse library for momentary highlighting of buffer/file item lines. (require 'pulse nil t) +(require 'seq) (require 'hui-select) ;;; ************************************************************************ diff --git a/hypb.el b/hypb.el index d4c1c4f37c..7c27bd745e 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: 14-Jan-24 at 10:47:40 by Bob Weiner +;; Last-Mod: 15-Jan-24 at 23:51:41 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -19,8 +19,9 @@ ;;; Other required Elisp libraries ;;; ************************************************************************ -;; Load Org here for `org-show-all'. -(eval-and-compile (mapc #'require '(compile hversion hact locate cl-lib org))) +;; Load Org here for `org-fold-show-all'. +(eval-and-compile (mapc #'require '(compile hversion hact locate + cl-lib org package))) ;;; ************************************************************************ ;;; Public declarations diff --git a/hyrolo.el b/hyrolo.el index cdde8cccce..b0cae4e482 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: 15-Jan-24 at 21:27:59 by Bob Weiner +;; Last-Mod: 15-Jan-24 at 23:50:21 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -93,6 +93,7 @@ (declare-function hui:hbut-act "hui") (declare-function ibut:at-p "hbut") (declare-function kcell-view:indent "kotl/kview") +(declare-function kcell-view:level "kotl/kview") (declare-function hmouse-pulse-line "hui-window") (declare-function hpath:find "hpath") @@ -2354,15 +2355,13 @@ begins or nil if not found." With optional prefix arg INCLUDE-SUB-ENTRIES non-nil, move to the beginning of the highest ancestor level. Return final point." (interactive "P") - (hyrolo-move-backward - (lambda (include-sub-entries) - (outline-back-to-heading) - (when include-sub-entries - (unless (<= (hyrolo-outline-level) 1) - (outline-up-heading 80))) - (when (hyrolo-hdr-move-after-p) - (hyrolo-outline-next-visible-heading 1))) - include-sub-entries)) + (when (hyrolo-hdr-in-p) + (hyrolo-hdr-to-first-line-p)) + (if include-sub-entries + (unless (<= (hyrolo-outline-level) 1) + (hyrolo-outline-up-heading 80)) + (hyrolo-outline-back-to-heading)) + (point)) (defun hyrolo-to-entry-end (&optional include-sub-entries) "Move point past the end of the current entry. @@ -2803,29 +2802,6 @@ Any call to this function should be wrapped in a call to "Pop to BUFFER." (pop-to-buffer buffer other-window-flag)) -(defun hyrolo-move-backward (func &rest args) - "Move back past any file header and apply FUNC to ARGS. -Return final point." - (let ((opoint (point))) - ;; Prevent error when calling 'func' when within a file header. - (while (and (or (looking-at hyrolo-hdr-regexp) - (looking-at hbut:source-prefix)) - (hyrolo-outline-previous-heading))) - (when (/= (point) opoint) - (forward-line 1)) - (hyrolo-funcall-match - (lambda () - (apply func args) - (when (or (looking-at hyrolo-hdr-regexp) - (looking-at hbut:source-prefix)) - (forward-line 1) - (re-search-backward hyrolo-hdr-regexp nil t 2)) - (when (> (point) opoint) - (goto-char opoint))) - ;; Narrow to current match buffer when given a lambda func. - (not (symbolp func)))) - (point)) - (defun hyrolo-move-forward (func &rest args) "Move forward past any file header and apply FUNC to ARGS. If FUNC is a lambda (not a function symbol), then temporarily @@ -2903,8 +2879,7 @@ prior to applying FUNC." (error "(hryolo-map-matches): No HyRolo matches in current buffer")) (let ((display-buf (get-buffer hyrolo-display-buffer))) (if (eq (current-buffer) display-buf) - (let ((outline-regexp hyrolo-hdr-and-entry-regexp) - (bounds hyrolo--cache-loc-match-bounds) + (let ((bounds hyrolo--cache-loc-match-bounds) (ofont-lock font-lock-mode) (omode major-mode) (ostart (point-min)) @@ -2923,7 +2898,8 @@ prior to applying FUNC." (let ((font-lock-mode)) (hyrolo-cache-set-major-mode (1+ start)) (setq font-lock-mode nil) ;; Prevent Org mode from font-locking - (funcall func)))) + (let ((outline-regexp hyrolo-hdr-and-entry-regexp)) + (funcall func))))) (when narrow-flag ;; Restore original restriction (narrow-to-region ostart oend)) @@ -2940,8 +2916,9 @@ prior to applying FUNC." ;; hyrolo uses reveal-mode, redisplay will rexpand ;; hidden entries to make point visible. (hyrolo-back-to-visible-point))) - (save-excursion - (funcall func))))) + (let ((outline-regexp hyrolo-hdr-and-entry-regexp)) + (save-excursion + (funcall func)))))) (defun hyrolo-funcall-match (func &optional narrow-flag backward-flag) "Apply FUNC with no arguments to the entry at point. @@ -2957,7 +2934,7 @@ on a file boundary, move point back a character to select the proper major mode." (let ((display-buf (get-buffer hyrolo-display-buffer))) (if (eq (current-buffer) display-buf) - (let ((outline-regexp hyrolo-hdr-and-entry-regexp)) + (progn (when (< (length hyrolo--cache-loc-match-bounds) 1) (error "(hryolo-funcall-match): No HyRolo matches in display buffer")) (let ((ofont-lock font-lock-mode) @@ -2978,7 +2955,8 @@ proper major mode." (hyrolo-cache-set-major-mode (1+ start))) ;; Prevent Org and Outline minor modes from font-locking (setq font-lock-mode nil) - (funcall func))) + (let ((outline-regexp hyrolo-hdr-and-entry-regexp)) + (funcall func)))) (with-current-buffer display-buf ;; func may have changed the current buffer (when narrow-flag @@ -2997,7 +2975,8 @@ proper major mode." ;; hyrolo uses reveal-mode, redisplay will rexpand ;; hidden entries to make point visible. (hyrolo-back-to-visible-point))))) - (funcall func)))) + (let ((outline-regexp hyrolo-hdr-and-entry-regexp)) + (funcall func))))) (defun hyrolo-cache-location-start-and-end () "Return a list of the (start end) of location matches that point is within.