branch: externals/hyperbole
commit 48798326f753523e120e0b56f4aa76ee01895f94
Author: Bob Weiner <[email protected]>
Commit: Bob Weiner <[email protected]>
hload-path.el - Use any symlink to Hyperbole root dir in load-path
---
Changes | 5 +++++
hload-path.el | 19 +++++++++----------
hyperbole.el | 12 +++++++-----
3 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/Changes b/Changes
index ef7be6e..d15dbfe 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,10 @@
2020-06-28 Bob Weiner <[email protected]>
+* hload-path.el: Use (setq hyperb:dir (file-truename hyperb:dir)) only after
Hyperbole paths
+ have been added to load-path, so that if they are symlinks, the symlink
name rather than
+ the truename is used there since the package manage usses the symlink name
and may have
+ added such a path already.
+
* hmouse-drv.el (quit-window): Handle primitive functions when replacing this
command.
* hypb.el (hypb:function-symbol-replace): Make a no-op if symbol-function is a
non-Lisp primitive.
diff --git a/hload-path.el b/hload-path.el
index 5e85b62..53c69cc 100644
--- a/hload-path.el
+++ b/hload-path.el
@@ -18,25 +18,18 @@
(defconst hyperb:dir (or (file-name-directory
(or (and (stringp load-file-name) load-file-name)
- (hyperb:path-being-loaded)
(locate-file "hmouse-tag.el" load-path)
+ (hyperb:path-being-loaded)
""))
(error
"(Hyperbole): Failed to set hyperb:dir. Try setting
it manually"))
"Directory where the Hyperbole executable code is kept.
It must end with a directory separator character.")
-;; Ensure final name (after resolving all links) of hyperb:dir is
-;; used; otherwise, Hyperbole may fail to substitute this as a
-;; variable into link path buttons.
-(when (stringp hyperb:dir)
- (setq hyperb:dir (file-truename hyperb:dir)))
-
;; Add hyperb:dir to load-path so other Hyperbole libraries can be
;; found unless it is already there since the Emacs Package Manager
;; may have already added it.
-(unless (member (directory-file-name hyperb:dir) load-path)
- (add-to-list 'load-path hyperb:dir))
+(add-to-list 'load-path (directory-file-name hyperb:dir))
;;; ************************************************************************
;;; Koutliner mode and file suffix importation settings
@@ -44,11 +37,17 @@ It must end with a directory separator character.")
;; Perform Koutliner initializations.
-(add-to-list 'load-path (expand-file-name "kotl/" hyperb:dir))
+(add-to-list 'load-path (expand-file-name "kotl" hyperb:dir))
;; Invoke kotl-mode for files ending in ".kotl".
;; Also allow ".kot" for DOS and Windows users.
(add-to-list 'auto-mode-alist '("\\.kotl?\\'" . kotl-mode))
+;; Ensure final name (after resolving all links) of hyperb:dir is
+;; used after setting up load-path; otherwise, Hyperbole may fail
+;; to substitute this as a variable into link path buttons.
+(when (stringp hyperb:dir)
+ (setq hyperb:dir (file-truename hyperb:dir)))
+
(provide 'hload-path)
;;; hload-path.el ends here
diff --git a/hyperbole.el b/hyperbole.el
index 55f9ef7..5fada36 100644
--- a/hyperbole.el
+++ b/hyperbole.el
@@ -736,11 +736,13 @@ This is used only when running from git source and not a
package release."
;; This call loads the rest of the Hyperbole system.
(require 'hinit)
-(if after-init-time
- ;; This call initializes Hyperbole key bindings and hooks.
- (hyperb:init)
- ;; Initialize after other key bindings are loaded at startup.
- (add-hook 'after-init-hook #'hyperb:init t))
+;; Prevent multiple initializations of Hyperbole
+(unless (featurep 'hyperbole)
+ (if after-init-time
+ ;; This call initializes Hyperbole key bindings and hooks.
+ (hyperb:init)
+ ;; Initialize after other key bindings are loaded at startup.
+ (add-hook 'after-init-hook #'hyperb:init t)))
(makunbound 'hyperbole-loading)