diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-03 16:55:15 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-03 16:55:15 +0100 |
| commit | b1d8a7f77d3f47b34fc8c0f43c3470d611a473b3 (patch) | |
| tree | 39a93d34efdbcfff742b3f498a3a38cb28f9d0d0 /compat-macs.el | |
| parent | 7e797daa30329196293d1b69fb40397519db19e5 (diff) | |
Minor simplification, remove advice remnants
Diffstat (limited to 'compat-macs.el')
| -rw-r--r-- | compat-macs.el | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/compat-macs.el b/compat-macs.el index 8c81b4d..f18bb1f 100644 --- a/compat-macs.el +++ b/compat-macs.el @@ -17,8 +17,7 @@ ;;; Commentary: -;; These macros are used to define compatibility functions, macros and -;; advice. +;; These macros are used to define compatibility functions and macros. ;;; Code: @@ -27,8 +26,6 @@ (defmacro compat-declare-version (version) "Set the Emacs version that is currently being handled to VERSION." - ;; FIXME: Avoid setting the version for any definition that might - ;; follow, but try to restrict it to the current file/buffer. (setq compat--current-version version) nil) @@ -153,34 +150,30 @@ attributes (see `compat-generate-common')." name (lambda (realname version) `(,(cond - ((memq type '(func advice)) 'defun) + ((eq type 'function) 'defun) ((eq type 'macro) 'defmacro) ((error "Unknown type"))) ,realname ,arglist ;; Prepend compatibility notice to the actual ;; documentation string. - ,(let ((type (cond - ((eq type 'func) "function") - ((eq type 'macro) "macro") - ((error "Unknown type"))))) - (with-temp-buffer - (insert docstring) - (newline 2) - (insert - "[Compatibility " - (if version - (format - "%s for `%S', defined in Emacs %s. \ + ,(with-temp-buffer + (insert docstring) + (newline 2) + (insert + "[Compatibility " + (if version + (format + "%s for `%S', defined in Emacs %s. \ If this is not documented on your system, you can check \ `(compat) Emacs %s' for more details." - type oldname version version) - (format - "code %s for `%S'" - type oldname)) - "]") - (let ((fill-column 80)) - (fill-region (point-min) (point-max))) - (buffer-string))) + type oldname version version) + (format + "code %s for `%S'" + type oldname)) + "]") + (let ((fill-column 80)) + (fill-region (point-min) (point-max))) + (buffer-string)) ,@body)) (lambda (realname _version) ;; Functions and macros are installed by aliasing the name of the @@ -205,7 +198,7 @@ attribute, is greater than the current Emacs version." [&rest keywordp sexp] def-body)) (doc-string 3) (indent 2)) - (compat--define-function 'func name arglist docstring rest)) + (compat--define-function 'function name arglist docstring rest)) (defmacro compat-defmacro (name arglist docstring &rest rest) "Define NAME with arguments ARGLIST as a compatibility macro. |
