branch: externals/hyperbole commit 3f33725f7cd0690d3cf5b89630c27075eeef8cc4 Author: Bob Weiner <r...@gnu.org> Commit: Bob Weiner <r...@gnu.org>
Rename hypb-with-suppressed-warnings to hypb:with-suppressed-warnings Also add docstring for this macro in "hypb.el". --- hypb.el | 41 ++++++++++++++++++++++++++++++++++------- hyperbole.el | 6 ++---- kotl/kotl-mode.el | 2 +- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/hypb.el b/hypb.el index 8caa156..c4bad25 100644 --- a/hypb.el +++ b/hypb.el @@ -18,13 +18,6 @@ (eval-and-compile (mapc #'require '(compile hversion hact locate))) -(defmacro hypb-with-suppressed-warnings (spec &rest body) - "Backwards compatibility macro." - (declare (debug (sexp &optional body)) (indent 1)) - (if (fboundp 'with-suppressed-warnings) - `(with-suppressed-warnings ,spec ,@body) - `(with-no-warnings ,@body))) - ;;; ************************************************************************ ;;; Public variables ;;; ************************************************************************ @@ -748,6 +741,40 @@ in the list, even if it is not active. If MINIBUFFER-FLAG is neither t nor nil it means to not count the minibuffer window even if it is active." (window-list nil minibuffer-flag)) +(defmacro hypb:with-suppressed-warnings (warnings &rest body) + "Like `progn', but prevents compiler WARNINGS in BODY. + +Defined here for elpa build compatibility which uses Emacs 26 and +does not include `with-suppressed-warnings'. + +WARNINGS is an associative list where the first element of each +item is a warning type, and the rest of the elements in each item +are symbols they apply to. For instance, if you want to suppress +byte compilation warnings about the two obsolete functions `foo' +and `bar', as well as the function `zot' being called with the +wrong number of parameters, say + +\(with-suppressed-warnings ((obsolete foo bar) + (callargs zot)) + (foo (bar)) + (zot 1 2)) + +The warnings that can be suppressed are a subset of the warnings +in `byte-compile-warning-types'; see the variable +`byte-compile-warnings' for a fuller explanation of the warning +types. The types that can be suppressed with this macro are +`free-vars', `callargs', `redefine', `obsolete', +`interactive-only', `lexical', `mapcar', `constants' and +`suspicious'. + +For the `mapcar' case, only the `mapcar' function can be used in +the symbol list. For `suspicious', only `set-buffer' can be used." + + (declare (debug (sexp &optional body)) (indent 1)) + (if (fboundp 'with-suppressed-warnings) + `(with-suppressed-warnings ,warnings ,@body) + `(with-no-warnings ,@body))) + ;;; ************************************************************************ ;;; About Hyperbole Setup ;;; ************************************************************************ diff --git a/hyperbole.el b/hyperbole.el index 64ddd99..15e02ba 100644 --- a/hyperbole.el +++ b/hyperbole.el @@ -75,8 +75,6 @@ ;;; Start Initializations ;;; ************************************************************************ -(require 'hypb) - (defconst hyperbole-loading t "Temporary constant available for testing while Hyperbole is loading.") @@ -161,7 +159,7 @@ documentation at \"(hyperbole)Top\". ;; Avoid any potential library name conflict by giving the load directory. (require 'set (expand-file-name "set" hyperb:dir)) - +(require 'hypb) (require 'hui-select) ;; This requires 'hvar which defines the var:append function. ;;; ************************************************************************ @@ -426,7 +424,7 @@ The function does NOT recursively descend into subdirectories of the directory or directories specified." ;; Don't use a 'let' on this next line or it will fail. (setq generated-autoload-file output-file) - (hypb-with-suppressed-warnings ((obsolete update-directory-autoloads)) + (hypb:with-suppressed-warnings ((obsolete update-directory-autoloads)) (update-directory-autoloads dir)))) ;; Before the 6.0.1 release, Hyperbole used to patch the package-generate-autoloads diff --git a/kotl/kotl-mode.el b/kotl/kotl-mode.el index 6c87ea7..f9ea587 100644 --- a/kotl/kotl-mode.el +++ b/kotl/kotl-mode.el @@ -168,7 +168,7 @@ It provides the following keys: ;; We have been converting a buffer from a foreign format to a koutline. ;; Now that it is converted, ensure that `kotl-previous-mode' is set to ;; koutline. - (hypb-with-suppressed-warnings ((free-vars kotl-previous-mode)) + (hypb:with-suppressed-warnings ((free-vars kotl-previous-mode)) (setq kotl-previous-mode 'kotl-mode)) ;; Enable Org Table editing minor mode (user can disable via kotl-mode-hook ;; if desired).