commit 9329736d1959c257acb65f126cbb30cc6aece76e parent 24c0258665d496d06139ef24935fa2a5d5270b3f Author: Lou Woell <lou.woell@posteo.de> Date: Sat, 11 Oct 2025 18:55:44 +0200 [haredoc.el] generalize initialization Diffstat:
| M | haredoc.el | | | 33 | ++++++++++++++++++++++++++++----- |
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/haredoc.el b/haredoc.el @@ -32,6 +32,10 @@ ;; `(add-hook 'hare-mode-hook #'haredoc-nav-mode)' +;; Requires the Harehelper executable. Search location for the binary can be +;; customized via `haredoc-default-helper-loc', `haredoc-default-helper-bin' or +;; `haredoc-helperbin' directly. + ;;; TODO: ;; - melpa compatible setup @@ -47,11 +51,30 @@ (require 'ansi-color) (require 'xref) -(defconst haredoc-helperbindir (f-dirname (macroexp-file-name)) - "Default directory for `haredoc-helperbin'. -Defaults to directory containing this file.") -(defcustom haredoc-helperbin (concat haredoc-helperbindir "/harehelper") - "Location of the harehelper executable." +(defcustom haredoc-default-helper-bin "harehelper" + "Default Name of the Harehelper binary. + +Used to initialize `haredoc-default-helper-loc' and `haredoc-helperbin'." + :type 'file + :group 'haredoc) + +(defcustom haredoc-default-helper-loc (concat (f-dirname (macroexp-file-name)) + haredoc-default-helper-bin) + "Default value for `haredoc-helperbin'. + +Defaults to directory containing this source file." + :type 'file + :group 'haredoc) + +(defcustom haredoc-helperbin + (or (and (f-exists? haredoc-default-helper-loc) + haredoc-default-helper-loc) + (executable-find haredoc-default-helper-bin) + (error "Harehelper executable not found.")) + "Location of the harehelper executable. + +Defaults to `haredoc-default-helper-loc' if that exists, otherwise looks +for `haredoc-default-helper-bin' in `exec-path'." :type 'file :group 'haredoc)