branch: scratch/hyperbole commit ba352bce93e7f9d9eba93e7b53d1d0b3b6f324b1 Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Fix a few minor miscompilations and warnings * Makefile (LOAD_EL): Escape trailing double quote so it's not confused with a beginning-of-string. * hbut.el: Require `house-drv` to fix miscompilation of let-bindings of `hui--ignore-action-key-depress-prev-point`. Prefer #' to quote function names. (hbut:max-len, ibut:label-start, ibut:label-end): Add `defvar`s to fix some of the many warnings and to make sure they're compiled as dynvars. (ibut:at-type-p): Remove unused `types` var. (defib): Remove redundant indent property. * hibtypes.el (org-link-outside-org-mode): Silence some warnings. (grep-msg): Avoid NUL bytes in source files (makes Emacs thinks they're binary). * set.el: Prefer #' to quote function names. --- Makefile | 2 +- hbut.el | 28 ++++++++++++++++++---------- hibtypes.el | 9 ++++++--- set.el | 8 ++++---- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 8c0ba07234..e857120662 100644 --- a/Makefile +++ b/Makefile @@ -305,7 +305,7 @@ bin: src # Create -l "file.el" load-file command-line args for each Hyperbole .el file for use in # eln native compile target below. -LOAD_EL = $(shell echo "$(EL_KOTL) $(EL_COMPILE)" | sed - -e 's+ +" -l "./+g' -e 's+^+-l "+')" +LOAD_EL = $(shell echo "$(EL_KOTL) $(EL_COMPILE)" | sed - -e 's+ +" -l "./+g' -e 's+^+-l "+')\" load-hyperbole: $(EMACS_BATCH) \ diff --git a/hbut.el b/hbut.el index 38e8cc8cb1..ef19d5b71e 100644 --- a/hbut.el +++ b/hbut.el @@ -22,6 +22,7 @@ (eval-and-compile (mapc #'require '(cl-lib elisp-mode help-mode hversion hmoccur hbmap htz hbdata hact hui-select view))) +(require 'hmouse-drv) ;For `hui--ignore-action-key-depress-prev-point'. ;;; ************************************************************************ ;;; Public declarations @@ -207,6 +208,8 @@ Return nil if no matching button is found." (defalias 'ebut:key-src-fmt #'hbut:key-src-fmt) (defalias 'ebut:key-to-label #'hbut:key-to-label) +(defvar hbut:max-len) + (defun ebut:label-p (&optional as-label start-delim end-delim pos-flag two-lines-flag) "Return key for the explicit button label that point is within, else nil. This is the normalized key form of the explicit button's label. @@ -686,7 +689,7 @@ Return nil if no matching button is found." (defun gbut:help (label) "Display help for Hyperbole global button with LABEL." (interactive (list (hargs:read-match "Report on global button labeled: " - (mapcar 'list (gbut:label-list)) + (mapcar #'list (gbut:label-list)) nil t nil 'hbut))) (let* ((lbl-key (hbut:label-to-key label)) (but (hbut:get lbl-key nil (gbut:file)))) @@ -1499,7 +1502,7 @@ If a file, always return a full path if optional FULL-FLAG is non-nil." (expand-file-name file default-directory) file))))) -(defalias 'hbut:summarize 'hbut:report) +(defalias 'hbut:summarize #'hbut:report) (defun hbut:to (lbl-key) "Find the nearest explicit button or labeled/named implicit button. @@ -1624,8 +1627,12 @@ associated arguments from the button." (unless (string-match "::" type-name) (setq ibut-type-symbol (intern-soft (concat "ibtypes::" type-name)))) (when ibut-type-symbol - (let ((types (htype:category 'ibtypes)) + (let (;; (types (htype:category 'ibtypes)) ;; 'types' is a global var used in (hact) function, don't delete. + ;; FIXME: I can't see where `types' is used as a global var + ;; "in (hact) function", and the above binding was treated + ;; by Emacs as lexically-scoped so it wasn't affecting any + ;; other global `types' definition anyway. (hrule:action 'actype:identity)) (funcall ibut-type-symbol)))))) @@ -1764,6 +1771,9 @@ return nil if no implicit button is found at point." [&optional ["&optional" arg &rest arg]] &optional ["&rest" arg]))) +(defvar ibut:label-start) +(defvar ibut:label-end) + (defun ibut:delete (&optional but-sym) "Delete Hyperbole implicit button based on optional BUT-SYM. Default is the symbol hbut:current'. @@ -1977,10 +1987,10 @@ positions at which the button label delimiter begins and ends." (error "(ibut:key): Argument is not a Hyperbole implicit button symbol, `%s'" ibut))) -(defalias 'ibut:to-key-src 'hbut:to-key-src) -(defalias 'ibut:key-to-label 'hbut:key-to-label) -(defalias 'ibut:label-to-key 'hbut:label-to-key) -(defalias 'map-ibut 'ibut:map) +(defalias 'ibut:to-key-src #'hbut:to-key-src) +(defalias 'ibut:key-to-label #'hbut:key-to-label) +(defalias 'ibut:label-to-key #'hbut:label-to-key) +(defalias 'map-ibut #'ibut:map) (defun ibut:map (but-func &optional regexp-match include-delims) "Apply BUT-FUNC to the visible, named implicit buttons. @@ -2214,7 +2224,7 @@ current." t)) (t (error "(ibut:rename): Button '%s' not found in visible portion of buffer." old-lbl)))) -(defalias 'ibut:summarize 'hbut:report) +(defalias 'ibut:summarize #'hbut:report) (defun ibut:to (lbl-key) "Find the nearest implicit button with LBL-KEY (a label or label key). @@ -2424,8 +2434,6 @@ type for ibtype is presently undefined." (htype:create ,type ibtypes ,doc nil ,at-func '(to-p ,to-func style ,style)))))) -(put 'defib 'lisp-indent-function 'defun) - ;; Support edebug-defun for interactive debugging of ibtypes (def-edebug-spec defib (&define name lambda-list diff --git a/hibtypes.el b/hibtypes.el index 68cbeaddee..5535e1d840 100644 --- a/hibtypes.el +++ b/hibtypes.el @@ -349,7 +349,7 @@ in all buffers." (and buffer-file-name (boundp 'hyrolo-file-list) (set:member (current-buffer) - (mapcar 'get-file-buffer hyrolo-file-list))))) + (mapcar #'get-file-buffer hyrolo-file-list))))) (let ((address (mail-address-at-p))) (when address (ibut:label-set address (match-beginning 1) (match-end 1)) @@ -372,11 +372,14 @@ handle any links they recognize first." ;; Prevent infinite recursion, e.g. if called via ;; `org-metareturn-hook' from `org-meta-return' invocation. (not hibtypes--within-org-link-outside-org-mode)) + (require 'hsys-org) + (declare-function hsys-org-link-at-p "hsys-org" ()) + (declare-function hsys-org-set-ibut-label "hsys-org" (start-end)) (let* ((hibtypes--within-org-link-outside-org-mode t) (start-end (hsys-org-link-at-p))) (when start-end (hsys-org-set-ibut-label start-end) - (hact 'org-open-at-point-global))))) + (hact #'org-open-at-point-global))))) ;;; ======================================================================== ;;; Handles internal references within an annotated bibliography, delimiters=[] @@ -999,7 +1002,7 @@ in grep and shell buffers." ;; 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 : - (looking-at "\\([^\t\n\r\"'`]+\\)�� ?\\([1-9][0-9]*\\)[ :]") + (looking-at "\\([^\t\n\r\"'`]+\\)\0 ?\\([1-9][0-9]*\\)[ :]") ;; HP C compiler errors (looking-at "[a-zA-Z0-9]+: \"\\([^\t\n\r\",]+\\)\", line \\([0-9]+\\):") ;; BSO/Tasking 68HC08 C compiler errors diff --git a/set.el b/set.el index 954cd21774..a7dc4a893c 100644 --- a/set.el +++ b/set.el @@ -90,7 +90,7 @@ valid set. With optional ARITY, return only subsets with ARITY members." (cond ((null arity) (setq arity 0) - (cons nil (apply 'nconc (mapcar (lambda (_elt) (setq arity (1+ arity)) (set:combinations set arity)) + (cons nil (apply #'nconc (mapcar (lambda (_elt) (setq arity (1+ arity)) (set:combinations set arity)) set)))) ((= arity 1) set) ((<= arity 0) '(nil)) @@ -120,7 +120,7 @@ for comparison." elements) (nreverse set))))) -(defalias 'set:delete 'set:remove) +(defalias 'set:delete #'set:remove) (defun set:difference (&rest sets) "Return difference of any number of SETS. Difference is the set of elements in the first set that are not in any of the @@ -132,7 +132,7 @@ other sets. Uses `set:equal-op' for comparison." (cdr sets)) rtn-set)) -(defalias 'set:size 'length) +(defalias 'set:size #'length) (defun set:empty (set) "Return t if SET is empty." @@ -170,7 +170,7 @@ Uses `set:equal-op' for comparison." (setq lst (cdr lst)))) (null lst)))) -(defalias 'set:map 'mapcar) +(defalias 'set:map #'mapcar) (defun set:members (list) "Return set of unique elements of LIST.