From 0d383b592c2fd1d9b73ebd611d05d80089c7a3a6 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 15 Jun 2022 14:05:07 +0200 Subject: Fix ;;;###autoload scanning from (some) packages * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--parse-file): Fix autoloads scanning from packages. --- lisp/emacs-lisp/loaddefs-gen.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 95666ddb2a0..86c776e3013 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -366,7 +366,11 @@ don't include." ;; We always return the package version (even for pre-dumped ;; files). - (when package-data + (if (not package-data) + ;; We have to switch `emacs-lisp-mode' when scanning + ;; loaddefs for packages so that `syntax-ppss' later gives + ;; correct results. + (emacs-lisp-mode) (let ((version (lm-header "version")) package) (when (and version -- cgit v1.2.3 From 6c3b6149d9e7c882729634dc5a7e647daeecfdf3 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 9 Jun 2022 20:41:50 -0400 Subject: bindat (strz): Write null terminator after variable length string * lisp/emacs-lisp/bindat.el (bindat--pack-strz): Explicitly write a null byte after packing a variable-length string to ensure proper termination when packing to a pre-allocated string. * doc/lispref/processes.texi (Bindat Types): Update documentation. * test/lisp/emacs-lisp/bindat-tests.el (bindat-test--str-strz-prealloc): Update tests. --- doc/lispref/processes.texi | 17 ++++------------- lisp/emacs-lisp/bindat.el | 3 +++ test/lisp/emacs-lisp/bindat-tests.el | 4 ++-- 3 files changed, 9 insertions(+), 15 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 8c8f8fd6b2a..179980c0ed7 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -3495,24 +3495,15 @@ output. @item strz &optional @var{len} If @var{len} is not provided: Variable-length null-terminated unibyte string (@pxref{Text Representations}). When packing, the entire input -string is copied to the packed output. The following byte will be -null (zero) unless a pre-allocated string was provided to -@code{bindat-pack}, in which case that byte is left unmodified. The -length of the packed output is the length of the input string plus one -(for the null terminator). The input string must not contain any null -bytes. If the input string is multibyte with only ASCII and +string is copied to the packed output followed by a null (zero) byte. +The length of the packed output is the length of the input string plus +one (for the null terminator). The input string must not contain any +null bytes. If the input string is multibyte with only ASCII and @code{eight-bit} characters, it is converted to unibyte before it is packed; other multibyte strings signal an error. When unpacking, the resulting string contains all bytes up to (but excluding) the null byte. -@quotation Caution -If a pre-allocated string is provided to @code{bindat-pack}, the -packed output will not be properly null-terminated unless the -pre-allocated string already has a null byte at the appropriate -location. -@end quotation - If @var{len} is provided: @code{strz} behaves the same as @code{str} with one difference: When unpacking, the first null byte encountered in the packed string and all subsequent bytes are excluded from the diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index 9ba89a5e3fe..46e2a4901c3 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el @@ -450,6 +450,9 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." ;; need to scan the input string looking for a null byte. (error "Null byte encountered in input strz string")) (aset bindat-raw (+ bindat-idx i) (aref v i))) + ;; Explicitly write a null terminator in case the user provided a + ;; pre-allocated string to bindat-pack that wasn't zeroed first. + (aset bindat-raw (+ bindat-idx len) 0) (setq bindat-idx (+ bindat-idx len 1)))) (defun bindat--pack-bits (len v) diff --git a/test/lisp/emacs-lisp/bindat-tests.el b/test/lisp/emacs-lisp/bindat-tests.el index 7d1233ded7c..cc223ad14e2 100644 --- a/test/lisp/emacs-lisp/bindat-tests.el +++ b/test/lisp/emacs-lisp/bindat-tests.el @@ -182,8 +182,8 @@ ((((x strz 2)) ((x . "a"))) . "ax") ((((x strz 2)) ((x . "ab"))) . "ab") ((((x strz 2)) ((x . "abc"))) . "ab") - ((,(bindat-type strz) "") . "xx") - ((,(bindat-type strz) "a") . "ax"))) + ((,(bindat-type strz) "") . "\0x") + ((,(bindat-type strz) "a") . "a\0"))) (let ((prealloc (make-string 2 ?x))) (apply #'bindat-pack (append (car tc) (list prealloc))) (should (equal prealloc (cdr tc)))))) -- cgit v1.2.3 From feb654b4605cd84d1913d33a7d4c687bd4e71be7 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 16 Jun 2022 13:49:02 +0200 Subject: Add new package.el commands for recompilation * doc/emacs/package.texi (Package Installation): Document them. * lisp/emacs-lisp/package.el (package-recompile): (package-recompile-all): New commands (bug#27253). --- doc/emacs/package.texi | 10 ++++++++++ etc/NEWS | 5 +++++ lisp/emacs-lisp/package.el | 28 ++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) (limited to 'lisp/emacs-lisp') diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index eb4f5b0edab..2eb12e096a9 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -483,6 +483,16 @@ The default value is just @code{'(all)}. installed will be ignored. The @samp{muse} package will be listed in the package menu with the @samp{held} status. +@findex package-recompile +@findex package-recompile-all + Emacs byte code is quite stable, but it's possible for byte code to +become outdated, or for the compiled files to rely on macros that have +changed in new versions of Emacs. You can use the @kbd{M-x +package-recompile} command to recompile a particular package, or +@kbd{M-x package-recompile-all} to rebuild all the packages. (The +latter command might take quite a while to run if you have many +installed packages.) + @node Package Files @section Package Files and Directory Layout @cindex package directory diff --git a/etc/NEWS b/etc/NEWS index 43b88e6cd4e..e19b2f5ebaf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -982,6 +982,11 @@ list-packages'. *** New command 'package-update-all'. This command allows updating all packages without any queries. ++++ +*** New commands 'package-recompile' and 'package-recompile-all'. +These commands can be useful if the .elc files are out of date +(invalid byte code and macros). + +++ *** New DWIM action on 'x' in "*Packages*" buffer. If no packages are marked, 'x' will install the package under point if diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 9aaeb052d0d..ef46bd3a278 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2422,6 +2422,34 @@ object." 'force 'nosave) (package-install pkg 'dont-select)) +;;;###autoload +(defun package-recompile (pkg) + "Byte-compile package PKG again. +PKG should be either a symbol, the package name, or a `package-desc' +object." + (interactive (list (intern (completing-read + "Recompile package: " + (mapcar #'symbol-name + (mapcar #'car package-alist)))))) + (let ((pkg-desc (if (package-desc-p pkg) + pkg + (cadr (assq pkg package-alist))))) + ;; Delete the old .elc files to ensure that we don't inadvertently + ;; load them (in case they contain byte code/macros that are now + ;; invalid). + (dolist (elc (directory-files (package-desc-dir pkg-desc) t "\\.elc\\'")) + (delete-file elc)) + (package--compile pkg-desc))) + +;;;###autoload +(defun package-recompile-all () + "Byte-compile all installed packages. +This is meant to be used only in the case the byte-compiled files +are invalid due to changed byte-code, macros or the like." + (interactive) + (pcase-dolist (`(_ ,pkg-desc) package-alist) + (package-recompile pkg-desc))) + ;;;###autoload (defun package-autoremove () "Remove packages that are no longer needed. -- cgit v1.2.3 From decb64fd835ef1740d720ff877788eb0626737b5 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 16 Jun 2022 14:25:47 +0200 Subject: Make package-recompile delete all .elc files first * lisp/emacs-lisp/package.el (package-recompile): Delete all .elc files under the package directory. --- lisp/emacs-lisp/package.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index ef46bd3a278..2c43db98993 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2437,7 +2437,8 @@ object." ;; Delete the old .elc files to ensure that we don't inadvertently ;; load them (in case they contain byte code/macros that are now ;; invalid). - (dolist (elc (directory-files (package-desc-dir pkg-desc) t "\\.elc\\'")) + (dolist (elc (directory-files-recursively + (package-desc-dir pkg-desc) "\\.elc\\'")) (delete-file elc)) (package--compile pkg-desc))) -- cgit v1.2.3 From d671cd57c488ec792997fd4051440187dec3434f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 17 Jun 2022 16:48:02 +0200 Subject: Update cl-struct-sequence-type doc string * lisp/emacs-lisp/cl-macs.el (cl-struct-sequence-type): Fix doc string to reflect what it does (bug#46523). --- lisp/emacs-lisp/cl-macs.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index c27a43f3baf..85ebcaade71 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3288,8 +3288,9 @@ the form NAME which is a shorthand for (NAME NAME)." (defun cl-struct-sequence-type (struct-type) "Return the sequence used to build STRUCT-TYPE. -STRUCT-TYPE is a symbol naming a struct type. Return `record', -`vector', or `list' if STRUCT-TYPE is a struct type, nil otherwise." +STRUCT-TYPE is a symbol naming a struct type. Return values are +either `vector', `list' or nil (and the latter indicates a +`record' struct type." (declare (side-effect-free t) (pure t)) (cl--struct-class-type (cl--struct-get-class struct-type))) -- cgit v1.2.3 From 73e75e18d170826e1838324d39ac0698948071f8 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Fri, 17 Jun 2022 17:06:05 +0200 Subject: Warn about misplaced or duplicated function/macro declarations Doc strings, `declare` and `interactive` forms must appear in that order and at most once each. Complain if they don't, instead of silently ignoring the problem (bug#55905). * lisp/emacs-lisp/byte-run.el (byte-run--parse-body) (byte-run--parse-declarations): New. (defmacro, defun): Check for declaration well-formedness as described above. Clarify doc strings. Refactor some common code. * test/lisp/emacs-lisp/bytecomp-resources/fun-attr-warn.el: * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-fun-attr-warn): New test. --- lisp/emacs-lisp/byte-run.el | 208 +++++++++------- .../emacs-lisp/bytecomp-resources/fun-attr-warn.el | 266 +++++++++++++++++++++ test/lisp/emacs-lisp/bytecomp-tests.el | 63 +++++ 3 files changed, 446 insertions(+), 91 deletions(-) create mode 100644 test/lisp/emacs-lisp/bytecomp-resources/fun-attr-warn.el (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 92c2699c6e3..17c15549666 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -272,6 +272,75 @@ This is used by `declare'.") (list 'function-put (list 'quote name) ''no-font-lock-keyword (list 'quote val)))) +(defalias 'byte-run--parse-body + #'(lambda (body allow-interactive) + "Decompose BODY into (DOCSTRING DECLARE INTERACTIVE BODY-REST WARNINGS)." + (let* ((top body) + (docstring nil) + (declare-form nil) + (interactive-form nil) + (warnings nil) + (warn #'(lambda (msg form) + (push (macroexp-warn-and-return msg nil nil t form) + warnings)))) + (while + (and body + (let* ((form (car body)) + (head (car-safe form))) + (cond + ((or (and (stringp form) (cdr body)) + (eq head :documentation)) + (cond + (docstring (funcall warn "More than one doc string" top)) + (declare-form + (funcall warn "Doc string after `declare'" declare-form)) + (interactive-form + (funcall warn "Doc string after `interactive'" + interactive-form)) + (t (setq docstring form))) + t) + ((eq head 'declare) + (cond + (declare-form + (funcall warn "More than one `declare' form" form)) + (interactive-form + (funcall warn "`declare' after `interactive'" form)) + (t (setq declare-form form))) + t) + ((eq head 'interactive) + (cond + ((not allow-interactive) + (funcall warn "No `interactive' form allowed here" form)) + (interactive-form + (funcall warn "More than one `interactive' form" form)) + (t (setq interactive-form form))) + t)))) + (setq body (cdr body))) + (list docstring declare-form interactive-form body warnings)))) + +(defalias 'byte-run--parse-declarations + #'(lambda (name arglist clauses construct declarations-alist) + (let* ((cl-decls nil) + (actions + (mapcar + #'(lambda (x) + (let ((f (cdr (assq (car x) declarations-alist)))) + (cond + (f (apply (car f) name arglist (cdr x))) + ;; Yuck!! + ((and (featurep 'cl) + (memq (car x) ;C.f. cl--do-proclaim. + '(special inline notinline optimize warn))) + (push (list 'declare x) cl-decls) + nil) + (t + (macroexp-warn-and-return + (format-message "Unknown %s property `%S'" + construct (car x)) + nil nil nil (car x)))))) + clauses))) + (cons actions cl-decls)))) + (defvar macro-declarations-alist (cons (list 'debug #'byte-run--set-debug) @@ -289,7 +358,7 @@ This is used by `declare'.") (defalias 'defmacro (cons 'macro - #'(lambda (name arglist &optional docstring &rest body) + #'(lambda (name arglist &rest body) "Define NAME as a macro. When the macro is called, as in (NAME ARGS...), the function (lambda ARGLIST BODY...) is applied to @@ -300,116 +369,73 @@ DECLS is a list of elements of the form (PROP . VALUES). These are interpreted according to `macro-declarations-alist'. The return value is undefined. -\(fn NAME ARGLIST &optional DOCSTRING DECL &rest BODY)" - ;; We can't just have `decl' as an &optional argument, because we need - ;; to distinguish - ;; (defmacro foo (arg) (bar) nil) - ;; from - ;; (defmacro foo (arg) (bar)). - (let ((decls (cond - ((eq (car-safe docstring) 'declare) - (prog1 (cdr docstring) (setq docstring nil))) - ((and (stringp docstring) - (eq (car-safe (car body)) 'declare)) - (prog1 (cdr (car body)) (setq body (cdr body))))))) - (if docstring (setq body (cons docstring body)) - (if (null body) (setq body '(nil)))) - ;; Can't use backquote because it's not defined yet! - (let* ((fun (list 'function (cons 'lambda (cons arglist body)))) - (def (list 'defalias - (list 'quote name) - (list 'cons ''macro fun))) - (declarations - (mapcar - #'(lambda (x) - (let ((f (cdr (assq (car x) macro-declarations-alist)))) - (if f (apply (car f) name arglist (cdr x)) - (macroexp-warn-and-return - (format-message - "Unknown macro property %S in %S" - (car x) name) - nil nil nil (car x))))) - decls))) - ;; Refresh font-lock if this is a new macro, or it is an - ;; existing macro whose 'no-font-lock-keyword declaration - ;; has changed. - (if (and - ;; If lisp-mode hasn't been loaded, there's no reason - ;; to flush. - (fboundp 'lisp--el-font-lock-flush-elisp-buffers) - (or (not (fboundp name)) ;; new macro - (and (fboundp name) ;; existing macro - (member `(function-put ',name 'no-font-lock-keyword - ',(get name 'no-font-lock-keyword)) - declarations)))) - (lisp--el-font-lock-flush-elisp-buffers)) - (if declarations - (cons 'prog1 (cons def declarations)) +\(fn NAME ARGLIST [DOCSTRING] [DECL] BODY...)" + (let* ((parse (byte-run--parse-body body nil)) + (docstring (nth 0 parse)) + (declare-form (nth 1 parse)) + (body (nth 3 parse)) + (warnings (nth 4 parse)) + (declarations + (and declare-form (byte-run--parse-declarations + name arglist (cdr declare-form) 'macro + macro-declarations-alist)))) + (setq body (nconc warnings body)) + (setq body (nconc (cdr declarations) body)) + (if docstring + (setq body (cons docstring body))) + (if (null body) + (setq body '(nil))) + (let* ((fun (list 'function (cons 'lambda (cons arglist body)))) + (def (list 'defalias + (list 'quote name) + (list 'cons ''macro fun)))) + (if declarations + (cons 'prog1 (cons def (car declarations))) def)))))) ;; Now that we defined defmacro we can use it! -(defmacro defun (name arglist &optional docstring &rest body) +(defmacro defun (name arglist &rest body) "Define NAME as a function. -The definition is (lambda ARGLIST [DOCSTRING] BODY...). -See also the function `interactive'. +The definition is (lambda ARGLIST [DOCSTRING] [INTERACTIVE] BODY...). DECL is a declaration, optional, of the form (declare DECLS...) where DECLS is a list of elements of the form (PROP . VALUES). These are interpreted according to `defun-declarations-alist'. +INTERACTIVE is an optional `interactive' specification. The return value is undefined. -\(fn NAME ARGLIST &optional DOCSTRING DECL &rest BODY)" - ;; We can't just have `decl' as an &optional argument, because we need - ;; to distinguish - ;; (defun foo (arg) (toto) nil) - ;; from - ;; (defun foo (arg) (toto)). +\(fn NAME ARGLIST [DOCSTRING] [DECL] [INTERACTIVE] BODY...)" (declare (doc-string 3) (indent 2)) (or name (error "Cannot define '%s' as a function" name)) (if (null (and (listp arglist) (null (delq t (mapcar #'symbolp arglist))))) (error "Malformed arglist: %s" arglist)) - (let ((decls (cond - ((eq (car-safe docstring) 'declare) - (prog1 (cdr docstring) (setq docstring nil))) - ((and (stringp docstring) - (eq (car-safe (car body)) 'declare)) - (prog1 (cdr (car body)) (setq body (cdr body))))))) - (if docstring (setq body (cons docstring body)) - (if (null body) (setq body '(nil)))) - (let ((declarations - (mapcar - #'(lambda (x) - (let ((f (cdr (assq (car x) defun-declarations-alist)))) - (cond - (f (apply (car f) name arglist (cdr x))) - ;; Yuck!! - ((and (featurep 'cl) - (memq (car x) ;C.f. cl-do-proclaim. - '(special inline notinline optimize warn))) - (push (list 'declare x) - (if (stringp docstring) - (if (eq (car-safe (cadr body)) 'interactive) - (cddr body) - (cdr body)) - (if (eq (car-safe (car body)) 'interactive) - (cdr body) - body))) - nil) - (t - (macroexp-warn-and-return - (format-message "Unknown defun property `%S' in %S" - (car x) name) - nil nil nil (car x)))))) - decls)) - (def (list 'defalias + (let* ((parse (byte-run--parse-body body t)) + (docstring (nth 0 parse)) + (declare-form (nth 1 parse)) + (interactive-form (nth 2 parse)) + (body (nth 3 parse)) + (warnings (nth 4 parse)) + (declarations + (and declare-form (byte-run--parse-declarations + name arglist (cdr declare-form) 'defun + defun-declarations-alist)))) + (setq body (nconc warnings body)) + (setq body (nconc (cdr declarations) body)) + (if interactive-form + (setq body (cons interactive-form body))) + (if docstring + (setq body (cons docstring body))) + (if (null body) + (setq body '(nil))) + (let ((def (list 'defalias (list 'quote name) (list 'function (cons 'lambda (cons arglist body)))))) (if declarations - (cons 'prog1 (cons def declarations)) - def)))) + (cons 'prog1 (cons def (car declarations))) + def)))) ;; Redefined in byte-opt.el. diff --git a/test/lisp/emacs-lisp/bytecomp-resources/fun-attr-warn.el b/test/lisp/emacs-lisp/bytecomp-resources/fun-attr-warn.el new file mode 100644 index 00000000000..be907b32f47 --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/fun-attr-warn.el @@ -0,0 +1,266 @@ +;;; -*- lexical-binding: t -*- + +;; Correct + +(defun faw-str-decl-code (x) + "something" + (declare (pure t)) + (print x)) + +(defun faw-doc-decl-code (x) + (:documentation "something") + (declare (pure t)) + (print x)) + +(defun faw-str-int-code (x) + "something" + (interactive "P") + (print x)) + +(defun faw-doc-int-code (x) + (:documentation "something") + (interactive "P") + (print x)) + +(defun faw-decl-int-code (x) + (declare (pure t)) + (interactive "P") + (print x)) + +(defun faw-str-decl-int-code (x) + "something" + (declare (pure t)) + (interactive "P") + (print x)) + +(defun faw-doc-decl-int-code (x) + (:documentation "something") + (declare (pure t)) + (interactive "P") + (print x)) + + +;; Correct (last string is return value) + +(defun faw-str () + "something") + +(defun faw-decl-str () + (declare (pure t)) + "something") + +(defun faw-decl-int-str () + (declare (pure t)) + (interactive) + "something") + +(defun faw-str-str () + "something" + "something else") + +(defun faw-doc-str () + (:documentation "something") + "something else") + + +;; Incorrect (bad order) + +(defun faw-int-decl-code (x) + (interactive "P") + (declare (pure t)) + (print x)) + +(defun faw-int-str-code (x) + (interactive "P") + "something" + (print x)) + +(defun faw-int-doc-code (x) + (interactive "P") + (:documentation "something") + (print x)) + +(defun faw-decl-str-code (x) + (declare (pure t)) + "something" + (print x)) + +(defun faw-decl-doc-code (x) + (declare (pure t)) + (:documentation "something") + (print x)) + +(defun faw-str-int-decl-code (x) + "something" + (interactive "P") + (declare (pure t)) + (print x)) + +(defun faw-doc-int-decl-code (x) + (:documentation "something") + (interactive "P") + (declare (pure t)) + (print x)) + +(defun faw-int-str-decl-code (x) + (interactive "P") + "something" + (declare (pure t)) + (print x)) + +(defun faw-int-doc-decl-code (x) + (interactive "P") + (:documentation "something") + (declare (pure t)) + (print x)) + +(defun faw-int-decl-str-code (x) + (interactive "P") + (declare (pure t)) + "something" + (print x)) + +(defun faw-int-decl-doc-code (x) + (interactive "P") + (declare (pure t)) + (:documentation "something") + (print x)) + +(defun faw-decl-int-str-code (x) + (declare (pure t)) + (interactive "P") + "something" + (print x)) + +(defun faw-decl-int-doc-code (x) + (declare (pure t)) + (interactive "P") + (:documentation "something") + (print x)) + +(defun faw-decl-str-int-code (x) + (declare (pure t)) + "something" + (interactive "P") + (print x)) + +(defun faw-decl-doc-int-code (x) + (declare (pure t)) + (:documentation "something") + (interactive "P") + (print x)) + + +;; Incorrect (duplication) + +(defun faw-str-str-decl-int-code (x) + "something" + "something else" + (declare (pure t)) + (interactive "P") + (print x)) + +(defun faw-str-doc-decl-int-code (x) + "something" + (:documentation "something else") + (declare (pure t)) + (interactive "P") + (print x)) + +(defun faw-doc-str-decl-int-code (x) + (:documentation "something") + "something else" + (declare (pure t)) + (interactive "P") + (print x)) + +(defun faw-doc-doc-decl-int-code (x) + (:documentation "something") + (:documentation "something else") + (declare (pure t)) + (interactive "P") + (print x)) + +(defun faw-str-decl-str-int-code (x) + "something" + (declare (pure t)) + "something else" + (interactive "P") + (print x)) + +(defun faw-doc-decl-str-int-code (x) + (:documentation "something") + (declare (pure t)) + "something else" + (interactive "P") + (print x)) + +(defun faw-str-decl-doc-int-code (x) + "something" + (declare (pure t)) + (:documentation "something else") + (interactive "P") + (print x)) + +(defun faw-doc-decl-doc-int-code (x) + (:documentation "something") + (declare (pure t)) + (:documentation "something else") + (interactive "P") + (print x)) + +(defun faw-str-decl-decl-int-code (x) + "something" + (declare (pure t)) + (declare (indent 1)) + (interactive "P") + (print x)) + +(defun faw-doc-decl-decl-int-code (x) + (:documentation "something") + (declare (pure t)) + (declare (indent 1)) + (interactive "P") + (print x)) + +(defun faw-str-decl-int-decl-code (x) + "something" + (declare (pure t)) + (interactive "P") + (declare (indent 1)) + (print x)) + +(defun faw-doc-decl-int-decl-code (x) + (:documentation "something") + (declare (pure t)) + (interactive "P") + (declare (indent 1)) + (print x)) + +(defun faw-str-decl-int-int-code (x) + "something" + (declare (pure t)) + (interactive "P") + (interactive "p") + (print x)) + +(defun faw-doc-decl-int-int-code (x) + (:documentation "something") + (declare (pure t)) + (interactive "P") + (interactive "p") + (print x)) + +(defun faw-str-int-decl-int-code (x) + "something" + (interactive "P") + (declare (pure t)) + (interactive "p") + (print x)) + +(defun faw-doc-int-decl-int-code (x) + (:documentation "something") + (interactive "P") + (declare (pure t)) + (interactive "p") + (print x)) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 9abc17a1c41..fbc00b30c54 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -1580,6 +1580,69 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \ (should (equal (get fname 'lisp-indent-function) 1)) (should (equal (aref bc 4) "tata\n\n(fn X)"))))) +(ert-deftest bytecomp-fun-attr-warn () + ;; Check that warnings are emitted when doc strings, `declare' and + ;; `interactive' forms don't come in the proper order, or more than once. + (let* ((filename "fun-attr-warn.el") + (el (ert-resource-file filename)) + (elc (concat el "c")) + (text-quoting-style 'grave)) + (with-current-buffer (get-buffer-create "*Compile-Log*") + (let ((inhibit-read-only t)) + (erase-buffer)) + (byte-compile-file el) + (let ((expected + '("70:4: Warning: `declare' after `interactive'" + "74:4: Warning: Doc string after `interactive'" + "79:4: Warning: Doc string after `interactive'" + "84:4: Warning: Doc string after `declare'" + "89:4: Warning: Doc string after `declare'" + "96:4: Warning: `declare' after `interactive'" + "102:4: Warning: `declare' after `interactive'" + "108:4: Warning: `declare' after `interactive'" + "106:4: Warning: Doc string after `interactive'" + "114:4: Warning: `declare' after `interactive'" + "112:4: Warning: Doc string after `interactive'" + "118:4: Warning: Doc string after `interactive'" + "119:4: Warning: `declare' after `interactive'" + "124:4: Warning: Doc string after `interactive'" + "125:4: Warning: `declare' after `interactive'" + "130:4: Warning: Doc string after `declare'" + "136:4: Warning: Doc string after `declare'" + "142:4: Warning: Doc string after `declare'" + "148:4: Warning: Doc string after `declare'" + "159:4: Warning: More than one doc string" + "165:4: Warning: More than one doc string" + "171:4: Warning: More than one doc string" + "178:4: Warning: More than one doc string" + "186:4: Warning: More than one doc string" + "192:4: Warning: More than one doc string" + "200:4: Warning: More than one doc string" + "206:4: Warning: More than one doc string" + "215:4: Warning: More than one `declare' form" + "222:4: Warning: More than one `declare' form" + "230:4: Warning: More than one `declare' form" + "237:4: Warning: More than one `declare' form" + "244:4: Warning: More than one `interactive' form" + "251:4: Warning: More than one `interactive' form" + "258:4: Warning: More than one `interactive' form" + "257:4: Warning: `declare' after `interactive'" + "265:4: Warning: More than one `interactive' form" + "264:4: Warning: `declare' after `interactive'"))) + (goto-char (point-min)) + (let ((actual nil)) + (while (re-search-forward + (rx bol (* (not ":")) ":" + (group (+ digit) ":" (+ digit) ": Warning: " + (or "More than one " (+ nonl) " form" + (: (+ nonl) " after " (+ nonl)))) + eol) + nil t) + (push (match-string 1) actual)) + (setq actual (nreverse actual)) + (should (equal actual expected))))))) + + ;; Local Variables: ;; no-byte-compile: t ;; End: -- cgit v1.2.3 From a53c34d76a09cd6519d2d176b76d4b820bc26a51 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 17 Jun 2022 18:12:38 +0200 Subject: Don't quote the `when' form in obsoletions * lisp/emacs-lisp/byte-run.el (byte-run--set-obsolete): The `when' is a string (or nil), so don't quote it (bug#48145). * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--print-form): Adjust folding. --- lisp/emacs-lisp/byte-run.el | 2 +- lisp/emacs-lisp/loaddefs-gen.el | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 17c15549666..498435c58d0 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -166,7 +166,7 @@ The return value of this function is not used." (defalias 'byte-run--set-obsolete #'(lambda (f _args new-name when) (list 'make-obsolete - (list 'quote f) (list 'quote new-name) (list 'quote when)))) + (list 'quote f) (list 'quote new-name) when))) (defalias 'byte-run--set-interactive-only #'(lambda (f _args instead) diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 86c776e3013..a686de406ab 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -633,6 +633,7 @@ If GENERATE-FULL, don't update, but regenerate all the loaddefs files." "Print DEF in the way make-docfile.c expects it." (if (or (not (consp def)) (not (symbolp (car def))) + (eq (car def) 'make-obsolete) (not (stringp (nth 3 def)))) (prin1 def (current-buffer) t) ;; The salient point here is that we have to have the doc string -- cgit v1.2.3 From f515d658e5e5382bfbcf835dee4a32099c9815e6 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 17 Jun 2022 19:10:44 +0200 Subject: Don't quote numbers in byte-run--set-* * lisp/emacs-lisp/byte-run.el (byte-run--set-doc-string) (byte-run--set-indent): Don't quote numbers (bug#48145). --- lisp/emacs-lisp/byte-run.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 498435c58d0..dd90bcf4d82 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -210,12 +210,16 @@ The return value of this function is not used." (defalias 'byte-run--set-doc-string #'(lambda (f _args pos) (list 'function-put (list 'quote f) - ''doc-string-elt (list 'quote pos)))) + ''doc-string-elt (if (numberp pos) + pos + (list 'quote pos))))) (defalias 'byte-run--set-indent #'(lambda (f _args val) (list 'function-put (list 'quote f) - ''lisp-indent-function (list 'quote val)))) + ''lisp-indent-function (if (numberp val) + val + (list 'quote val))))) (defalias 'byte-run--set-speed #'(lambda (f _args val) -- cgit v1.2.3 From 4311bd0bd73c17b883d3f88eab4928a44d056a3a Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Fri, 17 Jun 2022 19:13:33 +0200 Subject: Slightly faster hash-table-keys and hash-table-values * lisp/emacs-lisp/subr-x.el (hash-table-keys, hash-table-values): Omit the reversal of the returned list. It is not ordered anyway. * test/lisp/emacs-lisp/subr-x-tests.el (subr-x--hash-table-keys-and-values): New test. --- lisp/emacs-lisp/subr-x.el | 8 ++++++-- test/lisp/emacs-lisp/subr-x-tests.el | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 9cd793d05c5..5c3dff62c8a 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -87,11 +87,15 @@ threading." (defsubst hash-table-keys (hash-table) "Return a list of keys in HASH-TABLE." - (cl-loop for k being the hash-keys of hash-table collect k)) + (let ((keys nil)) + (maphash (lambda (k _) (push k keys)) hash-table) + keys)) (defsubst hash-table-values (hash-table) "Return a list of values in HASH-TABLE." - (cl-loop for v being the hash-values of hash-table collect v)) + (let ((values nil)) + (maphash (lambda (_ v) (push v values)) hash-table) + values)) (defsubst string-empty-p (string) "Check whether STRING is empty." diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index 7f3916c2c0b..0bec9db36e9 100644 --- a/test/lisp/emacs-lisp/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el @@ -743,6 +743,13 @@ (with-current-buffer inner (should-not (buffer-modified-p)))))))) +(ert-deftest subr-x--hash-table-keys-and-values () + (let ((h (make-hash-table))) + (puthash 'a 1 h) + (puthash 'c 3 h) + (puthash 'b 2 h) + (should (equal (sort (hash-table-keys h) #'string<) '(a b c))) + (should (equal (sort (hash-table-values h) #'<) '(1 2 3))))) (provide 'subr-x-tests) ;;; subr-x-tests.el ends here -- cgit v1.2.3 From 0d103e6f79d374766b64e56fb05e440076f4df5c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 18 Jun 2022 00:17:40 +0200 Subject: Extend 'e' in edebug to pretty-print the values * doc/lispref/edebug.texi (Edebug Eval): Document it. * lisp/emacs-lisp/edebug.el (edebug-eval-expression): Allow displaying the full value in a different buffer. --- doc/lispref/edebug.texi | 6 +++++- etc/NEWS | 3 +++ lisp/emacs-lisp/edebug.el | 54 +++++++++++++++++++++++++++++------------------ 3 files changed, 42 insertions(+), 21 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi index 0fc5271d5ad..377cd21da86 100644 --- a/doc/lispref/edebug.texi +++ b/doc/lispref/edebug.texi @@ -701,7 +701,11 @@ on this process. @item e @var{exp} @key{RET} Evaluate expression @var{exp} in the context outside of Edebug (@code{edebug-eval-expression}). That is, Edebug tries to minimize -its interference with the evaluation. By default, this command +its interference with the evaluation. The result is shown in the echo +area, or, if this command is given a prefix, pop up a new buffer and +pretty-print the result there. + +By default, this command suppresses the debugger during evaluation, so that an error in the evaluated expression won't add a new error on top of the existing one. Set the @code{debug-allow-recursive-debug} user option to a diff --git a/etc/NEWS b/etc/NEWS index b9a22617353..d18af0502d2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1019,6 +1019,9 @@ buffer or while edebugging) and 'C-x C-e' (while edebugging) commands lead to a (further) backtrace. By default, this variable is nil, which is a change in behaviour from previous Emacs versions. ++++ +*** 'e' in edebug can now take a prefix to pretty-print the results. + ** Compile +++ diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 9dc5a1315e5..58cfd47abdf 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -3707,30 +3707,44 @@ Return the result of the last expression." (defalias 'edebug-format #'format-message) (defalias 'edebug-message #'message) -(defun edebug-eval-expression (expr) +(defun edebug-eval-expression (expr &optional pp) "Evaluate an expression in the outside environment. If interactive, prompt for the expression. -Print result in minibuffer." - (interactive (list (read--expression "Eval: "))) + +Print result in minibuffer by default, but if PP is non-nil open +a new window and pretty-print the result there. (Interactively, +this is the prefix key.)" + (interactive (list (read--expression "Edebug eval: ") + current-prefix-arg)) (let* ((errored nil) - (result + (value (edebug-outside-excursion - (let ((result (if debug-allow-recursive-debug - (edebug-eval expr) - (condition-case err - (edebug-eval expr) - (error - (setq errored - (format "%s: %s" - (get (car err) 'error-message) - (car (cdr err))))))))) - (unless errored - (values--store-value result) - (concat (edebug-safe-prin1-to-string result) - (eval-expression-print-format result))))))) - (if errored - (message "Error: %s" errored) - (princ result)))) + (if debug-allow-recursive-debug + (edebug-eval expr) + (condition-case err + (edebug-eval expr) + (error + (setq errored + (format "%s: %s" + (get (car err) 'error-message) + (car (cdr err))))))))) + (result + (unless errored + (values--store-value value) + (concat (edebug-safe-prin1-to-string value) + (eval-expression-print-format value))))) + (cond + (errored + (message "Error: %s" errored)) + (pp + (save-selected-window + (pop-to-buffer "*Edebug Results*") + (erase-buffer) + (pp value (current-buffer)) + (goto-char (point-min)) + (lisp-data-mode))) + (t + (princ result))))) (defun edebug-eval-last-sexp (&optional no-truncate) "Evaluate sexp before point in the outside environment. -- cgit v1.2.3 From 606275e91ec57cccabeb4ac2feb93753f734cb00 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 18 Jun 2022 13:26:14 +0200 Subject: Allow pretty-printing results from `C-x C-e' in edebug * doc/lispref/edebug.texi (Edebug Eval): Document it. * lisp/emacs-lisp/edebug.el (edebug-eval-expression): Allow displaying the full value in a different buffer. --- doc/lispref/edebug.texi | 3 ++- etc/NEWS | 6 ++++++ lisp/emacs-lisp/edebug.el | 28 ++++++++++++++++------------ 3 files changed, 24 insertions(+), 13 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi index 377cd21da86..622578bcf1c 100644 --- a/doc/lispref/edebug.texi +++ b/doc/lispref/edebug.texi @@ -719,7 +719,8 @@ Evaluate expression @var{exp} in the context of Edebug itself Evaluate the expression before point, in the context outside of Edebug (@code{edebug-eval-last-sexp}). With the prefix argument of zero (@kbd{C-u 0 C-x C-e}), don't shorten long items (like strings and -lists). +lists). Any other prefix will result in the value being +pretty-printed in a separate buffer. @end table @cindex lexical binding (Edebug) diff --git a/etc/NEWS b/etc/NEWS index f195a721f4d..a9c8957dfbb 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1030,6 +1030,12 @@ which is a change in behaviour from previous Emacs versions. When invoked with a prefix argument, as in 'C-u e', this command will pop up a new buffer and show the full pretty-printed value there. ++++ +*** 'C-x C-e' now interprets a non-zero prefix arg to pretty-print the results. +When invoked with a non-zero prefix argument, as in 'C-u C-x C-e', +this command will pop up a new buffer and show the full pretty-printed +value there. + ** Compile +++ diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 58cfd47abdf..ad66cfc2b81 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -3746,21 +3746,25 @@ this is the prefix key.)" (t (princ result))))) -(defun edebug-eval-last-sexp (&optional no-truncate) +(defun edebug-eval-last-sexp (&optional display-type) "Evaluate sexp before point in the outside environment. -Print value in minibuffer. - -If NO-TRUNCATE is non-nil (or interactively with a prefix -argument of zero), show the full length of the expression, not -limited by `edebug-print-length' or `edebug-print-level'." +If DISPLAY-TYPE is `pretty-print' (interactively, a non-zero +prefix argument), pretty-print the value in a separate buffer. +Otherwise, print the value in minibuffer. If DISPLAY-TYPE is any +other non-nil value (or interactively with a prefix argument of +zero), show the full length of the expression, not limited by +`edebug-print-length' or `edebug-print-level'." (interactive (list (and current-prefix-arg - (zerop (prefix-numeric-value current-prefix-arg))))) - (if no-truncate - (let ((edebug-print-length nil) - (edebug-print-level nil)) - (edebug-eval-expression (edebug-last-sexp))) - (edebug-eval-expression (edebug-last-sexp)))) + (if (zerop (prefix-numeric-value current-prefix-arg)) + 'no-truncate + 'pretty-print)))) + (if (or (null display-type) + (eq display-type 'pretty-print)) + (edebug-eval-expression (edebug-last-sexp) display-type) + (let ((edebug-print-length nil) + (edebug-print-level nil)) + (edebug-eval-expression (edebug-last-sexp))))) (defun edebug-eval-print-last-sexp (&optional no-truncate) "Evaluate sexp before point in outside environment; insert value. -- cgit v1.2.3 From 422f958030f1c105c8f62f670b82875559b38e69 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 18 Jun 2022 14:11:01 +0200 Subject: Fix invalid defcustom :group when :predicate is used * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix invalid `:group' argument for the `-modes' defcustom that is created when `:predicate' is used (bug#56049). --- lisp/emacs-lisp/easy-mmode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 1d93fe48014..df379035038 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -555,7 +555,7 @@ and nil means \"don't use\". There's an implicit nil at the end of the list." mode) :type '(repeat sexp) - :group ,group)) + ,@group)) ;; Autoloading define-globalized-minor-mode autoloads everything ;; up-to-here. -- cgit v1.2.3 From 608f349cd29e9754279d963e33e19eb46b849882 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 18 Jun 2022 14:17:45 +0200 Subject: Fix checkdoc--fix-y-or-n-p query * lisp/emacs-lisp/checkdoc.el (checkdoc--fix-y-or-n-p): Fix the query to match what's done (bug#56053). --- lisp/emacs-lisp/checkdoc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 5700afbb03e..7ae01d03b04 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -2628,7 +2628,7 @@ a space as a style error." (checkdoc-autofix-ask-replace (match-beginning 0) (match-end 0) (format-message - "`y-or-n-p' argument should end with \"? \". Fix?") + "`y-or-n-p' argument should end with \"?\". Fix?") "?\"" t)) nil (checkdoc-create-error -- cgit v1.2.3 From 2ebe0524e823c2b811f484bd4df977df5fa49203 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Sat, 18 Jun 2022 15:15:57 +0200 Subject: More aggressive bytecode split between top-level forms (bug#55972) * lisp/emacs-lisp/bytecomp.el (byte-compile-keep-pending): Allow bytecode split between all kinds of top-level forms, not just those with chunk handlers, to prevent individual chunks from growing too large. In particular this helps compilation of package-quickstart.el. --- lisp/emacs-lisp/bytecomp.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index d28ec0be16d..7f408472da1 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2521,13 +2521,12 @@ list that represents a doc string reference. (defun byte-compile-keep-pending (form &optional handler) (if (memq byte-optimize '(t source)) (setq form (byte-optimize-one-form form t))) + ;; To avoid consing up monstrously large forms at load time, we split + ;; the output regularly. + (when (nthcdr 300 byte-compile-output) + (byte-compile-flush-pending)) (if handler (let ((byte-compile--for-effect t)) - ;; To avoid consing up monstrously large forms at load time, we split - ;; the output regularly. - (and (memq (car-safe form) '(fset defalias)) - (nthcdr 300 byte-compile-output) - (byte-compile-flush-pending)) (funcall handler form) (if byte-compile--for-effect (byte-compile-discard))) -- cgit v1.2.3 From 93b018c664e1f95b41d0239c651a79a237edfc38 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 19 Jun 2022 13:37:10 +0200 Subject: Add mechanism for gradually phasing in new byte compilation warnings * lisp/Makefile.in (BYTE_COMPILE_FLAGS): Enable all byte compilation warnings. * lisp/emacs-lisp/bytecomp.el (byte-compile-warning-types): Add docstrings-non-ascii-quotes and document new semantics for `all' and t. (byte-compile--emacs-build-warning-types): New constant. (byte-compile-warning-enabled-p): Implement the new semantics. (byte-compile-docstring-style-warn): Reinstate the Unicode quote warning. --- lisp/Makefile.in | 3 ++- lisp/emacs-lisp/bytecomp.el | 41 +++++++++++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 9 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 8728467977a..9516f2fc364 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -67,7 +67,8 @@ AUTOGENEL = ${loaddefs} ${srcdir}/cus-load.el ${srcdir}/finder-inf.el \ # Set load-prefer-newer for the benefit of the non-bootstrappers. BYTE_COMPILE_FLAGS = \ - --eval '(setq load-prefer-newer t)' $(BYTE_COMPILE_EXTRA_FLAGS) + --eval "(setq load-prefer-newer t byte-compile-warnings 'all)" \ + $(BYTE_COMPILE_EXTRA_FLAGS) # ... but we must prefer .elc files for those in the early bootstrap. # A larger `max-specpdl-size' is needed for emacs-lisp/comp.el. compile-first: BYTE_COMPILE_FLAGS = \ diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 7f408472da1..2ae9aa13bb6 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -299,10 +299,10 @@ The information is logged to `byte-compile-log-buffer'." '(redefine callargs free-vars unresolved obsolete noruntime interactive-only make-local mapcar constants suspicious lexical lexical-dynamic - docstrings not-unused) + docstrings docstrings-non-ascii-quotes not-unused) "The list of warning types used when `byte-compile-warnings' is t.") (defcustom byte-compile-warnings t - "List of warnings that the byte-compiler should issue (t for all). + "List of warnings that the byte-compiler should issue (t for almost all). Elements of the list may be: @@ -327,15 +327,28 @@ Elements of the list may be: `byte-compile-docstring-max-column' or `fill-column' characters, whichever is bigger) or have other stylistic issues. + docstrings-non-ascii-quotes docstrings that have non-ASCII quotes. + This depends on the `docstrings' warning type. suspicious constructs that usually don't do what the coder wanted. If the list begins with `not', then the remaining elements specify warnings to -suppress. For example, (not mapcar) will suppress warnings about mapcar." +suppress. For example, (not mapcar) will suppress warnings about mapcar. + +The t value means \"all non experimental warning types\", and +excludes the types in `byte-compile--emacs-build-warning-types'. +A value of `all' really means all." :type `(choice (const :tag "All" t) (set :menu-tag "Some" ,@(mapcar (lambda (x) `(const ,x)) byte-compile-warning-types)))) +(defconst byte-compile--emacs-build-warning-types + '(docstrings-non-ascii-quotes) + "List of warning types that are only enabled during Emacs builds. +This is typically either warning types that are being phased in +(but shouldn't be enabled for packages yet), or that are only relevant +for the Emacs build itself.") + (defvar byte-compile--suppressed-warnings nil "Dynamically bound by `with-suppressed-warnings' to suppress warnings.") @@ -354,10 +367,15 @@ suppress. For example, (not mapcar) will suppress warnings about mapcar." (memq symbol (cdr elem))) (setq suppress t))) (and (not suppress) - (or (eq byte-compile-warnings t) - (if (eq (car byte-compile-warnings) 'not) - (not (memq warning byte-compile-warnings)) - (memq warning byte-compile-warnings)))))) + ;; During an Emacs build, we want all warnings. + (or (eq byte-compile-warnings 'all) + ;; If t, we want almost all the warnings, but not the + ;; ones that are Emacs build specific. + (and (not (memq warning byte-compile--emacs-build-warning-types)) + (or (eq byte-compile-warnings t) + (if (eq (car byte-compile-warnings) 'not) + (not (memq warning byte-compile-warnings)) + (memq warning byte-compile-warnings)))))))) ;;;###autoload (defun byte-compile-disable-warning (warning) @@ -1761,7 +1779,14 @@ It is too wide if it has any lines longer than the largest of (when (string-match-p "\\( \"\\|[ \t]\\|^\\)'[a-z(]" docs) (byte-compile-warn-x name "%s%sdocstring has wrong usage of unescaped single quotes (use \\= or different quoting)" - kind name))))) + kind name)) + ;; There's a "Unicode quote" in the string -- it should probably + ;; be an ASCII one instead. + (when (byte-compile-warning-enabled-p 'docstrings-non-ascii-quotes) + (when (string-match-p "\\( \"\\|[ \t]\\|^\\)[‘’]" docs) + (byte-compile-warn-x + name "%s%sdocstring has wrong usage of \"fancy\" single quotation marks" + kind name)))))) form) ;; If we have compiled any calls to functions which are not known to be -- cgit v1.2.3 From 196eebda168aaf7fec493cf4c38207969904abf3 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 19 Jun 2022 14:17:05 +0200 Subject: Make checkdoc-defun-info parsing slightly less wrong * lisp/emacs-lisp/checkdoc.el (checkdoc-defun-info): Disregard `interactive' in nested parts of the defun (bug#56052). --- lisp/emacs-lisp/checkdoc.el | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 7ae01d03b04..2cb5fa120e0 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -2007,6 +2007,7 @@ from the comment." (let ((defun (looking-at "(\\(?:cl-\\)?def\\(un\\|macro\\|subst\\|advice\\|generic\\|method\\)")) (is-advice (looking-at "(defadvice")) + (defun-depth (ppss-depth (syntax-ppss))) (lst nil) (ret nil) (oo (make-vector 3 0))) ;substitute obarray for `read' @@ -2022,11 +2023,17 @@ from the comment." (setq ret (cons nil ret)) ;; Interactive (save-excursion - (setq ret (cons - (re-search-forward "^\\s-*(interactive" - (save-excursion (end-of-defun) (point)) - t) - ret))) + (push (and (re-search-forward "^\\s-*(interactive" + (save-excursion + (end-of-defun) + (point)) + t) + ;; Disregard `interactive' from other parts of + ;; the function. + (= (ppss-depth (syntax-ppss)) + (+ defun-depth 2)) + (point)) + ret)) (skip-chars-forward " \t\n") (let ((bss (buffer-substring (point) (save-excursion (forward-sexp 1) (point)))) -- cgit v1.2.3 From d181e410fcb26a293e8345fad54507d275fc807c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 19 Jun 2022 14:25:37 +0200 Subject: Fix edebug parsing of ., * lisp/emacs-lisp/edebug.el (edebug-next-token-class): Parse ., correctly (bug#37653). --- lisp/emacs-lisp/edebug.el | 2 +- test/lisp/emacs-lisp/edebug-tests.el | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index ad66cfc2b81..b05ec3a7683 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -675,7 +675,7 @@ Maybe clear the markers and delete the symbol's edebug property?" (or (and (eq (aref edebug-read-syntax-table (following-char)) 'symbol) (not (= (following-char) ?\;))) - (memq (following-char) '(?\, ?\.))))) + (eq (following-char) ?.)))) 'symbol (aref edebug-read-syntax-table (following-char)))) diff --git a/test/lisp/emacs-lisp/edebug-tests.el b/test/lisp/emacs-lisp/edebug-tests.el index 35259a796a0..008e1e467ba 100644 --- a/test/lisp/emacs-lisp/edebug-tests.el +++ b/test/lisp/emacs-lisp/edebug-tests.el @@ -1104,5 +1104,14 @@ This avoids potential duplicate definitions (Bug#41988)." (edebug-initial-mode 'Go-nonstop)) (eval-buffer)))) +(ert-deftest edebug-test-dot-reader () + (with-temp-buffer + (insert "(defun x () `(t .,t))") + (goto-char (point-min)) + (should (equal (save-excursion + (edebug-read-storing-offsets (current-buffer))) + (save-excursion + (read (current-buffer))))))) + (provide 'edebug-tests) ;;; edebug-tests.el ends here -- cgit v1.2.3 From 3947037a33540fa879e5465ae25b9aec61511f85 Mon Sep 17 00:00:00 2001 From: Pip Cet Date: Mon, 20 Jun 2022 01:59:49 +0200 Subject: Fix bytecompiler infloop compiling infloops * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Don't apply optimization if we can't change anything (bug#46906). --- lisp/emacs-lisp/byte-opt.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index fc49e88f8ee..1a50c5a43af 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -2060,9 +2060,9 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance." ((and (memq (car lap0) byte-goto-ops) (memq (car (setq tmp (nth 1 (memq (cdr lap0) lap)))) '(byte-goto byte-return))) - (cond ((and (not (eq tmp lap0)) - (or (eq (car lap0) 'byte-goto) - (eq (car tmp) 'byte-goto))) + (cond ((and (or (eq (car lap0) 'byte-goto) + (eq (car tmp) 'byte-goto)) + (not (eq (cdr tmp) (cdr lap0)))) (byte-compile-log-lap " %s [%s]\t-->\t%s" (car lap0) tmp tmp) (if (eq (car tmp) 'byte-return) -- cgit v1.2.3 From 4ae315f7c3b5bc370d9d66eab5428685a6097606 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Mon, 20 Jun 2022 18:31:05 +0000 Subject: Fix potential (goto-char nil) in byte-compile-warning-prefix * lisp/emacs-lisp/bytecomp.el (byte-compile-warning-prefix): Replace a wrong 'or' form involving OFFSET with simply OFFSET. This prevents OFFSET from possibly being nil in the first branch of the containing `if' form. --- lisp/emacs-lisp/bytecomp.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 2ae9aa13bb6..198eb4df5c8 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1246,8 +1246,7 @@ Order is by depth-first search." load-file-name dir))) (t ""))) (offset (byte-compile--warning-source-offset)) - (pos (if (and byte-compile-current-file - (or offset (not symbols-with-pos-enabled))) + (pos (if (and byte-compile-current-file offset) (with-current-buffer byte-compile-current-buffer (let (new-l new-c) (save-excursion -- cgit v1.2.3 From acf9dcdc51280933eba9f249e41ab41d2896aa93 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 21 Jun 2022 19:07:46 +0200 Subject: Check defface doc strings * lisp/emacs-lisp/bytecomp.el (byte-compile-file-form-custom-declare-variable): We already warn about missing groups from byte-compile-normal-call, so this would be a double warning. (custom-declare-face) (byte-compile-file-form-custom-declare-face): Add doc string checking for defface. --- lisp/emacs-lisp/bytecomp.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 198eb4df5c8..04c107a7cfa 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1756,7 +1756,8 @@ It is too wide if it has any lines longer than the largest of (pcase (car form) ((or 'autoload 'custom-declare-variable 'defalias 'defconst 'define-abbrev-table - 'defvar 'defvaralias) + 'defvar 'defvaralias + 'custom-declare-face) (setq kind (nth 0 form)) (setq name (nth 1 form)) (setq docs (nth 3 form))) @@ -2705,11 +2706,10 @@ list that represents a doc string reference. (byte-compile-keep-pending form)) (put 'custom-declare-variable 'byte-hunk-handler - 'byte-compile-file-form-custom-declare-variable) -(defun byte-compile-file-form-custom-declare-variable (form) - (when (byte-compile-warning-enabled-p 'callargs) - (byte-compile-nogroup-warn form)) - (byte-compile-file-form-defvar-function form)) + 'byte-compile-file-form-defvar-function) + +(put 'custom-declare-face 'byte-hunk-handler + 'byte-compile-docstring-style-warn) (put 'require 'byte-hunk-handler 'byte-compile-file-form-require) (defun byte-compile-file-form-require (form) -- cgit v1.2.3 From dbbf38d43f1f49a38efd260bda655e0b3cd2b6d5 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Tue, 21 Jun 2022 19:10:14 +0200 Subject: Document and test 'no-byte-compile' behavior. * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Document behavior if 'no-byte-compile' is set. * test/lisp/emacs-lisp/bytecomp-tests.el (byte-compile-file/no-byte-compile): New unit test. * test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el: New test file. --- lisp/emacs-lisp/bytecomp.el | 3 +++ test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el | 1 + test/lisp/emacs-lisp/bytecomp-tests.el | 7 +++++++ 3 files changed, 11 insertions(+) create mode 100644 test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 04c107a7cfa..4fd65bb5d53 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2089,6 +2089,9 @@ If compilation is needed, this functions returns the result of The output file's name is generated by passing FILENAME to the function `byte-compile-dest-file' (which see). The value is non-nil if there were no errors, nil if errors. +If the file sets the file variable `no-byte-compile', it is not +compiled, any existing output file is removed, and the return +value is `no-byte-compile'. See also `emacs-lisp-byte-compile-and-load'." (declare (advertised-calling-convention (filename) "28.1")) diff --git a/test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el b/test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el new file mode 100644 index 00000000000..00ad1947507 --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el @@ -0,0 +1 @@ +;; -*- no-byte-compile: t; -*- diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index fbc00b30c54..9c5bef09a34 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -1642,6 +1642,13 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \ (setq actual (nreverse actual)) (should (equal actual expected))))))) +(ert-deftest byte-compile-file/no-byte-compile () + (let* ((src-file (ert-resource-file "no-byte-compile.el")) + (dest-file (make-temp-file "bytecomp-tests-" nil ".elc")) + (byte-compile-dest-file-function (lambda (_) dest-file))) + (should (eq (byte-compile-file src-file) 'no-byte-compile)) + (should-not (file-exists-p dest-file)))) + ;; Local Variables: ;; no-byte-compile: t -- cgit v1.2.3 From 406fd979218321d887c4ca550bcc94f20f6c1713 Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Sat, 2 Apr 2022 00:56:09 +0200 Subject: Fix autoload generation of iter-defun forms This fixes Bug#54648. * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--make-autoload): Add `iter-defun' and `cl-iter-defun' to the list of "complex cases" that are macro-expanded and recursed on. --- lisp/emacs-lisp/loaddefs-gen.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index a686de406ab..7545ba1e5e8 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -174,7 +174,7 @@ expression, in which case we want to handle forms differently." define-globalized-minor-mode defun defmacro easy-mmode-define-minor-mode define-minor-mode define-inline cl-defun cl-defmacro cl-defgeneric - cl-defstruct pcase-defmacro)) + cl-defstruct pcase-defmacro iter-defun cl-iter-defun)) (macrop car) (setq expand (let ((load-true-file-name file) (load-file-name file)) -- cgit v1.2.3 From eff42dc0af741cc56c52d7d9577d29fc16f9f665 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 29 May 2022 21:23:57 -0400 Subject: ; bindat (strz): Move all pack logic to pack function (bug#56048) Motivation/rationale: * Improve code readability. Now `bindat--pack-strz` is used for all `strz` packing, not just variable-length `strz` packing. * Make it easier to change the behavior of fixed-length `strz` packing without also affecting the behavior of `str` packing. (A future commit will modify `strz` to write a null terminator if there is room.) --- lisp/emacs-lisp/bindat.el | 49 ++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index 46e2a4901c3..4a642bb9c5a 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el @@ -440,20 +440,27 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (aset bindat-raw (+ bindat-idx i) (aref v i))) (setq bindat-idx (+ bindat-idx len)))) -(defun bindat--pack-strz (v) +(defun bindat--pack-strz (len v) (let* ((v (string-to-unibyte v)) - (len (length v))) - (dotimes (i len) - (when (= (aref v i) 0) - ;; Alternatively we could pretend that this was the end of - ;; the string and stop packing, but then bindat-length would - ;; need to scan the input string looking for a null byte. - (error "Null byte encountered in input strz string")) - (aset bindat-raw (+ bindat-idx i) (aref v i))) - ;; Explicitly write a null terminator in case the user provided a - ;; pre-allocated string to bindat-pack that wasn't zeroed first. - (aset bindat-raw (+ bindat-idx len) 0) - (setq bindat-idx (+ bindat-idx len 1)))) + (vlen (length v))) + (if len + ;; When len is specified, behave the same as the str type + ;; since we don't actually add the terminating zero anyway + ;; (because we rely on the fact that `bindat-raw' was + ;; presumably initialized with all-zeroes before we started). + (bindat--pack-str len v) + (dotimes (i vlen) + (when (= (aref v i) 0) + ;; Alternatively we could pretend that this was the end of + ;; the string and stop packing, but then bindat-length would + ;; need to scan the input string looking for a null byte. + (error "Null byte encountered in input strz string")) + (aset bindat-raw (+ bindat-idx i) (aref v i))) + ;; Explicitly write a null terminator in case the user provided + ;; a pre-allocated string to `bindat-pack' that wasn't already + ;; zeroed. + (aset bindat-raw (+ bindat-idx vlen) 0) + (setq bindat-idx (+ bindat-idx vlen 1))))) (defun bindat--pack-bits (len v) (let ((bnum (1- (* 8 len))) j m) @@ -482,7 +489,8 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." ('u24r (bindat--pack-u24r v)) ('u32r (bindat--pack-u32r v)) ('bits (bindat--pack-bits len v)) - ((or 'str 'strz) (bindat--pack-str len v)) + ('str (bindat--pack-str len v)) + ('strz (bindat--pack-strz len v)) ('vec (let ((l (length v)) (vlen 1)) (if (consp vectype) @@ -699,18 +707,7 @@ is the name of a variable that will hold the value we need to pack.") ((numberp len) len) ;; General expression support. (t `(or ,len (1+ (length ,val))))))) - (`(pack . ,args) - ;; When len is specified, behave the same as the str type since we don't - ;; actually add the terminating zero anyway (because we rely on the fact - ;; that `bindat-raw' was presumably initialized with all-zeroes before we - ;; started). - (cond ; Same optimizations as 'length above. - ((null len) `(bindat--pack-strz . ,args)) - ((numberp len) `(bindat--pack-str ,len . ,args)) - (t (macroexp-let2 nil len len - `(if ,len - (bindat--pack-str ,len . ,args) - (bindat--pack-strz . ,args)))))))) + (`(pack . ,args) `(bindat--pack-strz ,len . ,args)))) (cl-defmethod bindat--type (op (_ (eql 'bits)) len) (bindat--pcase op -- cgit v1.2.3 From 55c2102560751ae05c98fd04120abcf4595d2a57 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 16 Jun 2022 15:21:57 -0400 Subject: bindat (strz): Null terminate fixed-length strings if there is room * lisp/emacs-lisp/bindat.el (bindat--pack-strz): For fixed-length strz fields, explicitly write a null terminator after the packed string if there is room (bug#56048). * doc/lispref/processes.texi (Bindat Types): Update documentation. * test/lisp/emacs-lisp/bindat-tests.el (bindat-test--str-strz-prealloc): Update tests. --- doc/lispref/processes.texi | 27 ++++++++++++++------------- lisp/emacs-lisp/bindat.el | 13 ++++++------- test/lisp/emacs-lisp/bindat-tests.el | 12 ++++++------ 3 files changed, 26 insertions(+), 26 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index b9200aedde5..9e0bd98a54f 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -3509,23 +3509,24 @@ packed; other multibyte strings signal an error. When unpacking a (but excluding) the null byte that terminated the input string. If @var{len} is provided, @code{strz} behaves the same as @code{str}, -but with one difference: when unpacking, the first null byte -encountered in the packed string is interpreted as the terminating -byte, and it and all subsequent bytes are excluded from the result of -the unpacking. +but with a couple of differences: -@quotation Caution -The packed output will not be null-terminated unless one of the -following is true: -@itemize +@itemize @bullet @item -The input string is shorter than @var{len} bytes and either no pre-allocated -string was provided to @code{bindat-pack} or the appropriate byte in -the pre-allocated string was already null. +When packing, a null terminator is written after the packed input +string if the number of characters in the input string is less than +@var{len}. + @item -The input string contains a null byte within the first @var{len} -bytes. +When unpacking, the first null byte encountered in the packed string +is interpreted as the terminating byte, and it and all subsequent +bytes are excluded from the result of the unpacking. @end itemize + +@quotation Caution +The packed output will not be null-terminated unless the input string +is shorter than @var{len} bytes or it contains a null byte within the +first @var{len} bytes. @end quotation @item vec @var{len} [@var{type}] diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index 4a642bb9c5a..0ecac3d52aa 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el @@ -443,11 +443,14 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (defun bindat--pack-strz (len v) (let* ((v (string-to-unibyte v)) (vlen (length v))) + ;; Explicitly write a null terminator (if there's room) in case + ;; the user provided a pre-allocated string to `bindat-pack' that + ;; wasn't already zeroed. + (when (or (null len) (< vlen len)) + (aset bindat-raw (+ bindat-idx vlen) 0)) (if len ;; When len is specified, behave the same as the str type - ;; since we don't actually add the terminating zero anyway - ;; (because we rely on the fact that `bindat-raw' was - ;; presumably initialized with all-zeroes before we started). + ;; (except for the null terminator possibly written above). (bindat--pack-str len v) (dotimes (i vlen) (when (= (aref v i) 0) @@ -456,10 +459,6 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." ;; need to scan the input string looking for a null byte. (error "Null byte encountered in input strz string")) (aset bindat-raw (+ bindat-idx i) (aref v i))) - ;; Explicitly write a null terminator in case the user provided - ;; a pre-allocated string to `bindat-pack' that wasn't already - ;; zeroed. - (aset bindat-raw (+ bindat-idx vlen) 0) (setq bindat-idx (+ bindat-idx vlen 1))))) (defun bindat--pack-bits (len v) diff --git a/test/lisp/emacs-lisp/bindat-tests.el b/test/lisp/emacs-lisp/bindat-tests.el index cc223ad14e2..0c03c51e2ef 100644 --- a/test/lisp/emacs-lisp/bindat-tests.el +++ b/test/lisp/emacs-lisp/bindat-tests.el @@ -172,14 +172,14 @@ ((((x str 2)) ((x . "a"))) . "ax") ((((x str 2)) ((x . "ab"))) . "ab") ((((x str 2)) ((x . "abc"))) . "ab") - ((,(bindat-type strz 1) "") . "xx") - ((,(bindat-type strz 2) "") . "xx") - ((,(bindat-type strz 2) "a") . "ax") + ((,(bindat-type strz 1) "") . "\0x") + ((,(bindat-type strz 2) "") . "\0x") + ((,(bindat-type strz 2) "a") . "a\0") ((,(bindat-type strz 2) "ab") . "ab") ((,(bindat-type strz 2) "abc") . "ab") - ((((x strz 1)) ((x . ""))) . "xx") - ((((x strz 2)) ((x . ""))) . "xx") - ((((x strz 2)) ((x . "a"))) . "ax") + ((((x strz 1)) ((x . ""))) . "\0x") + ((((x strz 2)) ((x . ""))) . "\0x") + ((((x strz 2)) ((x . "a"))) . "a\0") ((((x strz 2)) ((x . "ab"))) . "ab") ((((x strz 2)) ((x . "abc"))) . "ab") ((,(bindat-type strz) "") . "\0x") -- cgit v1.2.3 From 48248c901d0884c042345c3ae1ba8fdfeb195c74 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Thu, 23 Jun 2022 14:33:46 +0200 Subject: Remove unused function in bytecomp.el * lisp/emacs-lisp/bytecomp.el (byte-compile-delete-first): Remove. --- lisp/emacs-lisp/bytecomp.el | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 4fd65bb5d53..a8c68f81531 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1174,18 +1174,6 @@ message buffer `default-directory'." (t (insert (format "%s\n" string))))))) -;; copied from gnus-util.el -(defsubst byte-compile-delete-first (elt list) - (if (eq (car list) elt) - (cdr list) - (let ((total list)) - (while (and (cdr list) - (not (eq (cadr list) elt))) - (setq list (cdr list))) - (when (cdr list) - (setcdr list (cddr list))) - total))) - (defvar byte-compile-last-warned-form nil) (defvar byte-compile-last-logged-file nil) (defvar byte-compile-root-dir nil -- cgit v1.2.3 From bd1f20eea199d61a8b1db602392d8e17af624ff2 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 24 Jun 2022 10:43:41 +0200 Subject: Make debug-early-backtrace more resilient * lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Allow outputting backtraces during bootstrap. --- lisp/emacs-lisp/debug-early.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/debug-early.el b/lisp/emacs-lisp/debug-early.el index 4f1f4b81557..a301c73017e 100644 --- a/lisp/emacs-lisp/debug-early.el +++ b/lisp/emacs-lisp/debug-early.el @@ -45,7 +45,13 @@ of the build process." (let ((print-escape-newlines t) (print-escape-control-characters t) (print-escape-nonascii t) - (prin1 (if (fboundp 'cl-prin1) #'cl-prin1 #'prin1))) + (prin1 (if (and (fboundp 'cl-prin1) + ;; If we're being called while + ;; bootstrapping, we won't be able to load + ;; cl-print. + (require 'cl-print nil t)) + #'cl-prin1 + #'prin1))) (mapbacktrace #'(lambda (evald func args _flags) (let ((args args)) -- cgit v1.2.3 From 49910adf872a98d9c144d34478a53ecb3e01856f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 24 Jun 2022 10:54:01 +0200 Subject: Fix cl-generic bootstrap problems * lisp/sqlite-mode.el (require): * lisp/net/eudc.el (require): * lisp/arc-mode.el (require): Require subr-x, since these files are using macros from there. * lisp/emacs-lisp/subr-x.el (with-memoization): Move from here... * lisp/subr.el (with-memoization): ... to here, as it's used from the preloaded cl-generic.el file. * lisp/emacs-lisp/cl-generic.el (cl--generic-compiler): Don't use the autoloaded `byte-compile' function during bootstrap. (cl--generic-get-dispatcher): Don't require subr-x, either. cl-generic has been preloaded since 2015, and most usages of it (in preloaded files) work fine. In particular, using `cl-defgeneric' is unproblematic. However, `cl-defmethod' would end up pulling in the byte compiler (at load time), which would make it impossible to use `cl-defmethod' in pre-loaded files, and this change fixes that (but possibly not in the most self-evidently correct way). --- lisp/arc-mode.el | 1 + lisp/emacs-lisp/cl-generic.el | 9 ++++----- lisp/emacs-lisp/subr-x.el | 13 ------------- lisp/net/eudc.el | 1 + lisp/sqlite-mode.el | 1 + lisp/subr.el | 12 ++++++++++++ test/lisp/custom-tests.el | 1 + test/lisp/emacs-lisp/cconv-tests.el | 1 + 8 files changed, 21 insertions(+), 18 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 1c5faa1152b..c52f2a44322 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -101,6 +101,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'subr-x)) ;; ------------------------------------------------------------------------- ;;; Section: Configuration. diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 200af057cd7..6c5813959fa 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -658,8 +658,10 @@ The set of acceptable TYPEs (also called \"specializers\") is defined ;; compiled. Otherwise the byte-compiler and all the code on ;; which it depends needs to be usable before cl-generic is loaded, ;; which imposes a significant burden on the bootstrap. - (if (consp (lambda (x) (+ x 1))) - (lambda (exp) (eval exp t)) #'byte-compile)) + (if (or (consp (lambda (x) (+ x 1))) + (not (featurep 'bytecomp))) + (lambda (exp) (eval exp t)) + #'byte-compile)) (defun cl--generic-get-dispatcher (dispatch) (with-memoization @@ -708,9 +710,6 @@ The set of acceptable TYPEs (also called \"specializers\") is defined (funcall cl--generic-compiler `(lambda (generic dispatches-left methods) - ;; FIXME: We should find a way to expand `with-memoize' once - ;; and forall so we don't need `subr-x' when we get here. - (eval-when-compile (require 'subr-x)) (let ((method-cache (make-hash-table :test #'eql))) (lambda (,@fixedargs &rest args) (let ,bindings diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 5c3dff62c8a..b0de5d155ac 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -290,19 +290,6 @@ as the new values of the bound variables in the recursive invocation." (cl-labels ((,name ,fargs . ,body)) #',name) . ,aargs))) -(defmacro with-memoization (place &rest code) - "Return the value of CODE and stash it in PLACE. -If PLACE's value is non-nil, then don't bother evaluating CODE -and return the value found in PLACE instead." - (declare (indent 1) (debug (gv-place body))) - (gv-letplace (getter setter) place - `(or ,getter - ,(macroexp-let2 nil val (macroexp-progn code) - `(progn - ,(funcall setter val) - ,val))))) - - ;;;###autoload (defun string-pixel-width (string) "Return the width of STRING in pixels." diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el index 808d2ca509c..1d9dbbeb754 100644 --- a/lisp/net/eudc.el +++ b/lisp/net/eudc.el @@ -48,6 +48,7 @@ (require 'wid-edit) (require 'cl-lib) (require 'eudc-vars) +(eval-when-compile (require 'subr-x)) ;;{{{ Internal cooking diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el index 66e2e487d9c..fb2ceab383f 100644 --- a/lisp/sqlite-mode.el +++ b/lisp/sqlite-mode.el @@ -24,6 +24,7 @@ ;;; Code: (require 'cl-lib) +(eval-when-compile (require 'subr-x)) (declare-function sqlite-execute "sqlite.c") (declare-function sqlite-more-p "sqlite.c") diff --git a/lisp/subr.el b/lisp/subr.el index 04eec977bb6..075bfb95b7b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6912,4 +6912,16 @@ CONDITION." (push buf bufs))) bufs)) +(defmacro with-memoization (place &rest code) + "Return the value of CODE and stash it in PLACE. +If PLACE's value is non-nil, then don't bother evaluating CODE +and return the value found in PLACE instead." + (declare (indent 1) (debug (gv-place body))) + (gv-letplace (getter setter) place + `(or ,getter + ,(macroexp-let2 nil val (macroexp-progn code) + `(progn + ,(funcall setter val) + ,val))))) + ;;; subr.el ends here diff --git a/test/lisp/custom-tests.el b/test/lisp/custom-tests.el index 77bb337d6aa..d1effaa72a8 100644 --- a/test/lisp/custom-tests.el +++ b/test/lisp/custom-tests.el @@ -24,6 +24,7 @@ (require 'wid-edit) (require 'cus-edit) +(require 'bytecomp) (ert-deftest custom-theme--load-path () "Test `custom-theme--load-path' behavior." diff --git a/test/lisp/emacs-lisp/cconv-tests.el b/test/lisp/emacs-lisp/cconv-tests.el index 0668e44ba51..9904c6a969c 100644 --- a/test/lisp/emacs-lisp/cconv-tests.el +++ b/test/lisp/emacs-lisp/cconv-tests.el @@ -24,6 +24,7 @@ (require 'ert) (require 'cl-lib) (require 'generator) +(require 'bytecomp) (ert-deftest cconv-tests-lambda-:documentation () "Docstring for lambda can be specified with :documentation." -- cgit v1.2.3 From bed9fd41efc72526a7fddcbe73c2ad9a97495356 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 24 Jun 2022 11:00:06 +0200 Subject: Allow read-multiple-choice to do long-form answers * doc/lispref/commands.texi (Reading One Event): Document it. * lisp/emacs-lisp/rmc.el (read-multiple-choice): Allow using long-form answers instead of single character ones. (read-multiple-choice--long-answers): New function. (read-multiple-choice--short-answers): Refactored out from the main function. --- doc/lispref/commands.texi | 7 ++++++- etc/NEWS | 3 +++ lisp/emacs-lisp/rmc.el | 25 ++++++++++++++++++++++--- 3 files changed, 31 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 0a82bba3bc7..6f022183336 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -3198,7 +3198,7 @@ causes it to evaluate @code{help-form} and display the result. It then continues to wait for a valid input character, or keyboard-quit. @end defun -@defun read-multiple-choice prompt choices &optional help-string show-help +@defun read-multiple-choice prompt choices &optional help-string show-help long-form Ask user a multiple choice question. @var{prompt} should be a string that will be displayed as the prompt. @@ -3217,6 +3217,11 @@ If optional argument @var{show-help} is non-@code{nil}, the help buffer will be displayed immediately, before any user input. If it is a string, use it as the name of the help buffer. +If optional argument @var{long-form} is non-@code{nil}, the user +will have to type in long-form answers (using @code{completing-read}) +instead of hitting a single key. The answers must be among the second +elements of the values in the @var{choices} list. + The return value is the matching value from @var{choices}. @lisp diff --git a/etc/NEWS b/etc/NEWS index 7ef71092741..3ed7aae2204 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2104,6 +2104,9 @@ patcomp.el, pc-mode.el, pc-select.el, s-region.el, and sregex.el. * Lisp Changes in Emacs 29.1 ++++ +** 'read-multiple-choice' can now use long-form answers. + +++ ** 'read-regexp' now allows the user to indicate whether to use case folding. diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el index 195035e6be9..dae6590b9bc 100644 --- a/lisp/emacs-lisp/rmc.el +++ b/lisp/emacs-lisp/rmc.el @@ -23,8 +23,6 @@ ;;; Code: -(require 'seq) - (defun rmc--add-key-description (elem) (let* ((char (car elem)) (name (cadr elem)) @@ -125,7 +123,8 @@ buf)) ;;;###autoload -(defun read-multiple-choice (prompt choices &optional help-string show-help) +(defun read-multiple-choice (prompt choices &optional help-string show-help + long-form) "Ask user to select an entry from CHOICES, promting with PROMPT. This function allows to ask the user a multiple-choice question. @@ -163,12 +162,21 @@ dialogs. Otherwise, the function will always use text-mode dialogs. The return value is the matching entry from the CHOICES list. +If LONG-FORM, do a `completing-read' over the NAME elements in +CHOICES instead. + Usage example: \(read-multiple-choice \"Continue connecting?\" \\='((?a \"always\") (?s \"session only\") (?n \"no\")))" + (if long-form + (read-multiple-choice--long-answers prompt choices) + (read-multiple-choice--short-answers + prompt choices help-string show-help))) + +(defun read-multiple-choice--short-answers (prompt choices help-string show-help) (let* ((prompt-choices (if show-help choices (append choices '((?? "?"))))) (altered-names (mapcar #'rmc--add-key-description prompt-choices)) @@ -244,6 +252,17 @@ Usage example: (kill-buffer buf)) (assq tchar choices))) +(defun read-multiple-choice--long-answers (prompt choices) + (let ((answer + (completing-read + (concat prompt " (" + (mapconcat #'identity (mapcar #'cadr choices) "/") + ") ") + (mapcar #'cadr choices) nil t))) + (seq-find (lambda (elem) + (equal (cadr elem) answer)) + choices))) + (provide 'rmc) ;;; rmc.el ends here -- cgit v1.2.3 From 0c784a483f98d6bea4d955a99bbf5ea6faf80acf Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 24 Jun 2022 11:15:19 +0200 Subject: Update seq.el comment * lisp/emacs-lisp/seq.el: Update comment. --- lisp/emacs-lisp/seq.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 133d3c9e118..947b64e8687 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -59,8 +59,8 @@ (eval-when-compile (require 'cl-generic)) ;; We used to use some sequence functions from cl-lib, but this -;; dependency was swapped around so that it will be easier to make -;; seq.el preloaded in the future. See also Bug#39761#26. +;; dependency was swapped around so that it's easier to make seq.el +;; preloaded. See also Bug#39761#26. (defmacro seq-doseq (spec &rest body) "Loop over a sequence. -- cgit v1.2.3 From 253a4a2c689d757cb798cfb9f51b2110283d7146 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Fri, 24 Jun 2022 11:48:42 +0200 Subject: Bytecode opcode comments update This is a cosmetic change only; there is no change in behaviour. * lisp/emacs-lisp/bytecomp.el: * src/bytecode.c (BYTE_CODES, exec_byte_code): Update and/or remove incorrect, outdated or useless comments. Clarify. Reorder where appropriate. Rename Bsave_current_buffer to Bsave_current_buffer_OBSOLETE and Bsave_current_buffer_1 to Bsave_current_buffer, reflecting the state since 1996. --- lisp/emacs-lisp/bytecomp.el | 27 ++++++++++++++------------- src/bytecode.c | 16 +++++++++++----- 2 files changed, 25 insertions(+), 18 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index a8c68f81531..bd3db85c148 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -681,10 +681,13 @@ Each element is (INDEX . VALUE)") (put 'byte-stack+-info 'tmp-compile-time-value nil))) -;; These opcodes are special in that they pack their argument into the -;; opcode word. -;; +;; The following opcodes (1-47) use the 3 lowest bits for an immediate +;; argument. + (byte-defop 0 1 byte-stack-ref "for stack reference") +;; Code 0 is actually unused but reserved as invalid code for detecting +;; corrupted bytecode. Codes 1-7 are stack-ref. + (byte-defop 8 1 byte-varref "for variable reference") (byte-defop 16 -1 byte-varset "for setting a variable") (byte-defop 24 -1 byte-varbind "for binding a variable") @@ -692,11 +695,9 @@ Each element is (INDEX . VALUE)") (byte-defop 40 0 byte-unbind "for unbinding special bindings") ;; codes 8-47 are consumed by the preceding opcodes -;; New (in Emacs-24.4) bytecodes for more efficient handling of non-local exits -;; (especially useful in lexical-binding code). (byte-defop 48 0 byte-pophandler) -(byte-defop 50 -1 byte-pushcatch) (byte-defop 49 -1 byte-pushconditioncase) +(byte-defop 50 -1 byte-pushcatch) ;; unused: 51-55 @@ -719,9 +720,9 @@ Each element is (INDEX . VALUE)") (byte-defop 72 -1 byte-aref) (byte-defop 73 -2 byte-aset) (byte-defop 74 0 byte-symbol-value) -(byte-defop 75 0 byte-symbol-function) ; this was commented out +(byte-defop 75 0 byte-symbol-function) (byte-defop 76 -1 byte-set) -(byte-defop 77 -1 byte-fset) ; this was commented out +(byte-defop 77 -1 byte-fset) (byte-defop 78 -1 byte-get) (byte-defop 79 -2 byte-substring) (byte-defop 80 -1 byte-concat2) @@ -739,8 +740,9 @@ Each element is (INDEX . VALUE)") (byte-defop 92 -1 byte-plus) (byte-defop 93 -1 byte-max) (byte-defop 94 -1 byte-min) -(byte-defop 95 -1 byte-mult) ; v19 only +(byte-defop 95 -1 byte-mult) (byte-defop 96 1 byte-point) +(byte-defop 97 0 byte-save-current-buffer-OBSOLETE) ; unused since v20 (byte-defop 98 0 byte-goto-char) (byte-defop 99 0 byte-insert) (byte-defop 100 1 byte-point-max) @@ -762,7 +764,6 @@ Each element is (INDEX . VALUE)") (byte-defop 115 0 byte-set-mark-OBSOLETE) (byte-defop 116 1 byte-interactive-p-OBSOLETE) -;; These ops are new to v19 (byte-defop 117 0 byte-forward-char) (byte-defop 118 0 byte-forward-word) (byte-defop 119 -1 byte-skip-chars-forward) @@ -819,7 +820,6 @@ the unwind-action") ;; unused: 146 -;; these ops are new to v19 (byte-defop 147 -2 byte-set-marker) (byte-defop 148 0 byte-match-beginning) (byte-defop 149 0 byte-match-end) @@ -866,10 +866,11 @@ the unwind-action") "to take a hash table and a value from the stack, and jump to the address the value maps to, if any.") -;; unused: 182-191 +;; unused: 184-191 (byte-defop 192 1 byte-constant "for reference to a constant") -;; codes 193-255 are consumed by byte-constant. +;; Codes 193-255 are consumed by `byte-constant', which uses the 6 +;; lowest bits for an immediate argument. (defconst byte-constant-limit 64 "Exclusive maximum index usable in the `byte-constant' opcode.") diff --git a/src/bytecode.c b/src/bytecode.c index fa068e1ec6b..d75767bb0c5 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -176,8 +176,8 @@ DEFINE (Bmin, 0136) \ DEFINE (Bmult, 0137) \ \ DEFINE (Bpoint, 0140) \ -/* Was Bmark in v17. */ \ -DEFINE (Bsave_current_buffer, 0141) /* Obsolete. */ \ +/* 0141 was Bmark in v17, Bsave_current_buffer in 18-19. */ \ +DEFINE (Bsave_current_buffer_OBSOLETE, 0141) /* Obsolete since 20. */ \ DEFINE (Bgoto_char, 0142) \ DEFINE (Binsert, 0143) \ DEFINE (Bpoint_max, 0144) \ @@ -194,7 +194,7 @@ DEFINE (Bbolp, 0156) \ DEFINE (Bbobp, 0157) \ DEFINE (Bcurrent_buffer, 0160) \ DEFINE (Bset_buffer, 0161) \ -DEFINE (Bsave_current_buffer_1, 0162) /* Replacing Bsave_current_buffer. */ \ +DEFINE (Bsave_current_buffer, 0162) \ /* 0163 was Bset_mark in v17. */ \ DEFINE (Binteractive_p, 0164) /* Obsolete since Emacs-24.1. */ \ \ @@ -924,8 +924,8 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template, record_unwind_protect_excursion (); NEXT; - CASE (Bsave_current_buffer): /* Obsolete since ??. */ - CASE (Bsave_current_buffer_1): + CASE (Bsave_current_buffer_OBSOLETE): /* Obsolete since 20. */ + CASE (Bsave_current_buffer): record_unwind_current_buffer (); NEXT; @@ -1678,6 +1678,12 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template, /* TODO: Perhaps introduce another byte-code for switch when the number of cases is less, which uses a simple vector for linear search as the jump table. */ + + /* TODO: Instead of pushing the table in a separate + Bconstant op, use an immediate argument (maybe separate + switch opcodes for 1-byte and 2-byte constant indices). + This would also get rid of some hacks that assume each + Bswitch to be preceded by a Bconstant. */ Lisp_Object jmp_table = POP; if (BYTE_CODE_SAFE && !HASH_TABLE_P (jmp_table)) emacs_abort (); -- cgit v1.2.3 From 2f346b0ab10a8777ff5629af30a224b4f0ea16a6 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 25 Jun 2022 12:20:05 +0200 Subject: Re-fix build warnings about subr-x defsubsts * lisp/term/haiku-win.el (require): * lisp/progmodes/elisp-mode.el (require): * lisp/isearch.el (require): Require subr-x at compile time, since these use defsubsts/macros from there. * lisp/emacs-lisp/subr-x.el (string-empty-p): Move from here... * lisp/simple.el (string-empty-p): ... to here. This is to help with a build problem where files.el is using the defsubst, but requiring subr-x.el at compile time leads to load errors. --- lisp/emacs-lisp/subr-x.el | 4 ---- lisp/isearch.el | 1 + lisp/progmodes/elisp-mode.el | 1 + lisp/simple.el | 4 ++++ lisp/term/haiku-win.el | 1 + 5 files changed, 7 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index b0de5d155ac..390e505f009 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -97,10 +97,6 @@ threading." (maphash (lambda (_ v) (push v values)) hash-table) values)) -(defsubst string-empty-p (string) - "Check whether STRING is empty." - (string= string "")) - (defsubst string-join (strings &optional separator) "Join all STRINGS using SEPARATOR. Optional argument SEPARATOR must be a string, a vector, or a list of diff --git a/lisp/isearch.el b/lisp/isearch.el index 7650ebcfcea..0624858993d 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -54,6 +54,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'subr-x)) ;; Some additional options and constants. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 332488e6d41..fc257679340 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -31,6 +31,7 @@ (require 'cl-generic) (require 'lisp-mode) (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'subr-x)) (define-abbrev-table 'emacs-lisp-mode-abbrev-table () "Abbrev table for Emacs Lisp mode. diff --git a/lisp/simple.el b/lisp/simple.el index 8f82ff3a8e8..2b11a6362fd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -10620,6 +10620,10 @@ If the buffer doesn't exist, create it first." (save-buffer))) t))) +(defsubst string-empty-p (string) + "Check whether STRING is empty." + (string= string "")) + (provide 'simple) diff --git a/lisp/term/haiku-win.el b/lisp/term/haiku-win.el index 5443904a733..024459e6475 100644 --- a/lisp/term/haiku-win.el +++ b/lisp/term/haiku-win.el @@ -24,6 +24,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'subr-x)) (unless (featurep 'haiku) (error "%s: Loading haiku-win without having Haiku" invocation-name)) -- cgit v1.2.3 From 040c03cae2db361d2e014a52d969a6b0ebc48f1c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 25 Jun 2022 14:58:01 +0200 Subject: Make `M-q' work on the first line of a multi-line string again * lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Exclude the quote marks from the region so that filling works (bug#56197). --- lisp/emacs-lisp/lisp-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index aaec13d1afc..781c80fd5a0 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1481,8 +1481,8 @@ and initial semicolons." (progn (forward-sexp 1) t)) - (narrow-to-region (ppss-comment-or-string-start ppss) - (point)))) + (narrow-to-region (1+ (ppss-comment-or-string-start ppss)) + (1- (point))))) ;; Move back to where we were. (goto-char start) (fill-paragraph justify))))))) -- cgit v1.2.3 From 6a96d1773469e671a3d5710bedf68c21929b5183 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 26 Jun 2022 08:59:38 -0400 Subject: * lisp/emacs-lisp/syntax.el: Rework the handling of nested calls. Nested calls to `syntax-ppss` and `syntax-propertize` can easily happen unexpectedly via ondemand propertizing or `forward-sexp`. Refine the handling of nested calls so we detect them more reliably (e.g. also within `syntax-propertize-extend-region-functions`) and so that the `syntax-ppss` cache is automatically flushed in case it might have been filled with data that's become obsolete since. (syntax-propertize--inhibit-flush): Delete var. (syntax-propertize--in-process-p): New function to replace it. (syntax-ppss-flush-cache): Use it. (syntax-ppss--updated-cache): New var. (syntax-propertize): Make `syntax-propertize--done` binding apply to `syntax-propertize-extend-region-functions` as well, as intended (fixes bug#46713). Use `syntax-ppss--updated-cache` to flush syntax-ppss cache at the end when needed. Don't bind `syntax-propertize--inhibit-flush` any more. (syntax-ppss): Set `syntax-ppss--updated-cache` when applicable. --- lisp/emacs-lisp/syntax.el | 69 +++++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 23 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index a4d7beade13..36b0c56e953 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -345,10 +345,16 @@ END) suitable for `syntax-propertize-function'." (defvar-local syntax-ppss-table nil "Syntax-table to use during `syntax-ppss', if any.") -(defvar-local syntax-propertize--inhibit-flush nil - "If non-nil, `syntax-ppss-flush-cache' only flushes the ppss cache. -Otherwise it flushes both the ppss cache and the properties -set by `syntax-propertize'") +(defun syntax-propertize--in-process-p () + "Non-nil if we're inside `syntax-propertize'. +This is used to avoid infinite recursion as well as to handle cases where +`syntax-ppss' is called when the final `syntax-table' properties have not +yet been setup, in which case we may end up putting invalid info into the cache. +It's also used so that `syntax-ppss-flush-cache' can be used from within +`syntax-propertize' without ruining the `syntax-table' already set." + (eq syntax-propertize--done most-positive-fixnum)) + +(defvar-local syntax-ppss--updated-cache nil) (defun syntax-propertize (pos) "Ensure that syntax-table properties are set until POS (a buffer point)." @@ -370,21 +376,24 @@ set by `syntax-propertize'") (with-silent-modifications (with-syntax-table (or syntax-ppss-table (syntax-table)) (make-local-variable 'syntax-propertize--done) ;Just in case! + ;; Make sure we let-bind it only buffer-locally. + (make-local-variable 'syntax-ppss--updated-cache) (let* ((start (max (min syntax-propertize--done (point-max)) (point-min))) (end (max pos (min (point-max) (+ start syntax-propertize-chunk-size)))) (first t) - (repeat t)) + (repeat t) + (syntax-ppss--updated-cache nil)) (while repeat (setq repeat nil) (run-hook-wrapped 'syntax-propertize-extend-region-functions (lambda (f) - (let ((new (funcall f start end)) - ;; Avoid recursion! - (syntax-propertize--done most-positive-fixnum)) + ;; Bind `syntax-propertize--done' to avoid recursion! + (let* ((syntax-propertize--done most-positive-fixnum) + (new (funcall f start end))) (if (or (null new) (and (>= (car new) start) (<= (cdr new) end))) nil @@ -399,20 +408,26 @@ set by `syntax-propertize'") ;; Flush ppss cache between the original value of `start' and that ;; set above by syntax-propertize-extend-region-functions. (syntax-ppss-flush-cache start) - ;; Move the limit before calling the function, so the function - ;; can use syntax-ppss. + ;; Move the limit before calling the function, so it's + ;; done in case of errors. (setq syntax-propertize--done end) ;; (message "syntax-propertizing from %s to %s" start end) (remove-text-properties start end '(syntax-table nil syntax-multiline nil)) - ;; Make sure we only let-bind it buffer-locally. - (make-local-variable 'syntax-propertize--inhibit-flush) - ;; Let-bind `syntax-propertize--done' to avoid infinite recursion! - (let ((syntax-propertize--done most-positive-fixnum) - ;; Let `syntax-propertize-function' call - ;; `syntax-ppss-flush-cache' without worries. - (syntax-propertize--inhibit-flush t)) - (funcall syntax-propertize-function start end))))))))) + ;; Bind `syntax-propertize--done' to avoid recursion! + (let ((syntax-propertize--done most-positive-fixnum)) + (funcall syntax-propertize-function start end) + (when syntax-ppss--updated-cache + ;; `syntax-ppss' was called and updated the cache while we + ;; were propertizing so we need to flush the part of the + ;; cache that may have been rendered out-of-date by the new + ;; properties. + ;; We used to require syntax-propertize-functions to do that + ;; manually when applicable, but nowadays the `syntax-ppss' + ;; cache can be updated by too many functions, so the author + ;; of the syntax-propertize-function may not be aware it + ;; can happen. + (syntax-ppss-flush-cache start)))))))))) ;;; Link syntax-propertize with syntax.c. @@ -487,10 +502,10 @@ These are valid when the buffer has no restriction.") (define-obsolete-function-alias 'syntax-ppss-after-change-function #'syntax-ppss-flush-cache "27.1") -(defun syntax-ppss-flush-cache (beg &rest ignored) +(defun syntax-ppss-flush-cache (beg &rest _ignored) "Flush the cache of `syntax-ppss' starting at position BEG." ;; Set syntax-propertize to refontify anything past beg. - (unless syntax-propertize--inhibit-flush + (unless (syntax-propertize--in-process-p) (setq syntax-propertize--done (min beg syntax-propertize--done))) ;; Flush invalid cache entries. (dolist (cell (list syntax-ppss-wide syntax-ppss-narrow)) @@ -517,10 +532,16 @@ These are valid when the buffer has no restriction.") (setcdr cell cache))) )) -;;; FIXME: Explain this variable. Currently only its last (5th) slot is used. -;;; Perhaps the other slots should be removed? +;; FIXME: Explain this variable. Currently only its last (5th) slot is used. +;; Perhaps the other slots should be removed? +;; This variable is only used when `syntax-begin-function' is used and +;; will hence be removed together with `syntax-begin-function'. (defvar syntax-ppss-stats - [(0 . 0) (0 . 0) (0 . 0) (0 . 0) (0 . 0) (2 . 2500)]) + [(0 . 0) (0 . 0) (0 . 0) (0 . 0) (0 . 0) (2 . 2500)] + "Statistics about which case is more/less frequent in `syntax-ppss'. +The 5th slot drives the heuristic to use `syntax-begin-function'. +The rest is only useful if you're interested in tweaking the algorithm.") + (defun syntax-ppss-stats () (mapcar (lambda (x) (condition-case nil @@ -658,6 +679,7 @@ running the hook." ;; populate the cache so we won't need to do it again soon. (t (syntax-ppss--update-stats 3 pt-min pos) + (setq syntax-ppss--updated-cache t) ;; If `pt-min' is too far, add a few intermediate entries. (while (> (- pos pt-min) (* 2 syntax-ppss-max-span)) @@ -692,6 +714,7 @@ running the hook." (push pair ppss-cache) (setcar ppss-cache pair))))))))) + (setq syntax-ppss--updated-cache t) (setq ppss-last (cons pos ppss)) (setcar cell ppss-last) (setcdr cell ppss-cache) -- cgit v1.2.3 From 8f5d9d0abd0f5078646bc85c7a4d480b32057a47 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 26 Jun 2022 16:31:33 +0200 Subject: Fix a recent Lisp mode filling test failure * lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Restore the "fill first line separately" logic. --- lisp/emacs-lisp/lisp-mode.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 781c80fd5a0..6d5391d1e90 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1426,6 +1426,9 @@ and initial semicolons." ;; a comment: Point is on a program line; we are interested ;; particularly in docstring lines. ;; + ;; FIXME: The below bindings are probably mostly irrelevant + ;; since we're now narrowing to a region before filling. + ;; ;; We bind `paragraph-start' and `paragraph-separate' temporarily. They ;; are buffer-local, but we avoid changing them so that they can be set ;; to make `forward-paragraph' and friends do something the user wants. @@ -1485,6 +1488,15 @@ and initial semicolons." (1- (point))))) ;; Move back to where we were. (goto-char start) + ;; We should fill the first line of a string + ;; separately (since it's usually a doc string). + (if (= (line-number-at-pos) 1) + (narrow-to-region (line-beginning-position) + (line-beginning-position 2)) + (save-excursion + (goto-char (point-min)) + (forward-line 1) + (narrow-to-region (point) (point-max)))) (fill-paragraph justify))))))) ;; Never return nil. t) -- cgit v1.2.3 From f2a5d48e89bc5611c9cc9aeb978faacee32de6c8 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Sun, 26 Jun 2022 18:46:13 +0200 Subject: Optimise away functions in for-effect context * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Turn functions into nil when compiled for-effect since they have no side-effects on their own. This may enable further improvements such as the elimination of variable bindings. `unwind-protect` forms can be treated as plain function call at this point. In particular, their unwind function argument should be not optimised for effect since it's a function. --- lisp/emacs-lisp/byte-opt.el | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 1a50c5a43af..a8741c53bbf 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -406,7 +406,7 @@ for speeding up processing.") (`(function . ,_) ;; This forms is compiled as constant or by breaking out ;; all the subexpressions and compiling them separately. - form) + (and (not for-effect) form)) (`(condition-case ,var ,exp . ,clauses) `(,fn ,var ;Not evaluated. @@ -422,15 +422,13 @@ for speeding up processing.") (byte-optimize-body (cdr clause) for-effect)))) clauses))) - (`(unwind-protect ,exp :fun-body ,f) - ;; The unwinding part of an unwind-protect is compiled (and thus - ;; optimized) as a top-level form, but run the optimizer for it here - ;; anyway for lexical variable usage and substitution. But the - ;; protected part has the same for-effect status as the - ;; unwind-protect itself. (The unwinding part is always for effect, - ;; but that isn't handled properly yet.) - (let ((bodyform (byte-optimize-form exp for-effect))) - `(,fn ,bodyform :fun-body ,(byte-optimize-form f nil)))) + ;; `unwind-protect' is a special form which here takes the shape + ;; (unwind-protect EXPR :fun-body UNWIND-FUN). + ;; We can treat it as if it were a plain function at this point, + ;; although there are specific optimisations possible. + ;; In particular, the return value of UNWIND-FUN is never used + ;; so its body should really be compiled for-effect, but we + ;; don't do that right now. (`(catch ,tag . ,exps) `(,fn ,(byte-optimize-form tag nil) @@ -438,13 +436,15 @@ for speeding up processing.") ;; Needed as long as we run byte-optimize-form after cconv. (`(internal-make-closure . ,_) - ;; Look up free vars and mark them to be kept, so that they - ;; won't be optimised away. - (dolist (var (caddr form)) - (let ((lexvar (assq var byte-optimize--lexvars))) - (when lexvar - (setcar (cdr lexvar) t)))) - form) + (and (not for-effect) + (progn + ;; Look up free vars and mark them to be kept, so that they + ;; won't be optimised away. + (dolist (var (caddr form)) + (let ((lexvar (assq var byte-optimize--lexvars))) + (when lexvar + (setcar (cdr lexvar) t)))) + form))) (`((lambda . ,_) . ,_) (let ((newform (macroexp--unfold-lambda form))) -- cgit v1.2.3 From 513acdc9b4495c5273c55447c47d21534deffc7f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 27 Jun 2022 12:22:05 +0200 Subject: Allow plist-get/plist-put/plist-member to take a comparison function * doc/lispref/lists.texi (Plist Access): Document it. * lisp/filesets.el (filesets-reset-fileset) (filesets-ingroup-cache-get): (filesets-ingroup-cache-put): (filesets-build-menu-now): Don't use lax-plist functions. * lisp/simple.el (lax-plist-put, lax-plist-get): Moved here from fns.c and make obsolete. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Don't mark plist functions as side-effect-free or pure. * lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Adjust type. * lisp/emacs-lisp/shortdoc.el (list): Don't document deprecated functions. * src/xdisp.c (build_desired_tool_bar_string): (display_mode_element): (store_mode_line_string): (display_string): (produce_stretch_glyph): (note_mode_line_or_margin_highlight): (note_mouse_highlight): * src/w32.c (serial_configure): * src/sysdep.c (serial_configure): * src/sound.c (parse_sound): * src/process.c (Fset_process_buffer): (Fset_process_sentinel): (Fprocess_contact): (Fmake_process): (Fmake_pipe_process): (Fset_network_process_option): (Fserial_process_configure): (Fmake_serial_process): (set_network_socket_coding_system): (finish_after_tls_connection): (connect_network_socket): (Fmake_network_process): (server_accept_connection): * src/lread.c (ADDPARAM): (hash_table_from_plist): * src/keyboard.c (make_lispy_position): * src/indent.c (check_display_width): * src/image.c (postprocess_image): * src/gnutls.c (gnutls_verify_boot): (Fgnutls_boot): (gnutls_symmetric): (Fgnutls_hash_mac): (Fgnutls_hash_digest): * src/dired.c (filter): * src/data.c (add_to_function_history): * src/coding.c (Fcoding_system_put): Adjust callers from Fplist_put (etc) to plist_put. * src/fns.c (plist_get): (plist_put): (plist_member): New functions (without optional third parameter) to be used in C code. * src/fns.c (Fplist_get, Fplist_put, Fplist_member): Take an optional predicate parameter (bug#47425). * src/lisp.h: Declare new plist_put, plist_get and plist_member functions. * test/lisp/json-tests.el (test-json-add-to-plist): Use plist-get. * test/src/fns-tests.el (test-cycle-lax-plist-get): (test-cycle-lax-plist-put): (lax-plist-get/odd-number-of-elements): (test-plist): Remove lax-plist tests, since semantics have changed (they no longer error out on cycles). --- doc/lispref/lists.texi | 29 ++++---- etc/NEWS | 4 ++ lisp/emacs-lisp/byte-opt.el | 4 +- lisp/emacs-lisp/comp.el | 4 +- lisp/emacs-lisp/shortdoc.el | 5 -- lisp/filesets.el | 10 +-- lisp/simple.el | 9 +++ src/coding.c | 2 +- src/data.c | 2 +- src/dired.c | 4 +- src/fns.c | 131 ++++++++++++++++++----------------- src/gnutls.c | 32 ++++----- src/image.c | 4 +- src/indent.c | 8 +-- src/intervals.c | 4 +- src/keyboard.c | 2 +- src/lisp.h | 4 ++ src/lread.c | 4 +- src/process.c | 164 ++++++++++++++++++++++---------------------- src/sound.c | 8 +-- src/sysdep.c | 42 ++++++------ src/textprop.c | 8 +-- src/w32.c | 30 ++++---- src/w32fns.c | 10 +-- src/w32image.c | 4 +- src/xdisp.c | 60 ++++++++-------- test/lisp/json-tests.el | 4 +- test/src/fns-tests.el | 65 +++++------------- 28 files changed, 323 insertions(+), 334 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 4a862ab0de2..a4f0ba815b1 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1925,9 +1925,10 @@ and later discarded; this is not possible with a property list. The following functions can be used to manipulate property lists. They all compare property names using @code{eq}. -@defun plist-get plist property +@defun plist-get plist property &optional predicate This returns the value of the @var{property} property stored in the -property list @var{plist}. It accepts a malformed @var{plist} +property list @var{plist}. Comparisons are done with @var{predicate}, +and defaults to @code{eq}. It accepts a malformed @var{plist} argument. If @var{property} is not found in the @var{plist}, it returns @code{nil}. For example, @@ -1943,9 +1944,10 @@ returns @code{nil}. For example, @end example @end defun -@defun plist-put plist property value +@defun plist-put plist property value &optional predicate This stores @var{value} as the value of the @var{property} property in -the property list @var{plist}. It may modify @var{plist} destructively, +the property list @var{plist}. Comparisons are done with @var{predicate}, +and defaults to @code{eq}. It may modify @var{plist} destructively, or it may construct a new list structure without altering the old. The function returns the modified property list, so you can store that back in the place where you got @var{plist}. For example, @@ -1961,19 +1963,20 @@ in the place where you got @var{plist}. For example, @end defun @defun lax-plist-get plist property -Like @code{plist-get} except that it compares properties -using @code{equal} instead of @code{eq}. +This obsolete function is like @code{plist-get} except that it +compares properties using @code{equal} instead of @code{eq}. @end defun @defun lax-plist-put plist property value -Like @code{plist-put} except that it compares properties -using @code{equal} instead of @code{eq}. +This obsolete function is like @code{plist-put} except that it +compares properties using @code{equal} instead of @code{eq}. @end defun -@defun plist-member plist property +@defun plist-member plist property &optional predicate This returns non-@code{nil} if @var{plist} contains the given -@var{property}. Unlike @code{plist-get}, this allows you to distinguish -between a missing property and a property with the value @code{nil}. -The value is actually the tail of @var{plist} whose @code{car} is -@var{property}. +@var{property}. Comparisons are done with @var{predicate}, and +defaults to @code{eq}. Unlike @code{plist-get}, this allows you to +distinguish between a missing property and a property with the value +@code{nil}. The value is actually the tail of @var{plist} whose +@code{car} is @var{property}. @end defun diff --git a/etc/NEWS b/etc/NEWS index 57b72dc8468..831486bb79e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2150,6 +2150,10 @@ patcomp.el, pc-mode.el, pc-select.el, s-region.el, and sregex.el. * Lisp Changes in Emacs 29.1 ++++ +** 'plist-get', 'plist-put' and 'plist-member' are no longer limited to 'eq'. +These function now take an optional comparison predicate argument. + +++ ** 'read-multiple-choice' can now use long-form answers. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index a8741c53bbf..352ac40663c 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1361,7 +1361,7 @@ See Info node `(elisp) Integer Basics'." match-beginning match-end member memq memql min minibuffer-selected-window minibuffer-window mod multibyte-char-to-unibyte next-window nth nthcdr number-to-string - parse-colon-path plist-get plist-member + parse-colon-path prefix-numeric-value previous-window prin1-to-string propertize degrees-to-radians radians-to-degrees rassq rassoc read-from-string regexp-opt @@ -1483,7 +1483,7 @@ See Info node `(elisp) Integer Basics'." ;; `assoc' and `assoc-default' are excluded since they are ;; impure if the test function is (consider `string-match'). assq rassq rassoc - plist-get lax-plist-get plist-member + lax-plist-get aref elt base64-decode-string base64-encode-string base64url-encode-string bool-vector-subsetp diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 53803b38184..4ce2ce75e10 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -475,8 +475,8 @@ Useful to hook into pass checkers.") (one-window-p (function (&optional t t) boolean)) (overlayp (function (t) boolean)) (parse-colon-path (function (string) cons)) - (plist-get (function (list t) t)) - (plist-member (function (list t) list)) + (plist-get (function (list t &optional t) t)) + (plist-member (function (list t &optional t) list)) (point (function () integer)) (point-marker (function () marker)) (point-max (function () integer)) diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index a1256ce1b8b..d0f06358872 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -691,11 +691,6 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'), (plist-put :no-eval (setq plist (plist-put plist 'd 4)) :eq-result (a 1 b 2 c 3 d 4)) - (lax-plist-get - :eval (lax-plist-get '("a" 1 "b" 2 "c" 3) "b")) - (lax-plist-put - :no-eval (setq plist (lax-plist-put plist "d" 4)) - :eq-result '("a" 1 "b" 2 "c" 3 "d" 4)) (plist-member :eval (plist-member '(a 1 b 2 c 3) 'b)) "Data About Lists" diff --git a/lisp/filesets.el b/lisp/filesets.el index 83a914d58cc..b97dda3cd61 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -208,7 +208,7 @@ COND-FN takes one argument: the current element." (defun filesets-reset-fileset (&optional fileset no-cache) "Reset the cached values for one or all filesets." (setq filesets-submenus (if fileset - (lax-plist-put filesets-submenus fileset nil) + (plist-put filesets-submenus fileset nil #'equal) nil)) (setq filesets-has-changed-flag t) (setq filesets-update-cache-file-flag (or filesets-update-cache-file-flag @@ -1999,7 +1999,7 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings." (defun filesets-ingroup-cache-get (master) "Access to `filesets-ingroup-cache'." - (lax-plist-get filesets-ingroup-cache master)) + (plist-get filesets-ingroup-cache master #'equal)) (defun filesets-ingroup-cache-put (master file) "Access to `filesets-ingroup-cache'." @@ -2008,7 +2008,7 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings." (cons file (filesets-ingroup-cache-get emaster)) nil))) (setq filesets-ingroup-cache - (lax-plist-put filesets-ingroup-cache emaster this)))) + (plist-put filesets-ingroup-cache emaster this #'equal)))) (defun filesets-ingroup-collect-files (fs &optional remdupl-flag master depth) "Helper function for `filesets-ingroup-collect'. Collect file names." @@ -2305,12 +2305,12 @@ bottom up, set `filesets-submenus' to nil, first.)" ((null data)) (let* ((this (car data)) (name (filesets-data-get-name this)) - (cached (lax-plist-get filesets-submenus name)) + (cached (plist-get filesets-submenus name #'equal)) (submenu (or cached (filesets-build-submenu count name this)))) (unless cached (setq filesets-submenus - (lax-plist-put filesets-submenus name submenu))) + (plist-put filesets-submenus name submenu #'equal))) (unless (filesets-entry-get-dormant-flag this) (setq filesets-menu-cache (append filesets-menu-cache (list submenu)))))) diff --git a/lisp/simple.el b/lisp/simple.el index 6d62c028657..83185c4e1a8 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -10640,6 +10640,15 @@ If the buffer doesn't exist, create it first." (string-to-number value) (intern (concat "sig" (downcase value)))))) +(defun lax-plist-get (plist prop) + "Extract a value from a property list, comparing with `equal'." + (declare (obsolete plist-get "29.1")) + (plist-get plist prop #'equal)) + +(defun lax-plist-put (plist prop val) + "Change value in PLIST of PROP to VAL, comparing with `equal'." + (declare (obsolete plist-put "29.1")) + (plist-put plist prop val #'equal)) (provide 'simple) diff --git a/src/coding.c b/src/coding.c index 68f3201de80..3fb4f148b1c 100644 --- a/src/coding.c +++ b/src/coding.c @@ -11499,7 +11499,7 @@ DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put, } ASET (attrs, coding_attr_plist, - Fplist_put (CODING_ATTR_PLIST (attrs), prop, val)); + plist_put (CODING_ATTR_PLIST (attrs), prop, val)); return val; } diff --git a/src/data.c b/src/data.c index d665da04da6..1dbec4687b8 100644 --- a/src/data.c +++ b/src/data.c @@ -874,7 +874,7 @@ add_to_function_history (Lisp_Object symbol, Lisp_Object olddef) if (NILP (XCDR (tail)) && STRINGP (XCAR (tail))) file = XCAR (tail); - Lisp_Object tem = Fplist_member (past, file); + Lisp_Object tem = plist_member (past, file); if (!NILP (tem)) { /* New def from a file used before. Overwrite the previous record associated with this file. */ diff --git a/src/dired.c b/src/dired.c index e31ad9121c9..6bb8c2fcb9f 100644 --- a/src/dired.c +++ b/src/dired.c @@ -482,8 +482,8 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, decoded names in order to filter false positives, such as "a" falsely matching "a-ring". */ if (!NILP (file_encoding) - && !NILP (Fplist_get (Fcoding_system_plist (file_encoding), - Qdecomposed_characters))) + && !NILP (plist_get (Fcoding_system_plist (file_encoding), + Qdecomposed_characters))) { check_decoded = true; if (STRING_MULTIBYTE (file)) diff --git a/src/fns.c b/src/fns.c index 5ee8482d003..6be6b6d6167 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2276,24 +2276,27 @@ merge_c (Lisp_Object org_l1, Lisp_Object org_l2, bool (*less) (Lisp_Object, Lisp /* This does not check for quits. That is safe since it must terminate. */ -DEFUN ("plist-get", Fplist_get, Splist_get, 2, 2, 0, +DEFUN ("plist-get", Fplist_get, Splist_get, 2, 3, 0, doc: /* Extract a value from a property list. PLIST is a property list, which is a list of the form \(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value corresponding to the given PROP, or nil if PROP is not one of the properties on the list. The comparison -with PROP is done using `eq'. +with PROP is done using PREDICATE, which defaults to `eq'. -This function never signals an error. */) - (Lisp_Object plist, Lisp_Object prop) +This function doesn't signal an error if PLIST is invalid. */) + (Lisp_Object plist, Lisp_Object prop, Lisp_Object predicate) { Lisp_Object tail = plist; + if (NILP (predicate)) + return plist_get (plist, prop); + FOR_EACH_TAIL_SAFE (tail) { if (! CONSP (XCDR (tail))) break; - if (EQ (prop, XCAR (tail))) + if (!NILP (call2 (predicate, prop, XCAR (tail)))) return XCAR (XCDR (tail)); tail = XCDR (tail); } @@ -2301,39 +2304,58 @@ This function never signals an error. */) return Qnil; } +/* Faster version of the above that works with EQ only */ +Lisp_Object +plist_get (Lisp_Object plist, Lisp_Object prop) +{ + Lisp_Object tail = plist; + FOR_EACH_TAIL_SAFE (tail) + { + if (! CONSP (XCDR (tail))) + break; + if (EQ (prop, XCAR (tail))) + return XCAR (XCDR (tail)); + tail = XCDR (tail); + } + return Qnil; +} + DEFUN ("get", Fget, Sget, 2, 2, 0, doc: /* Return the value of SYMBOL's PROPNAME property. This is the last value stored with `(put SYMBOL PROPNAME VALUE)'. */) (Lisp_Object symbol, Lisp_Object propname) { CHECK_SYMBOL (symbol); - Lisp_Object propval = Fplist_get (CDR (Fassq (symbol, Voverriding_plist_environment)), - propname); + Lisp_Object propval = plist_get (CDR (Fassq (symbol, + Voverriding_plist_environment)), + propname); if (!NILP (propval)) return propval; - return Fplist_get (XSYMBOL (symbol)->u.s.plist, propname); + return plist_get (XSYMBOL (symbol)->u.s.plist, propname); } -DEFUN ("plist-put", Fplist_put, Splist_put, 3, 3, 0, +DEFUN ("plist-put", Fplist_put, Splist_put, 3, 4, 0, doc: /* Change value in PLIST of PROP to VAL. PLIST is a property list, which is a list of the form \(PROP1 VALUE1 PROP2 VALUE2 ...). -The comparison with PROP is done using `eq'. +The comparison with PROP is done using PREDICATE, which defaults to `eq'. If PROP is already a property on the list, its value is set to VAL, otherwise the new PROP VAL pair is added. The new plist is returned; use `(setq x (plist-put x prop val))' to be sure to use the new value. The PLIST is modified by side effects. */) - (Lisp_Object plist, Lisp_Object prop, Lisp_Object val) + (Lisp_Object plist, Lisp_Object prop, Lisp_Object val, Lisp_Object predicate) { Lisp_Object prev = Qnil, tail = plist; + if (NILP (predicate)) + return plist_put (plist, prop, val); FOR_EACH_TAIL (tail) { if (! CONSP (XCDR (tail))) break; - if (EQ (prop, XCAR (tail))) + if (!NILP (call2 (predicate, prop, XCAR (tail)))) { Fsetcar (XCDR (tail), val); return plist; @@ -2351,47 +2373,8 @@ The PLIST is modified by side effects. */) return plist; } -DEFUN ("put", Fput, Sput, 3, 3, 0, - doc: /* Store SYMBOL's PROPNAME property with value VALUE. -It can be retrieved with `(get SYMBOL PROPNAME)'. */) - (Lisp_Object symbol, Lisp_Object propname, Lisp_Object value) -{ - CHECK_SYMBOL (symbol); - set_symbol_plist - (symbol, Fplist_put (XSYMBOL (symbol)->u.s.plist, propname, value)); - return value; -} - -DEFUN ("lax-plist-get", Flax_plist_get, Slax_plist_get, 2, 2, 0, - doc: /* Extract a value from a property list, comparing with `equal'. -This function is otherwise like `plist-get', but may signal an error -if PLIST isn't a valid plist. */) - (Lisp_Object plist, Lisp_Object prop) -{ - Lisp_Object tail = plist; - FOR_EACH_TAIL (tail) - { - if (! CONSP (XCDR (tail))) - break; - if (! NILP (Fequal (prop, XCAR (tail)))) - return XCAR (XCDR (tail)); - tail = XCDR (tail); - } - - CHECK_TYPE (NILP (tail), Qplistp, plist); - - return Qnil; -} - -DEFUN ("lax-plist-put", Flax_plist_put, Slax_plist_put, 3, 3, 0, - doc: /* Change value in PLIST of PROP to VAL, comparing with `equal'. -PLIST is a property list, which is a list of the form -\(PROP1 VALUE1 PROP2 VALUE2 ...). PROP and VAL are any objects. -If PROP is already a property on the list, its value is set to VAL, -otherwise the new PROP VAL pair is added. The new plist is returned; -use `(setq x (lax-plist-put x prop val))' to be sure to use the new value. -The PLIST is modified by side effects. */) - (Lisp_Object plist, Lisp_Object prop, Lisp_Object val) +Lisp_Object +plist_put (Lisp_Object plist, Lisp_Object prop, Lisp_Object val) { Lisp_Object prev = Qnil, tail = plist; FOR_EACH_TAIL (tail) @@ -2399,7 +2382,7 @@ The PLIST is modified by side effects. */) if (! CONSP (XCDR (tail))) break; - if (! NILP (Fequal (prop, XCAR (tail)))) + if (EQ (prop, XCAR (tail))) { Fsetcar (XCDR (tail), val); return plist; @@ -2409,12 +2392,24 @@ The PLIST is modified by side effects. */) tail = XCDR (tail); } CHECK_TYPE (NILP (tail), Qplistp, plist); - Lisp_Object newcell = list2 (prop, val); + Lisp_Object newcell + = Fcons (prop, Fcons (val, NILP (prev) ? plist : XCDR (XCDR (prev)))); if (NILP (prev)) return newcell; Fsetcdr (XCDR (prev), newcell); return plist; } + +DEFUN ("put", Fput, Sput, 3, 3, 0, + doc: /* Store SYMBOL's PROPNAME property with value VALUE. +It can be retrieved with `(get SYMBOL PROPNAME)'. */) + (Lisp_Object symbol, Lisp_Object propname, Lisp_Object value) +{ + CHECK_SYMBOL (symbol); + set_symbol_plist + (symbol, plist_put (XSYMBOL (symbol)->u.s.plist, propname, value)); + return value; +} DEFUN ("eql", Feql, Seql, 2, 2, 0, doc: /* Return t if the two args are `eq' or are indistinguishable numbers. @@ -3183,22 +3178,25 @@ FILENAME are suppressed. */) bottleneck of Widget operation. Here is their translation to C, for the sole reason of efficiency. */ -DEFUN ("plist-member", Fplist_member, Splist_member, 2, 2, 0, +DEFUN ("plist-member", Fplist_member, Splist_member, 2, 3, 0, doc: /* Return non-nil if PLIST has the property PROP. PLIST is a property list, which is a list of the form \(PROP1 VALUE1 PROP2 VALUE2 ...). -The comparison with PROP is done using `eq'. +The comparison with PROP is done using PREDICATE, which defaults to +`eq'. Unlike `plist-get', this allows you to distinguish between a missing property and a property with the value nil. The value is actually the tail of PLIST whose car is PROP. */) - (Lisp_Object plist, Lisp_Object prop) + (Lisp_Object plist, Lisp_Object prop, Lisp_Object predicate) { Lisp_Object tail = plist; + if (NILP (predicate)) + predicate = Qeq; FOR_EACH_TAIL (tail) { - if (EQ (XCAR (tail), prop)) + if (!NILP (call2 (predicate, XCAR (tail), prop))) return tail; tail = XCDR (tail); if (! CONSP (tail)) @@ -3208,13 +3206,22 @@ The value is actually the tail of PLIST whose car is PROP. */) return Qnil; } +/* plist_member isn't used much in the Emacs sources, so just provide + a shim so that the function name follows the same pattern as + plist_get/plist_put. */ +Lisp_Object +plist_member (Lisp_Object plist, Lisp_Object prop) +{ + return Fplist_member (plist, prop, Qnil); +} + DEFUN ("widget-put", Fwidget_put, Swidget_put, 3, 3, 0, doc: /* In WIDGET, set PROPERTY to VALUE. The value can later be retrieved with `widget-get'. */) (Lisp_Object widget, Lisp_Object property, Lisp_Object value) { CHECK_CONS (widget); - XSETCDR (widget, Fplist_put (XCDR (widget), property, value)); + XSETCDR (widget, plist_put (XCDR (widget), property, value)); return value; } @@ -3231,7 +3238,7 @@ later with `widget-put'. */) if (NILP (widget)) return Qnil; CHECK_CONS (widget); - tmp = Fplist_member (XCDR (widget), property); + tmp = plist_member (XCDR (widget), property); if (CONSP (tmp)) { tmp = XCDR (tmp); @@ -6064,8 +6071,6 @@ The same variable also affects the function `read-answer'. */); defsubr (&Sget); defsubr (&Splist_put); defsubr (&Sput); - defsubr (&Slax_plist_get); - defsubr (&Slax_plist_put); defsubr (&Seql); defsubr (&Sequal); defsubr (&Sequal_including_properties); diff --git a/src/gnutls.c b/src/gnutls.c index 0e1e63e157a..a0de0238c47 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -1635,10 +1635,10 @@ gnutls_verify_boot (Lisp_Object proc, Lisp_Object proplist) char *c_hostname; if (NILP (proplist)) - proplist = Fcdr (Fplist_get (p->childp, QCtls_parameters)); + proplist = Fcdr (plist_get (p->childp, QCtls_parameters)); - verify_error = Fplist_get (proplist, QCverify_error); - hostname = Fplist_get (proplist, QChostname); + verify_error = plist_get (proplist, QCverify_error); + hostname = plist_get (proplist, QChostname); if (EQ (verify_error, Qt)) verify_error_all = true; @@ -1668,7 +1668,7 @@ gnutls_verify_boot (Lisp_Object proc, Lisp_Object proplist) p->gnutls_peer_verification = peer_verification; - warnings = Fplist_get (Fgnutls_peer_status (proc), intern (":warnings")); + warnings = plist_get (Fgnutls_peer_status (proc), intern (":warnings")); if (!NILP (warnings)) { for (Lisp_Object tail = warnings; CONSP (tail); tail = XCDR (tail)) @@ -1870,13 +1870,13 @@ one trustfile (usually a CA bundle). */) return Qnil; } - hostname = Fplist_get (proplist, QChostname); - priority_string = Fplist_get (proplist, QCpriority); - trustfiles = Fplist_get (proplist, QCtrustfiles); - keylist = Fplist_get (proplist, QCkeylist); - crlfiles = Fplist_get (proplist, QCcrlfiles); - loglevel = Fplist_get (proplist, QCloglevel); - prime_bits = Fplist_get (proplist, QCmin_prime_bits); + hostname = plist_get (proplist, QChostname); + priority_string = plist_get (proplist, QCpriority); + trustfiles = plist_get (proplist, QCtrustfiles); + keylist = plist_get (proplist, QCkeylist); + crlfiles = plist_get (proplist, QCcrlfiles); + loglevel = plist_get (proplist, QCloglevel); + prime_bits = plist_get (proplist, QCmin_prime_bits); if (!STRINGP (hostname)) { @@ -1929,7 +1929,7 @@ one trustfile (usually a CA bundle). */) check_memory_full (gnutls_certificate_allocate_credentials (&x509_cred)); XPROCESS (proc)->gnutls_x509_cred = x509_cred; - verify_flags = Fplist_get (proplist, QCverify_flags); + verify_flags = plist_get (proplist, QCverify_flags); if (TYPE_RANGED_FIXNUMP (unsigned int, verify_flags)) { gnutls_verify_flags = XFIXNAT (verify_flags); @@ -2109,7 +2109,7 @@ one trustfile (usually a CA bundle). */) } XPROCESS (proc)->gnutls_complete_negotiation_p = - !NILP (Fplist_get (proplist, QCcomplete_negotiation)); + !NILP (plist_get (proplist, QCcomplete_negotiation)); GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_CRED_SET; ret = emacs_gnutls_handshake (XPROCESS (proc)); if (ret < GNUTLS_E_SUCCESS) @@ -2348,7 +2348,7 @@ gnutls_symmetric (bool encrypting, Lisp_Object cipher, if (!NILP (info) && CONSP (info)) { - Lisp_Object v = Fplist_get (info, QCcipher_id); + Lisp_Object v = plist_get (info, QCcipher_id); if (TYPE_RANGED_FIXNUMP (gnutls_cipher_algorithm_t, v)) gca = XFIXNUM (v); } @@ -2625,7 +2625,7 @@ itself. */) if (!NILP (info) && CONSP (info)) { - Lisp_Object v = Fplist_get (info, QCmac_algorithm_id); + Lisp_Object v = plist_get (info, QCmac_algorithm_id); if (TYPE_RANGED_FIXNUMP (gnutls_mac_algorithm_t, v)) gma = XFIXNUM (v); } @@ -2715,7 +2715,7 @@ the number itself. */) if (!NILP (info) && CONSP (info)) { - Lisp_Object v = Fplist_get (info, QCdigest_algorithm_id); + Lisp_Object v = plist_get (info, QCdigest_algorithm_id); if (TYPE_RANGED_FIXNUMP (gnutls_digest_algorithm_t, v)) gda = XFIXNUM (v); } diff --git a/src/image.c b/src/image.c index fcf5e97b0b1..c0a7b85cb3b 100644 --- a/src/image.c +++ b/src/image.c @@ -2309,8 +2309,8 @@ postprocess_image (struct frame *f, struct image *img) tem = XCDR (conversion); if (CONSP (tem)) image_edge_detection (f, img, - Fplist_get (tem, QCmatrix), - Fplist_get (tem, QCcolor_adjustment)); + plist_get (tem, QCmatrix), + plist_get (tem, QCcolor_adjustment)); } } } diff --git a/src/indent.c b/src/indent.c index c3d78518c43..d4ef075f001 100644 --- a/src/indent.c +++ b/src/indent.c @@ -484,15 +484,15 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos) : MOST_POSITIVE_FIXNUM); plist = XCDR (val); - if ((prop = Fplist_get (plist, QCwidth), + if ((prop = plist_get (plist, QCwidth), RANGED_FIXNUMP (0, prop, INT_MAX)) - || (prop = Fplist_get (plist, QCrelative_width), + || (prop = plist_get (plist, QCrelative_width), RANGED_FIXNUMP (0, prop, INT_MAX))) width = XFIXNUM (prop); else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop) && XFLOAT_DATA (prop) <= INT_MAX) width = (int)(XFLOAT_DATA (prop) + 0.5); - else if ((prop = Fplist_get (plist, QCalign_to), + else if ((prop = plist_get (plist, QCalign_to), RANGED_FIXNUMP (col, prop, align_to_max))) width = XFIXNUM (prop) - col; else if (FLOATP (prop) && col <= XFLOAT_DATA (prop) @@ -514,7 +514,7 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos) /* For :relative-width, we need to multiply by the column width of the character at POS, if it is greater than 1. */ if (!NILP (plist) - && !NILP (Fplist_get (plist, QCrelative_width)) + && !NILP (plist_get (plist, QCrelative_width)) && !NILP (BVAR (current_buffer, enable_multibyte_characters))) { int b, wd; diff --git a/src/intervals.c b/src/intervals.c index 9e28637d6bc..85152c58a5d 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -1737,11 +1737,11 @@ lookup_char_property (Lisp_Object plist, Lisp_Object prop, bool textprop) { tail = XCDR (tail); for (; NILP (fallback) && CONSP (tail); tail = XCDR (tail)) - fallback = Fplist_get (plist, XCAR (tail)); + fallback = plist_get (plist, XCAR (tail)); } if (textprop && NILP (fallback) && CONSP (Vdefault_text_properties)) - fallback = Fplist_get (Vdefault_text_properties, prop); + fallback = plist_get (Vdefault_text_properties, prop); return fallback; } diff --git a/src/keyboard.c b/src/keyboard.c index 5b5972ceee4..e5708c06d93 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5601,7 +5601,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, if (IMAGEP (object)) { Lisp_Object image_map, hotspot; - if ((image_map = Fplist_get (XCDR (object), QCmap), + if ((image_map = plist_get (XCDR (object), QCmap), !NILP (image_map)) && (hotspot = find_hot_spot (image_map, dx, dy), CONSP (hotspot)) diff --git a/src/lisp.h b/src/lisp.h index 05b0754ff65..7a7d2e79979 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4034,6 +4034,10 @@ extern ptrdiff_t string_char_to_byte (Lisp_Object, ptrdiff_t); extern ptrdiff_t string_byte_to_char (Lisp_Object, ptrdiff_t); extern Lisp_Object string_to_multibyte (Lisp_Object); extern Lisp_Object string_make_unibyte (Lisp_Object); +extern Lisp_Object plist_get (Lisp_Object plist, Lisp_Object prop); +extern Lisp_Object plist_put (Lisp_Object plist, Lisp_Object prop, + Lisp_Object val); +extern Lisp_Object plist_member (Lisp_Object plist, Lisp_Object prop); extern void syms_of_fns (void); /* Defined in sort.c */ diff --git a/src/lread.c b/src/lread.c index a00590e466a..66b13916465 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3175,7 +3175,7 @@ hash_table_from_plist (Lisp_Object plist) /* This is repetitive but fast and simple. */ #define ADDPARAM(name) \ do { \ - Lisp_Object val = Fplist_get (plist, Q ## name); \ + Lisp_Object val = plist_get (plist, Q ## name); \ if (!NILP (val)) \ { \ *par++ = QC ## name; \ @@ -3190,7 +3190,7 @@ hash_table_from_plist (Lisp_Object plist) ADDPARAM (rehash_threshold); ADDPARAM (purecopy); - Lisp_Object data = Fplist_get (plist, Qdata); + Lisp_Object data = plist_get (plist, Qdata); /* Now use params to make a new hash table and fill it. */ Lisp_Object ht = Fmake_hash_table (par - params, params); diff --git a/src/process.c b/src/process.c index f9a32e0d6a0..af402c8edb3 100644 --- a/src/process.c +++ b/src/process.c @@ -1281,7 +1281,7 @@ Return BUFFER. */) update_process_mark (p); } if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p)) - pset_childp (p, Fplist_put (p->childp, QCbuffer, buffer)); + pset_childp (p, plist_put (p->childp, QCbuffer, buffer)); setup_process_coding_systems (process); return buffer; } @@ -1360,7 +1360,7 @@ The string argument is normally a multibyte string, except: pset_filter (p, filter); if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p)) - pset_childp (p, Fplist_put (p->childp, QCfilter, filter)); + pset_childp (p, plist_put (p->childp, QCfilter, filter)); setup_process_coding_systems (process); return filter; } @@ -1392,7 +1392,7 @@ It gets two arguments: the process, and a string describing the change. */) pset_sentinel (p, sentinel); if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p)) - pset_childp (p, Fplist_put (p->childp, QCsentinel, sentinel)); + pset_childp (p, plist_put (p->childp, QCsentinel, sentinel)); return sentinel; } @@ -1553,25 +1553,25 @@ waiting for the process to be fully set up.*/) if (DATAGRAM_CONN_P (process) && (EQ (key, Qt) || EQ (key, QCremote))) - contact = Fplist_put (contact, QCremote, - Fprocess_datagram_address (process)); + contact = plist_put (contact, QCremote, + Fprocess_datagram_address (process)); #endif if ((!NETCONN_P (process) && !SERIALCONN_P (process) && !PIPECONN_P (process)) || EQ (key, Qt)) return contact; if (NILP (key) && NETCONN_P (process)) - return list2 (Fplist_get (contact, QChost), - Fplist_get (contact, QCservice)); + return list2 (plist_get (contact, QChost), + plist_get (contact, QCservice)); if (NILP (key) && SERIALCONN_P (process)) - return list2 (Fplist_get (contact, QCport), - Fplist_get (contact, QCspeed)); + return list2 (plist_get (contact, QCport), + plist_get (contact, QCspeed)); /* FIXME: Return a meaningful value (e.g., the child end of the pipe) if the pipe process is useful for purposes other than receiving stderr. */ if (NILP (key) && PIPECONN_P (process)) return Qt; - return Fplist_get (contact, key); + return plist_get (contact, key); } DEFUN ("process-plist", Fprocess_plist, Sprocess_plist, @@ -1773,7 +1773,7 @@ usage: (make-process &rest ARGS) */) /* Save arguments for process-contact and clone-process. */ contact = Flist (nargs, args); - if (!NILP (Fplist_get (contact, QCfile_handler))) + if (!NILP (plist_get (contact, QCfile_handler))) { Lisp_Object file_handler = Ffind_file_name_handler (BVAR (current_buffer, directory), @@ -1782,7 +1782,7 @@ usage: (make-process &rest ARGS) */) return CALLN (Fapply, file_handler, Qmake_process, contact); } - buffer = Fplist_get (contact, QCbuffer); + buffer = plist_get (contact, QCbuffer); if (!NILP (buffer)) buffer = Fget_buffer_create (buffer, Qnil); @@ -1792,10 +1792,10 @@ usage: (make-process &rest ARGS) */) chdir, since it's in a vfork. */ current_dir = get_current_directory (true); - name = Fplist_get (contact, QCname); + name = plist_get (contact, QCname); CHECK_STRING (name); - command = Fplist_get (contact, QCcommand); + command = plist_get (contact, QCcommand); if (CONSP (command)) program = XCAR (command); else @@ -1804,10 +1804,10 @@ usage: (make-process &rest ARGS) */) if (!NILP (program)) CHECK_STRING (program); - bool query_on_exit = NILP (Fplist_get (contact, QCnoquery)); + bool query_on_exit = NILP (plist_get (contact, QCnoquery)); stderrproc = Qnil; - xstderr = Fplist_get (contact, QCstderr); + xstderr = plist_get (contact, QCstderr); if (PROCESSP (xstderr)) { if (!PIPECONN_P (xstderr)) @@ -1833,18 +1833,18 @@ usage: (make-process &rest ARGS) */) eassert (NILP (XPROCESS (proc)->plist)); pset_type (XPROCESS (proc), Qreal); pset_buffer (XPROCESS (proc), buffer); - pset_sentinel (XPROCESS (proc), Fplist_get (contact, QCsentinel)); - pset_filter (XPROCESS (proc), Fplist_get (contact, QCfilter)); + pset_sentinel (XPROCESS (proc), plist_get (contact, QCsentinel)); + pset_filter (XPROCESS (proc), plist_get (contact, QCfilter)); pset_command (XPROCESS (proc), Fcopy_sequence (command)); if (!query_on_exit) XPROCESS (proc)->kill_without_query = 1; - tem = Fplist_get (contact, QCstop); + tem = plist_get (contact, QCstop); /* Normal processes can't be started in a stopped state, see Bug#30460. */ CHECK_TYPE (NILP (tem), Qnull, tem); - tem = Fplist_get (contact, QCconnection_type); + tem = plist_get (contact, QCconnection_type); if (EQ (tem, Qpty)) XPROCESS (proc)->pty_flag = true; else if (EQ (tem, Qpipe)) @@ -1886,7 +1886,7 @@ usage: (make-process &rest ARGS) */) Lisp_Object coding_systems = Qt; Lisp_Object val, *args2; - tem = Fplist_get (contact, QCcoding); + tem = plist_get (contact, QCcoding); if (!NILP (tem)) { val = tem; @@ -2364,7 +2364,7 @@ usage: (make-pipe-process &rest ARGS) */) contact = Flist (nargs, args); - name = Fplist_get (contact, QCname); + name = plist_get (contact, QCname); CHECK_STRING (name); proc = make_process (name); specpdl_ref specpdl_count = SPECPDL_INDEX (); @@ -2396,21 +2396,21 @@ usage: (make-pipe-process &rest ARGS) */) if (inchannel > max_desc) max_desc = inchannel; - buffer = Fplist_get (contact, QCbuffer); + buffer = plist_get (contact, QCbuffer); if (NILP (buffer)) buffer = name; buffer = Fget_buffer_create (buffer, Qnil); pset_buffer (p, buffer); pset_childp (p, contact); - pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist))); + pset_plist (p, Fcopy_sequence (plist_get (contact, QCplist))); pset_type (p, Qpipe); - pset_sentinel (p, Fplist_get (contact, QCsentinel)); - pset_filter (p, Fplist_get (contact, QCfilter)); + pset_sentinel (p, plist_get (contact, QCsentinel)); + pset_filter (p, plist_get (contact, QCfilter)); eassert (NILP (p->log)); - if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) + if (tem = plist_get (contact, QCnoquery), !NILP (tem)) p->kill_without_query = 1; - if (tem = Fplist_get (contact, QCstop), !NILP (tem)) + if (tem = plist_get (contact, QCstop), !NILP (tem)) pset_command (p, Qt); eassert (! p->pty_flag); @@ -2431,7 +2431,7 @@ usage: (make-pipe-process &rest ARGS) */) Lisp_Object coding_systems = Qt; Lisp_Object val; - tem = Fplist_get (contact, QCcoding); + tem = plist_get (contact, QCcoding); val = Qnil; if (!NILP (tem)) { @@ -2918,7 +2918,7 @@ set up yet, this function will block until socket setup has completed. */) if (set_socket_option (s, option, value)) { - pset_childp (p, Fplist_put (p->childp, option, value)); + pset_childp (p, plist_put (p->childp, option, value)); return Qt; } @@ -2996,19 +2996,19 @@ usage: (serial-process-configure &rest ARGS) */) contact = Flist (nargs, args); - proc = Fplist_get (contact, QCprocess); + proc = plist_get (contact, QCprocess); if (NILP (proc)) - proc = Fplist_get (contact, QCname); + proc = plist_get (contact, QCname); if (NILP (proc)) - proc = Fplist_get (contact, QCbuffer); + proc = plist_get (contact, QCbuffer); if (NILP (proc)) - proc = Fplist_get (contact, QCport); + proc = plist_get (contact, QCport); proc = get_process (proc); p = XPROCESS (proc); if (!EQ (p->type, Qserial)) error ("Not a serial process"); - if (NILP (Fplist_get (p->childp, QCspeed))) + if (NILP (plist_get (p->childp, QCspeed))) return Qnil; serial_configure (p, contact); @@ -3101,17 +3101,17 @@ usage: (make-serial-process &rest ARGS) */) contact = Flist (nargs, args); - port = Fplist_get (contact, QCport); + port = plist_get (contact, QCport); if (NILP (port)) error ("No port specified"); CHECK_STRING (port); - if (NILP (Fplist_member (contact, QCspeed))) + if (NILP (plist_member (contact, QCspeed))) error (":speed not specified"); - if (!NILP (Fplist_get (contact, QCspeed))) - CHECK_FIXNUM (Fplist_get (contact, QCspeed)); + if (!NILP (plist_get (contact, QCspeed))) + CHECK_FIXNUM (plist_get (contact, QCspeed)); - name = Fplist_get (contact, QCname); + name = plist_get (contact, QCname); if (NILP (name)) name = port; CHECK_STRING (name); @@ -3131,21 +3131,21 @@ usage: (make-serial-process &rest ARGS) */) eassert (0 <= fd && fd < FD_SETSIZE); chan_process[fd] = proc; - buffer = Fplist_get (contact, QCbuffer); + buffer = plist_get (contact, QCbuffer); if (NILP (buffer)) buffer = name; buffer = Fget_buffer_create (buffer, Qnil); pset_buffer (p, buffer); pset_childp (p, contact); - pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist))); + pset_plist (p, Fcopy_sequence (plist_get (contact, QCplist))); pset_type (p, Qserial); - pset_sentinel (p, Fplist_get (contact, QCsentinel)); - pset_filter (p, Fplist_get (contact, QCfilter)); + pset_sentinel (p, plist_get (contact, QCsentinel)); + pset_filter (p, plist_get (contact, QCfilter)); eassert (NILP (p->log)); - if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) + if (tem = plist_get (contact, QCnoquery), !NILP (tem)) p->kill_without_query = 1; - if (tem = Fplist_get (contact, QCstop), !NILP (tem)) + if (tem = plist_get (contact, QCstop), !NILP (tem)) pset_command (p, Qt); eassert (! p->pty_flag); @@ -3155,7 +3155,7 @@ usage: (make-serial-process &rest ARGS) */) update_process_mark (p); - tem = Fplist_get (contact, QCcoding); + tem = plist_get (contact, QCcoding); val = Qnil; if (!NILP (tem)) @@ -3209,7 +3209,7 @@ set_network_socket_coding_system (Lisp_Object proc, Lisp_Object host, Lisp_Object coding_systems = Qt; Lisp_Object val; - tem = Fplist_get (contact, QCcoding); + tem = plist_get (contact, QCcoding); /* Setup coding systems for communicating with the network stream. */ /* Qt denotes we have not yet called Ffind_operation_coding_system. */ @@ -3297,8 +3297,8 @@ finish_after_tls_connection (Lisp_Object proc) if (!NILP (Ffboundp (Qnsm_verify_connection))) result = call3 (Qnsm_verify_connection, proc, - Fplist_get (contact, QChost), - Fplist_get (contact, QCservice)); + plist_get (contact, QChost), + plist_get (contact, QCservice)); eassert (p->outfd < FD_SETSIZE); if (NILP (result)) @@ -3479,7 +3479,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, if (getsockname (s, psa1, &len1) == 0) { Lisp_Object service = make_fixnum (ntohs (sa1.sin_port)); - contact = Fplist_put (contact, QCservice, service); + contact = plist_put (contact, QCservice, service); /* Save the port number so that we can stash it in the process object later. */ DECLARE_POINTER_ALIAS (psa, struct sockaddr_in, sa); @@ -3570,7 +3570,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, { Lisp_Object remote; memset (datagram_address[s].sa, 0, addrlen); - if (remote = Fplist_get (contact, QCremote), !NILP (remote)) + if (remote = plist_get (contact, QCremote), !NILP (remote)) { int rfamily; ptrdiff_t rlen = get_lisp_to_sockaddr_size (remote, &rfamily); @@ -3585,8 +3585,8 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, } #endif - contact = Fplist_put (contact, p->is_server? QClocal: QCremote, - conv_sockaddr_to_lisp (sa, addrlen)); + contact = plist_put (contact, p->is_server? QClocal: QCremote, + conv_sockaddr_to_lisp (sa, addrlen)); #ifdef HAVE_GETSOCKNAME if (!p->is_server) { @@ -3594,8 +3594,8 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, socklen_t len1 = sizeof (sa1); DECLARE_POINTER_ALIAS (psa1, struct sockaddr, &sa1); if (getsockname (s, psa1, &len1) == 0) - contact = Fplist_put (contact, QClocal, - conv_sockaddr_to_lisp (psa1, len1)); + contact = plist_put (contact, QClocal, + conv_sockaddr_to_lisp (psa1, len1)); } #endif } @@ -3908,7 +3908,7 @@ usage: (make-network-process &rest ARGS) */) #endif /* :type TYPE (nil: stream, datagram */ - tem = Fplist_get (contact, QCtype); + tem = plist_get (contact, QCtype); if (NILP (tem)) socktype = SOCK_STREAM; #ifdef DATAGRAM_SOCKETS @@ -3922,13 +3922,13 @@ usage: (make-network-process &rest ARGS) */) else error ("Unsupported connection type"); - name = Fplist_get (contact, QCname); - buffer = Fplist_get (contact, QCbuffer); - filter = Fplist_get (contact, QCfilter); - sentinel = Fplist_get (contact, QCsentinel); - use_external_socket_p = Fplist_get (contact, QCuse_external_socket); - Lisp_Object server = Fplist_get (contact, QCserver); - bool nowait = !NILP (Fplist_get (contact, QCnowait)); + name = plist_get (contact, QCname); + buffer = plist_get (contact, QCbuffer); + filter = plist_get (contact, QCfilter); + sentinel = plist_get (contact, QCsentinel); + use_external_socket_p = plist_get (contact, QCuse_external_socket); + Lisp_Object server = plist_get (contact, QCserver); + bool nowait = !NILP (plist_get (contact, QCnowait)); if (!NILP (server) && nowait) error ("`:server' is incompatible with `:nowait'"); @@ -3936,9 +3936,9 @@ usage: (make-network-process &rest ARGS) */) /* :local ADDRESS or :remote ADDRESS */ if (NILP (server)) - address = Fplist_get (contact, QCremote); + address = plist_get (contact, QCremote); else - address = Fplist_get (contact, QClocal); + address = plist_get (contact, QClocal); if (!NILP (address)) { host = service = Qnil; @@ -3951,7 +3951,7 @@ usage: (make-network-process &rest ARGS) */) } /* :family FAMILY -- nil (for Inet), local, or integer. */ - tem = Fplist_get (contact, QCfamily); + tem = plist_get (contact, QCfamily); if (NILP (tem)) { #ifdef AF_INET6 @@ -3976,10 +3976,10 @@ usage: (make-network-process &rest ARGS) */) error ("Unknown address family"); /* :service SERVICE -- string, integer (port number), or t (random port). */ - service = Fplist_get (contact, QCservice); + service = plist_get (contact, QCservice); /* :host HOST -- hostname, ip address, or 'local for localhost. */ - host = Fplist_get (contact, QChost); + host = plist_get (contact, QChost); if (NILP (host)) { /* The "connection" function gets it bind info from the address we're @@ -4018,7 +4018,7 @@ usage: (make-network-process &rest ARGS) */) if (!NILP (host)) { message (":family local ignores the :host property"); - contact = Fplist_put (contact, QChost, Qnil); + contact = plist_put (contact, QChost, Qnil); host = Qnil; } CHECK_STRING (service); @@ -4172,16 +4172,16 @@ usage: (make-network-process &rest ARGS) */) record_unwind_protect (remove_process, proc); p = XPROCESS (proc); pset_childp (p, contact); - pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist))); + pset_plist (p, Fcopy_sequence (plist_get (contact, QCplist))); pset_type (p, Qnetwork); pset_buffer (p, buffer); pset_sentinel (p, sentinel); pset_filter (p, filter); - pset_log (p, Fplist_get (contact, QClog)); - if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) + pset_log (p, plist_get (contact, QClog)); + if (tem = plist_get (contact, QCnoquery), !NILP (tem)) p->kill_without_query = 1; - if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) + if ((tem = plist_get (contact, QCstop), !NILP (tem))) pset_command (p, Qt); eassert (p->pid == 0); p->backlog = 5; @@ -4193,7 +4193,7 @@ usage: (make-network-process &rest ARGS) */) eassert (! p->dns_request); #endif #ifdef HAVE_GNUTLS - tem = Fplist_get (contact, QCtls_parameters); + tem = plist_get (contact, QCtls_parameters); CHECK_LIST (tem); p->gnutls_boot_parameters = tem; #endif @@ -4969,17 +4969,17 @@ server_accept_connection (Lisp_Object server, int channel) /* Build new contact information for this setup. */ contact = Fcopy_sequence (ps->childp); - contact = Fplist_put (contact, QCserver, Qnil); - contact = Fplist_put (contact, QChost, host); + contact = plist_put (contact, QCserver, Qnil); + contact = plist_put (contact, QChost, host); if (!NILP (service)) - contact = Fplist_put (contact, QCservice, service); - contact = Fplist_put (contact, QCremote, - conv_sockaddr_to_lisp (&saddr.sa, len)); + contact = plist_put (contact, QCservice, service); + contact = plist_put (contact, QCremote, + conv_sockaddr_to_lisp (&saddr.sa, len)); #ifdef HAVE_GETSOCKNAME len = sizeof saddr; if (getsockname (s, &saddr.sa, &len) == 0) - contact = Fplist_put (contact, QClocal, - conv_sockaddr_to_lisp (&saddr.sa, len)); + contact = plist_put (contact, QClocal, + conv_sockaddr_to_lisp (&saddr.sa, len)); #endif pset_childp (p, contact); diff --git a/src/sound.c b/src/sound.c index 93c84a03b1f..0a307828008 100644 --- a/src/sound.c +++ b/src/sound.c @@ -361,10 +361,10 @@ parse_sound (Lisp_Object sound, Lisp_Object *attrs) return 0; sound = XCDR (sound); - attrs[SOUND_FILE] = Fplist_get (sound, QCfile); - attrs[SOUND_DATA] = Fplist_get (sound, QCdata); - attrs[SOUND_DEVICE] = Fplist_get (sound, QCdevice); - attrs[SOUND_VOLUME] = Fplist_get (sound, QCvolume); + attrs[SOUND_FILE] = plist_get (sound, QCfile); + attrs[SOUND_DATA] = plist_get (sound, QCdata); + attrs[SOUND_DEVICE] = plist_get (sound, QCdevice); + attrs[SOUND_VOLUME] = plist_get (sound, QCvolume); #ifndef WINDOWSNT /* File name or data must be specified. */ diff --git a/src/sysdep.c b/src/sysdep.c index 28ab8189c36..c1545622dfc 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2939,21 +2939,21 @@ serial_configure (struct Lisp_Process *p, #endif /* Configure speed. */ - if (!NILP (Fplist_member (contact, QCspeed))) - tem = Fplist_get (contact, QCspeed); + if (!NILP (plist_member (contact, QCspeed))) + tem = plist_get (contact, QCspeed); else - tem = Fplist_get (p->childp, QCspeed); + tem = plist_get (p->childp, QCspeed); CHECK_FIXNUM (tem); err = cfsetspeed (&attr, convert_speed (XFIXNUM (tem))); if (err != 0) report_file_error ("Failed cfsetspeed", tem); - childp2 = Fplist_put (childp2, QCspeed, tem); + childp2 = plist_put (childp2, QCspeed, tem); /* Configure bytesize. */ - if (!NILP (Fplist_member (contact, QCbytesize))) - tem = Fplist_get (contact, QCbytesize); + if (!NILP (plist_member (contact, QCbytesize))) + tem = plist_get (contact, QCbytesize); else - tem = Fplist_get (p->childp, QCbytesize); + tem = plist_get (p->childp, QCbytesize); if (NILP (tem)) tem = make_fixnum (8); CHECK_FIXNUM (tem); @@ -2968,13 +2968,13 @@ serial_configure (struct Lisp_Process *p, if (XFIXNUM (tem) != 8) error ("Bytesize cannot be changed"); #endif - childp2 = Fplist_put (childp2, QCbytesize, tem); + childp2 = plist_put (childp2, QCbytesize, tem); /* Configure parity. */ - if (!NILP (Fplist_member (contact, QCparity))) - tem = Fplist_get (contact, QCparity); + if (!NILP (plist_member (contact, QCparity))) + tem = plist_get (contact, QCparity); else - tem = Fplist_get (p->childp, QCparity); + tem = plist_get (p->childp, QCparity); if (!NILP (tem) && !EQ (tem, Qeven) && !EQ (tem, Qodd)) error (":parity must be nil (no parity), `even', or `odd'"); #if defined (PARENB) && defined (PARODD) && defined (IGNPAR) && defined (INPCK) @@ -3001,13 +3001,13 @@ serial_configure (struct Lisp_Process *p, if (!NILP (tem)) error ("Parity cannot be configured"); #endif - childp2 = Fplist_put (childp2, QCparity, tem); + childp2 = plist_put (childp2, QCparity, tem); /* Configure stopbits. */ - if (!NILP (Fplist_member (contact, QCstopbits))) - tem = Fplist_get (contact, QCstopbits); + if (!NILP (plist_member (contact, QCstopbits))) + tem = plist_get (contact, QCstopbits); else - tem = Fplist_get (p->childp, QCstopbits); + tem = plist_get (p->childp, QCstopbits); if (NILP (tem)) tem = make_fixnum (1); CHECK_FIXNUM (tem); @@ -3023,13 +3023,13 @@ serial_configure (struct Lisp_Process *p, if (XFIXNUM (tem) != 1) error ("Stopbits cannot be configured"); #endif - childp2 = Fplist_put (childp2, QCstopbits, tem); + childp2 = plist_put (childp2, QCstopbits, tem); /* Configure flowcontrol. */ - if (!NILP (Fplist_member (contact, QCflowcontrol))) - tem = Fplist_get (contact, QCflowcontrol); + if (!NILP (plist_member (contact, QCflowcontrol))) + tem = plist_get (contact, QCflowcontrol); else - tem = Fplist_get (p->childp, QCflowcontrol); + tem = plist_get (p->childp, QCflowcontrol); if (!NILP (tem) && !EQ (tem, Qhw) && !EQ (tem, Qsw)) error (":flowcontrol must be nil (no flowcontrol), `hw', or `sw'"); #if defined (CRTSCTS) @@ -3063,14 +3063,14 @@ serial_configure (struct Lisp_Process *p, error ("Software flowcontrol (XON/XOFF) not supported"); #endif } - childp2 = Fplist_put (childp2, QCflowcontrol, tem); + childp2 = plist_put (childp2, QCflowcontrol, tem); /* Activate configuration. */ err = tcsetattr (p->outfd, TCSANOW, &attr); if (err != 0) report_file_error ("Failed tcsetattr", Qnil); - childp2 = Fplist_put (childp2, QCsummary, build_string (summary)); + childp2 = plist_put (childp2, QCsummary, build_string (summary)); pset_childp (p, childp2); } #endif /* not DOS_NT */ diff --git a/src/textprop.c b/src/textprop.c index d69682d3ea3..96d07b44be8 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -2249,7 +2249,7 @@ verify_interval_modification (struct buffer *buf, tem = textget (i->plist, Qfront_sticky); if (TMEM (Qread_only, tem) - || (NILP (Fplist_get (i->plist, Qread_only)) + || (NILP (plist_get (i->plist, Qread_only)) && TMEM (Qcategory, tem))) text_read_only (after); } @@ -2269,7 +2269,7 @@ verify_interval_modification (struct buffer *buf, tem = textget (prev->plist, Qrear_nonsticky); if (! TMEM (Qread_only, tem) - && (! NILP (Fplist_get (prev->plist,Qread_only)) + && (! NILP (plist_get (prev->plist,Qread_only)) || ! TMEM (Qcategory, tem))) text_read_only (before); } @@ -2288,13 +2288,13 @@ verify_interval_modification (struct buffer *buf, tem = textget (i->plist, Qfront_sticky); if (TMEM (Qread_only, tem) - || (NILP (Fplist_get (i->plist, Qread_only)) + || (NILP (plist_get (i->plist, Qread_only)) && TMEM (Qcategory, tem))) text_read_only (after); tem = textget (prev->plist, Qrear_nonsticky); if (! TMEM (Qread_only, tem) - && (! NILP (Fplist_get (prev->plist, Qread_only)) + && (! NILP (plist_get (prev->plist, Qread_only)) || ! TMEM (Qcategory, tem))) text_read_only (after); } diff --git a/src/w32.c b/src/w32.c index 590d9e85d93..c1e4118e9b9 100644 --- a/src/w32.c +++ b/src/w32.c @@ -10953,19 +10953,19 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact) dcb.EvtChar = 0; /* Configure speed. */ - if (!NILP (Fplist_member (contact, QCspeed))) - tem = Fplist_get (contact, QCspeed); + if (!NILP (plist_member (contact, QCspeed))) + tem = plist_get (contact, QCspeed); else - tem = Fplist_get (p->childp, QCspeed); + tem = plist_get (p->childp, QCspeed); CHECK_FIXNUM (tem); dcb.BaudRate = XFIXNUM (tem); childp2 = Fplist_put (childp2, QCspeed, tem); /* Configure bytesize. */ - if (!NILP (Fplist_member (contact, QCbytesize))) - tem = Fplist_get (contact, QCbytesize); + if (!NILP (plist_member (contact, QCbytesize))) + tem = plist_get (contact, QCbytesize); else - tem = Fplist_get (p->childp, QCbytesize); + tem = plist_get (p->childp, QCbytesize); if (NILP (tem)) tem = make_fixnum (8); CHECK_FIXNUM (tem); @@ -10976,10 +10976,10 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact) childp2 = Fplist_put (childp2, QCbytesize, tem); /* Configure parity. */ - if (!NILP (Fplist_member (contact, QCparity))) - tem = Fplist_get (contact, QCparity); + if (!NILP (plist_member (contact, QCparity))) + tem = plist_get (contact, QCparity); else - tem = Fplist_get (p->childp, QCparity); + tem = plist_get (p->childp, QCparity); if (!NILP (tem) && !EQ (tem, Qeven) && !EQ (tem, Qodd)) error (":parity must be nil (no parity), `even', or `odd'"); dcb.fParity = FALSE; @@ -11006,10 +11006,10 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact) childp2 = Fplist_put (childp2, QCparity, tem); /* Configure stopbits. */ - if (!NILP (Fplist_member (contact, QCstopbits))) - tem = Fplist_get (contact, QCstopbits); + if (!NILP (plist_member (contact, QCstopbits))) + tem = plist_get (contact, QCstopbits); else - tem = Fplist_get (p->childp, QCstopbits); + tem = plist_get (p->childp, QCstopbits); if (NILP (tem)) tem = make_fixnum (1); CHECK_FIXNUM (tem); @@ -11023,10 +11023,10 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact) childp2 = Fplist_put (childp2, QCstopbits, tem); /* Configure flowcontrol. */ - if (!NILP (Fplist_member (contact, QCflowcontrol))) - tem = Fplist_get (contact, QCflowcontrol); + if (!NILP (plist_member (contact, QCflowcontrol))) + tem = plist_get (contact, QCflowcontrol); else - tem = Fplist_get (p->childp, QCflowcontrol); + tem = plist_get (p->childp, QCflowcontrol); if (!NILP (tem) && !EQ (tem, Qhw) && !EQ (tem, Qsw)) error (":flowcontrol must be nil (no flowcontrol), `hw', or `sw'"); dcb.fOutxCtsFlow = FALSE; diff --git a/src/w32fns.c b/src/w32fns.c index b093d3c32ee..468073c9170 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -10212,21 +10212,21 @@ usage: (w32-notification-notify &rest PARAMS) */) arg_plist = Flist (nargs, args); /* Icon. */ - lres = Fplist_get (arg_plist, QCicon); + lres = plist_get (arg_plist, QCicon); if (STRINGP (lres)) icon = SSDATA (ENCODE_FILE (Fexpand_file_name (lres, Qnil))); else icon = (char *)""; /* Tip. */ - lres = Fplist_get (arg_plist, QCtip); + lres = plist_get (arg_plist, QCtip); if (STRINGP (lres)) tip = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1)); else tip = (char *)"Emacs notification"; /* Severity. */ - lres = Fplist_get (arg_plist, QClevel); + lres = plist_get (arg_plist, QClevel); if (NILP (lres)) severity = Ni_None; else if (EQ (lres, Qinfo)) @@ -10239,14 +10239,14 @@ usage: (w32-notification-notify &rest PARAMS) */) severity = Ni_Info; /* Title. */ - lres = Fplist_get (arg_plist, QCtitle); + lres = plist_get (arg_plist, QCtitle); if (STRINGP (lres)) title = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1)); else title = (char *)""; /* Notification body text. */ - lres = Fplist_get (arg_plist, QCbody); + lres = plist_get (arg_plist, QCbody); if (STRINGP (lres)) msg = SSDATA (code_convert_string_norecord (lres, Qutf_8, 1)); else diff --git a/src/w32image.c b/src/w32image.c index 1f7c4921b31..da748b8dab4 100644 --- a/src/w32image.c +++ b/src/w32image.c @@ -382,7 +382,7 @@ w32_select_active_frame (GpBitmap *pBitmap, int frame, int *nframes, static ARGB w32_image_bg_color (struct frame *f, struct image *img) { - Lisp_Object specified_bg = Fplist_get (XCDR (img->spec), QCbackground); + Lisp_Object specified_bg = plist_get (XCDR (img->spec), QCbackground); Emacs_Color color; /* If the user specified a color, try to use it; if not, use the @@ -435,7 +435,7 @@ w32_load_image (struct frame *f, struct image *img, if (status == Ok) { /* In multiframe pictures, select the first frame. */ - Lisp_Object lisp_index = Fplist_get (XCDR (img->spec), QCindex); + Lisp_Object lisp_index = plist_get (XCDR (img->spec), QCindex); int index = FIXNATP (lisp_index) ? XFIXNAT (lisp_index) : 0; int nframes; double delay; diff --git a/src/xdisp.c b/src/xdisp.c index dec31760476..a46fe99830a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -14694,7 +14694,7 @@ build_desired_tool_bar_string (struct frame *f) selected. */ if (selected_p) { - plist = Fplist_put (plist, QCrelief, make_fixnum (-relief)); + plist = plist_put (plist, QCrelief, make_fixnum (-relief)); hmargin -= relief; vmargin -= relief; } @@ -14704,10 +14704,10 @@ build_desired_tool_bar_string (struct frame *f) /* If image is selected, display it pressed, i.e. with a negative relief. If it's not selected, display it with a raised relief. */ - plist = Fplist_put (plist, QCrelief, - (selected_p - ? make_fixnum (-relief) - : make_fixnum (relief))); + plist = plist_put (plist, QCrelief, + (selected_p + ? make_fixnum (-relief) + : make_fixnum (relief))); hmargin -= relief; vmargin -= relief; } @@ -14716,18 +14716,18 @@ build_desired_tool_bar_string (struct frame *f) if (hmargin || vmargin) { if (hmargin == vmargin) - plist = Fplist_put (plist, QCmargin, make_fixnum (hmargin)); + plist = plist_put (plist, QCmargin, make_fixnum (hmargin)); else - plist = Fplist_put (plist, QCmargin, - Fcons (make_fixnum (hmargin), - make_fixnum (vmargin))); + plist = plist_put (plist, QCmargin, + Fcons (make_fixnum (hmargin), + make_fixnum (vmargin))); } /* If button is not enabled, and we don't have special images for the disabled state, make the image appear disabled by applying an appropriate algorithm to it. */ if (!enabled_p && idx < 0) - plist = Fplist_put (plist, QCconversion, Qdisabled); + plist = plist_put (plist, QCconversion, Qdisabled); /* Put a `display' text property on the string for the image to display. Put a `menu-item' property on the string that gives @@ -26510,8 +26510,8 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, tem = props; while (CONSP (tem)) { - oprops = Fplist_put (oprops, XCAR (tem), - XCAR (XCDR (tem))); + oprops = plist_put (oprops, XCAR (tem), + XCAR (XCDR (tem))); tem = XCDR (XCDR (tem)); } props = oprops; @@ -26962,13 +26962,13 @@ store_mode_line_string (const char *string, Lisp_Object lisp_string, props = mode_line_string_face_prop; else if (!NILP (mode_line_string_face)) { - Lisp_Object face = Fplist_get (props, Qface); + Lisp_Object face = plist_get (props, Qface); props = Fcopy_sequence (props); if (NILP (face)) face = mode_line_string_face; else face = list2 (face, mode_line_string_face); - props = Fplist_put (props, Qface, face); + props = plist_put (props, Qface, face); } Fadd_text_properties (make_fixnum (0), make_fixnum (len), props, lisp_string); @@ -26987,7 +26987,7 @@ store_mode_line_string (const char *string, Lisp_Object lisp_string, Lisp_Object face; if (NILP (props)) props = Ftext_properties_at (make_fixnum (0), lisp_string); - face = Fplist_get (props, Qface); + face = plist_get (props, Qface); if (NILP (face)) face = mode_line_string_face; else @@ -28037,7 +28037,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st face_string); if (!NILP (display)) { - Lisp_Object min_width = Fplist_get (display, Qmin_width); + Lisp_Object min_width = plist_get (display, Qmin_width); if (!NILP (min_width)) display_min_width (it, 0, face_string, min_width); } @@ -30730,14 +30730,14 @@ produce_stretch_glyph (struct it *it) plist = XCDR (it->object); /* Compute the width of the stretch. */ - if ((prop = Fplist_get (plist, QCwidth), !NILP (prop)) + if ((prop = plist_get (plist, QCwidth), !NILP (prop)) && calc_pixel_width_or_height (&tem, it, prop, font, true, NULL)) { /* Absolute width `:width WIDTH' specified and valid. */ zero_width_ok_p = true; width = (int)tem; } - else if (prop = Fplist_get (plist, QCrelative_width), NUMVAL (prop) > 0) + else if (prop = plist_get (plist, QCrelative_width), NUMVAL (prop) > 0) { /* Relative width `:relative-width FACTOR' specified and valid. Compute the width of the characters having this `display' @@ -30774,7 +30774,7 @@ produce_stretch_glyph (struct it *it) PRODUCE_GLYPHS (&it2); width = NUMVAL (prop) * it2.pixel_width; } - else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop)) + else if ((prop = plist_get (plist, QCalign_to), !NILP (prop)) && calc_pixel_width_or_height (&tem, it, prop, font, true, &align_to)) { @@ -30800,13 +30800,13 @@ produce_stretch_glyph (struct it *it) { int default_height = normal_char_height (font, ' '); - if ((prop = Fplist_get (plist, QCheight), !NILP (prop)) + if ((prop = plist_get (plist, QCheight), !NILP (prop)) && calc_pixel_width_or_height (&tem, it, prop, font, false, NULL)) { height = (int)tem; zero_height_ok_p = true; } - else if (prop = Fplist_get (plist, QCrelative_height), + else if (prop = plist_get (plist, QCrelative_height), NUMVAL (prop) > 0) height = default_height * NUMVAL (prop); else @@ -30818,7 +30818,7 @@ produce_stretch_glyph (struct it *it) /* Compute percentage of height used for ascent. If `:ascent ASCENT' is present and valid, use that. Otherwise, derive the ascent from the font in use. */ - if (prop = Fplist_get (plist, QCascent), + if (prop = plist_get (plist, QCascent), NUMVAL (prop) > 0 && NUMVAL (prop) <= 100) ascent = height * NUMVAL (prop) / 100.0; else if (!NILP (prop) @@ -34165,7 +34165,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, if (IMAGEP (object)) { Lisp_Object image_map, hotspot; - if ((image_map = Fplist_get (XCDR (object), QCmap), + if ((image_map = plist_get (XCDR (object), QCmap), !NILP (image_map)) && (hotspot = find_hot_spot (image_map, dx, dy), CONSP (hotspot)) @@ -34180,10 +34180,10 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, if (CONSP (hotspot) && (plist = XCAR (hotspot), CONSP (plist))) { - pointer = Fplist_get (plist, Qpointer); + pointer = plist_get (plist, Qpointer); if (NILP (pointer)) pointer = Qhand; - help = Fplist_get (plist, Qhelp_echo); + help = plist_get (plist, Qhelp_echo); if (!NILP (help)) { help_echo_string = help; @@ -34194,7 +34194,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, } } if (NILP (pointer)) - pointer = Fplist_get (XCDR (object), QCpointer); + pointer = plist_get (XCDR (object), QCpointer); } #endif /* HAVE_WINDOW_SYSTEM */ @@ -34680,7 +34680,7 @@ note_mouse_highlight (struct frame *f, int x, int y) if (img != NULL && IMAGEP (img->spec)) { Lisp_Object image_map, hotspot; - if ((image_map = Fplist_get (XCDR (img->spec), QCmap), + if ((image_map = plist_get (XCDR (img->spec), QCmap), !NILP (image_map)) && (hotspot = find_hot_spot (image_map, glyph->slice.img.x + dx, @@ -34698,10 +34698,10 @@ note_mouse_highlight (struct frame *f, int x, int y) if (CONSP (hotspot) && (plist = XCAR (hotspot), CONSP (plist))) { - pointer = Fplist_get (plist, Qpointer); + pointer = plist_get (plist, Qpointer); if (NILP (pointer)) pointer = Qhand; - help_echo_string = Fplist_get (plist, Qhelp_echo); + help_echo_string = plist_get (plist, Qhelp_echo); if (!NILP (help_echo_string)) { help_echo_window = window; @@ -34711,7 +34711,7 @@ note_mouse_highlight (struct frame *f, int x, int y) } } if (NILP (pointer)) - pointer = Fplist_get (XCDR (img->spec), QCpointer); + pointer = plist_get (XCDR (img->spec), QCpointer); } } #endif /* HAVE_WINDOW_SYSTEM */ diff --git a/test/lisp/json-tests.el b/test/lisp/json-tests.el index ef7805a3416..ab1f19fb6e7 100644 --- a/test/lisp/json-tests.el +++ b/test/lisp/json-tests.el @@ -510,8 +510,8 @@ Point is moved to beginning of the buffer." (let ((json-key-type 'string)) (setq obj (json-add-to-object obj "g" 7)) (setq obj (json-add-to-object obj "h" 8)) - (should (= (lax-plist-get obj "g") 7)) - (should (= (lax-plist-get obj "h") 8))))) + (should (= (plist-get obj "g" #'equal) 7)) + (should (= (plist-get obj "h" #'equal) 8))))) (ert-deftest test-json-add-to-hash-table () (let* ((json-object-type 'hash-table) diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 39bcc5ee38b..ba56019d4cd 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -852,24 +852,6 @@ (should-not (plist-get d1 3)) (should-not (plist-get d2 3)))) -(ert-deftest test-cycle-lax-plist-get () - (let ((c1 (cyc1 1)) - (c2 (cyc2 1 2)) - (d1 (dot1 1)) - (d2 (dot2 1 2))) - (should (lax-plist-get c1 1)) - (should (lax-plist-get c2 1)) - (should (lax-plist-get d1 1)) - (should (lax-plist-get d2 1)) - (should-error (lax-plist-get c1 2) :type 'circular-list) - (should (lax-plist-get c2 2)) - (should-error (lax-plist-get d1 2) :type 'wrong-type-argument) - (should (lax-plist-get d2 2)) - (should-error (lax-plist-get c1 3) :type 'circular-list) - (should-error (lax-plist-get c2 3) :type 'circular-list) - (should-error (lax-plist-get d1 3) :type 'wrong-type-argument) - (should-error (lax-plist-get d2 3) :type 'wrong-type-argument))) - (ert-deftest test-cycle-plist-member () (let ((c1 (cyc1 1)) (c2 (cyc2 1 2)) @@ -906,24 +888,6 @@ (should-error (plist-put d1 3 3) :type 'wrong-type-argument) (should-error (plist-put d2 3 3) :type 'wrong-type-argument))) -(ert-deftest test-cycle-lax-plist-put () - (let ((c1 (cyc1 1)) - (c2 (cyc2 1 2)) - (d1 (dot1 1)) - (d2 (dot2 1 2))) - (should (lax-plist-put c1 1 1)) - (should (lax-plist-put c2 1 1)) - (should (lax-plist-put d1 1 1)) - (should (lax-plist-put d2 1 1)) - (should-error (lax-plist-put c1 2 2) :type 'circular-list) - (should (lax-plist-put c2 2 2)) - (should-error (lax-plist-put d1 2 2) :type 'wrong-type-argument) - (should (lax-plist-put d2 2 2)) - (should-error (lax-plist-put c1 3 3) :type 'circular-list) - (should-error (lax-plist-put c2 3 3) :type 'circular-list) - (should-error (lax-plist-put d1 3 3) :type 'wrong-type-argument) - (should-error (lax-plist-put d2 3 3) :type 'wrong-type-argument))) - (ert-deftest test-cycle-equal () (should-error (equal (cyc1 1) (cyc1 1))) (should-error (equal (cyc2 1 2) (cyc2 1 2)))) @@ -936,24 +900,12 @@ "Test that `plist-get' doesn't signal an error on degenerate plists." (should-not (plist-get '(:foo 1 :bar) :bar))) -(ert-deftest lax-plist-get/odd-number-of-elements () - "Check for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27726." - (should (equal (should-error (lax-plist-get '(:foo 1 :bar) :bar) - :type 'wrong-type-argument) - '(wrong-type-argument plistp (:foo 1 :bar))))) - (ert-deftest plist-put/odd-number-of-elements () "Check for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27726." (should (equal (should-error (plist-put '(:foo 1 :bar) :zot 2) :type 'wrong-type-argument) '(wrong-type-argument plistp (:foo 1 :bar))))) -(ert-deftest lax-plist-put/odd-number-of-elements () - "Check for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27726." - (should (equal (should-error (lax-plist-put '(:foo 1 :bar) :zot 2) - :type 'wrong-type-argument) - '(wrong-type-argument plistp (:foo 1 :bar))))) - (ert-deftest plist-member/improper-list () "Check for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27726." (should (equal (should-error (plist-member '(:foo 1 . :bar) :qux) @@ -1375,4 +1327,21 @@ (should-error (append loop '(end)) :type 'circular-list))) +(ert-deftest test-plist () + (let ((plist '(:a "b"))) + (setq plist (plist-put plist :b "c")) + (should (equal (plist-get plist :b) "c")) + (should (equal (plist-member plist :b) '(:b "c")))) + + (let ((plist '("1" "2" "a" "b"))) + (setq plist (plist-put plist (copy-sequence "a") "c")) + (should-not (equal (plist-get plist (copy-sequence "a")) "c")) + (should-not (equal (plist-member plist (copy-sequence "a")) '("a" "c")))) + + (let ((plist '("1" "2" "a" "b"))) + (setq plist (plist-put plist (copy-sequence "a") "c" #'equal)) + (should (equal (plist-get plist (copy-sequence "a") #'equal) "c")) + (should (equal (plist-member plist (copy-sequence "a") #'equal) + '("a" "c"))))) + ;;; fns-tests.el ends here -- cgit v1.2.3 From 98c9105f059085da8ebbbf4d50fc43abcb7a2d32 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 28 Jun 2022 14:41:32 +0200 Subject: Allow using define-short-documentation-group without loading shortdoc * lisp/emacs-lisp/shortdoc.el (define-short-documentation-group): Allow using without loading shortdoc.el (bug#56260). --- lisp/emacs-lisp/shortdoc.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index d0f06358872..c82aa3365cd 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -41,10 +41,12 @@ '((t :inherit variable-pitch)) "Face used for a section.") -(defvar shortdoc--groups nil) +;;;###autoload +(progn + (defvar shortdoc--groups nil) -(defmacro define-short-documentation-group (group &rest functions) - "Add GROUP to the list of defined documentation groups. + (defmacro define-short-documentation-group (group &rest functions) + "Add GROUP to the list of defined documentation groups. FUNCTIONS is a list of elements on the form: (FUNC @@ -88,8 +90,7 @@ string will be `read' and evaluated. (FUNC :no-eval EXAMPLE-FORM - :result RESULT-FORM ;Use `:result-string' if value is in string form - ) + :result RESULT-FORM) ;Use `:result-string' if value is in string form Using `:no-value' is the same as using `:no-eval'. @@ -102,17 +103,16 @@ execution of the documented form depends on some conditions. (FUNC :no-eval EXAMPLE-FORM - :eg-result RESULT-FORM ;Use `:eg-result-string' if value is in string form - ) + :eg-result RESULT-FORM) ;Use `:eg-result-string' if value is in string form A FUNC form can have any number of `:no-eval' (or `:no-value'), `:no-eval*', `:result', `:result-string', `:eg-result' and `:eg-result-string' properties." - (declare (indent defun)) - `(progn - (setq shortdoc--groups (delq (assq ',group shortdoc--groups) - shortdoc--groups)) - (push (cons ',group ',functions) shortdoc--groups))) + (declare (indent defun)) + `(progn + (setq shortdoc--groups (delq (assq ',group shortdoc--groups) + shortdoc--groups)) + (push (cons ',group ',functions) shortdoc--groups)))) (define-short-documentation-group alist "Alist Basics" -- cgit v1.2.3 From 7a9353d444cf656eed1eae865afd73565cba5a29 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 29 Jun 2022 08:58:13 -0400 Subject: (cl--generic-compiler): Revert last change That change (introduced to circumvent an error now that `seq.el` is preloaded) caused all dispatchers to be left uncompiled, which slows down method dispatch very significantly. Fix the problem in the old way, i.e. by adding an explicit call to `cl--generic-prefill-dispatchers`. * lisp/emacs-lisp/cl-generic.el (cl--generic-compiler): Revert last change. Add (cl--generic-prefill-dispatchers 1 integer) instead to handle the new dispatchers needed for `seq.el`. (cl--generic-prefill-generalizer-sample): New function. (cl--generic-get-dispatcher): Use it to signal an error giving precise instructions for what to do if we're about the load the byte-compiler during the preload. (cl--generic-oclosure-generalizer): Rename from `cl-generic--oclosure-generalizer` for consistency with all other generalizers. --- lisp/emacs-lisp/cl-generic.el | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 6c5813959fa..0560ddda268 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -658,9 +658,13 @@ The set of acceptable TYPEs (also called \"specializers\") is defined ;; compiled. Otherwise the byte-compiler and all the code on ;; which it depends needs to be usable before cl-generic is loaded, ;; which imposes a significant burden on the bootstrap. - (if (or (consp (lambda (x) (+ x 1))) - (not (featurep 'bytecomp))) + (if (consp (lambda (x) (+ x 1))) (lambda (exp) (eval exp t)) + ;; But do byte-compile the dispatchers once bootstrap is passed: + ;; the performance difference is substantial (like a 5x speedup on + ;; the `eieio' elisp-benchmark)). + ;; To avoid loading the byte-compiler during the final preload, + ;; see `cl--generic-prefill-dispatchers'. #'byte-compile)) (defun cl--generic-get-dispatcher (dispatch) @@ -668,6 +672,22 @@ The set of acceptable TYPEs (also called \"specializers\") is defined ;; We need `copy-sequence` here because this `dispatch' object might be ;; modified by side-effect in `cl-generic-define-method' (bug#46722). (gethash (copy-sequence dispatch) cl--generic-dispatchers) + + (when (and purify-flag ;FIXME: Is this a reliable test of the final dump? + (eq cl--generic-compiler #'byte-compile)) + ;; We don't want to preload the byte-compiler!! + (error + "Missing cl-generic dispatcher in the prefilled cache! +Missing for: %S +You might need to add: %S" + (mapcar (lambda (x) (if (cl--generic-generalizer-p x) + (cl--generic-generalizer-name x) + x)) + dispatch) + `(cl--generic-prefill-dispatchers + ,@(delq nil (mapcar #'cl--generic-prefill-generalizer-sample + dispatch))))) + ;; (message "cl--generic-get-dispatcher (%S)" dispatch) (let* ((dispatch-arg (car dispatch)) (generalizers (cdr dispatch)) @@ -932,6 +952,20 @@ those methods.") (if (eq specializer t) (list cl--generic-t-generalizer) (error "Unknown specializer %S" specializer))) +(defun cl--generic-prefill-generalizer-sample (x) + "Return an example specializer." + (if (not (cl--generic-generalizer-p x)) + x + (pcase (cl--generic-generalizer-name x) + ('cl--generic-t-generalizer nil) + ('cl--generic-head-generalizer '(head 'x)) + ('cl--generic-eql-generalizer '(eql 'x)) + ('cl--generic-struct-generalizer 'cl--generic) + ('cl--generic-typeof-generalizer 'integer) + ('cl--generic-derived-generalizer '(derived-mode c-mode)) + ('cl--generic-oclosure-generalizer 'oclosure) + (_ x)))) + (eval-when-compile ;; This macro is brittle and only really important in order to be ;; able to preload cl-generic without also preloading the byte-compiler, @@ -1329,6 +1363,7 @@ See the full list and their hierarchy in `cl--typeof-types'." (cl-call-next-method))) (cl--generic-prefill-dispatchers 0 integer) +(cl--generic-prefill-dispatchers 1 integer) (cl--generic-prefill-dispatchers 0 cl--generic-generalizer integer) ;;; Dispatch on major mode. @@ -1377,7 +1412,7 @@ Used internally for the (major-mode MODE) context specializers." (when (cl-typep class 'oclosure--class) (oclosure--class-allparents class))))) -(cl-generic-define-generalizer cl-generic--oclosure-generalizer +(cl-generic-define-generalizer cl--generic-oclosure-generalizer ;; Give slightly higher priority than the struct specializer, so that ;; for a generic function with methods dispatching structs and on OClosures, ;; we first try `oclosure-type' before `type-of' since `type-of' will return @@ -1394,7 +1429,7 @@ Used internally for the (major-mode MODE) context specializers." ;; take place without requiring cl-lib. (let ((class (cl--find-class type))) (and (cl-typep class 'oclosure--class) - (list cl-generic--oclosure-generalizer)))) + (list cl--generic-oclosure-generalizer)))) (cl-call-next-method))) (cl--generic-prefill-dispatchers 0 oclosure) -- cgit v1.2.3 From 3447e79f2493580864962db69859bda1afd4643b Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Wed, 29 Jun 2022 11:01:16 +0200 Subject: * lisp/emacs-lisp/rx.el: Indent some rx constructs correctly. This includes group-n, submatch-n, =, >=, ** and repeat, whose first 1 or 2 arguments are special. --- lisp/emacs-lisp/rx.el | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index aa2486b47ec..07ede57d393 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -1110,6 +1110,14 @@ can expand to any number of values." (append rx--builtin-forms rx--builtin-symbols) "List of built-in rx names. These cannot be redefined by the user.") +;; Declare Lisp indentation rules for constructs that take 1 or 2 +;; parameters before a body of RX forms. +(dolist (sym '( group-n submatch-n = >=)) + (put sym 'lisp-indent-function 1)) +(dolist (sym '( ** repeat)) + (put sym 'lisp-indent-function 2)) + + (defun rx--translate (item) "Translate the rx-expression ITEM. Return (REGEXP . PRECEDENCE)." (cond -- cgit v1.2.3 From febefd6adb9c4b4f6d3a98c678e52b97859c8066 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 30 Jun 2022 10:58:14 +0200 Subject: Add provide to testcover * lisp/emacs-lisp/testcover.el (testcover): Provide (bug#55388). --- lisp/emacs-lisp/testcover.el | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el index 33628d8f47f..302f89cc1ce 100644 --- a/lisp/emacs-lisp/testcover.el +++ b/lisp/emacs-lisp/testcover.el @@ -677,4 +677,6 @@ The list is 1valued if all of its constituent elements are also 1valued." (testcover-analyze-coverage (cadr form))) (t (testcover-analyze-coverage-backquote form)))) +(provide 'testcover) + ;;; testcover.el ends here -- cgit v1.2.3 From 2f0ed2280e0075c68ab9b110068bf5395fe256e3 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 30 Jun 2022 12:49:40 +0200 Subject: Add find-function-setup-keys bindings for find-library commands * lisp/emacs-lisp/find-func.el (find-function-setup-keys): Add `L' bindings for the find-library family of commands (bug#51240). --- etc/NEWS | 5 +++++ lisp/emacs-lisp/find-func.el | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/etc/NEWS b/etc/NEWS index 1ec9603640d..0dc76746554 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -314,6 +314,11 @@ startup. Previously, these functions ignored * Changes in Emacs 29.1 +** New bindings in 'find-function-setup-keys' for 'find-library'. +When 'find-function-setup-keys' is enabled, 'C-x L' is now bound to +'find-library', 'C-x 4 L' is now bound to 'find-library-other-window' +and 'C-x 5 L' is now bound to 'find-library-other-frame'. + +++ ** New key binding after 'M-x' or 'M-X': 'M-X'. Emacs allows different completion predicates to be used with 'M-x' diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index ac84b50b5fc..486d5d08614 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -800,7 +800,10 @@ See `find-function-on-key'." (define-key ctl-x-5-map "K" 'find-function-on-key-other-frame) (define-key ctl-x-map "V" 'find-variable) (define-key ctl-x-4-map "V" 'find-variable-other-window) - (define-key ctl-x-5-map "V" 'find-variable-other-frame)) + (define-key ctl-x-5-map "V" 'find-variable-other-frame) + (define-key ctl-x-map "L" 'find-library) + (define-key ctl-x-4-map "L" 'find-library-other-window) + (define-key ctl-x-5-map "L" 'find-library-other-frame)) (provide 'find-func) -- cgit v1.2.3 From 80cf13a3d27d8a967feafeec32fd130529635592 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 30 Jun 2022 13:18:15 +0200 Subject: Make "eager macro-expansion" warning into an error * doc/lispref/loading.texi (How Programs Do Loading): Update documentation. * lisp/emacs-lisp/macroexp.el: (internal-macroexpand-for-load): We've been warning about eager macro expansion for many years, so finally change that into an error (bug#18154). --- doc/lispref/loading.texi | 5 ++--- etc/NEWS | 3 +++ lisp/emacs-lisp/macroexp.el | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index 8a2bb5fa2db..00a1fe05fdd 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -149,10 +149,9 @@ up the execution of uncompiled code. Sometimes, this macro expansion cannot be done, owing to a cyclic dependency. In the simplest example of this, the file you are loading refers to a macro defined in another file, and that file in turn requires the file you are -loading. This is generally harmless. Emacs prints a warning +loading. Emacs will issue an error about (@samp{Eager macro-expansion skipped due to cycle@dots{}}) -giving details of the problem, but it still loads the file, just -leaving the macro unexpanded for now. You may wish to restructure +giving details of the problem. You have to restructure your code so that this does not happen. Loading a compiled file does not cause macroexpansion, because this should already have happened during compilation. @xref{Compiling Macros}. diff --git a/etc/NEWS b/etc/NEWS index 1d56547d0d4..ad0acd674e2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -159,6 +159,9 @@ of 'user-emacs-directory'. * Incompatible changes in Emacs 29.1 ++++ +** Warning about "eager macro-expansion failure" is changed into an error. + --- ** Previously, the X reverseVideo value at startup was heeded for all frames. This meant that if you had a reverseVideo resource on the initial diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index bae303c213c..0fb4cf680a8 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -796,8 +796,8 @@ test of free variables in the following ways: (if (eq (car-safe (car bt)) 'macroexpand-all) (setq bt (cdr bt))) (if macroexp--debug-eager (debug 'eager-macroexp-cycle) - (message "Warning: Eager macro-expansion skipped due to cycle:\n %s" - (mapconcat #'prin1-to-string (nreverse bt) " => "))) + (error "Warning: Eager macro-expansion skipped due to cycle:\n %s" + (mapconcat #'prin1-to-string (nreverse bt) " => "))) (push 'skip macroexp--pending-eager-loads) form)) (t @@ -811,7 +811,7 @@ test of free variables in the following ways: ;; Hopefully this shouldn't happen thanks to the cycle detection, ;; but in case it does happen, let's catch the error and give the ;; code a chance to macro-expand later. - (message "Eager macro-expansion failure: %S" err) + (error "Eager macro-expansion failure: %S" err) form)))))) ;; ¡¡¡ Big Ugly Hack !!! -- cgit v1.2.3 From b77d8617e7841ea8526f09de9d3246ff7e62aa87 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 30 Jun 2022 14:11:28 +0200 Subject: ; * lisp/emacs-lisp/testcover.el: Remove duplicate provide. --- lisp/emacs-lisp/testcover.el | 1 - 1 file changed, 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el index 302f89cc1ce..cd2e388ce42 100644 --- a/lisp/emacs-lisp/testcover.el +++ b/lisp/emacs-lisp/testcover.el @@ -65,7 +65,6 @@ (eval-when-compile (require 'cl-lib)) (require 'edebug) -(provide 'testcover) ;;;========================================================================== -- cgit v1.2.3 From 00dbc5937d3015e23285251f0417d4b508080ecc Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Thu, 30 Jun 2022 14:31:47 +0200 Subject: Don't change indentation rules for `>=` and `=` * lisp/emacs-lisp/rx.el: `>=` and `=` are much more likely functions than RX constructs and the indentation machinery currently has no way to tell them apart. Suggested by Michael Herdeegen. --- lisp/emacs-lisp/rx.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 07ede57d393..182e48d7856 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -1112,10 +1112,12 @@ can expand to any number of values." ;; Declare Lisp indentation rules for constructs that take 1 or 2 ;; parameters before a body of RX forms. -(dolist (sym '( group-n submatch-n = >=)) - (put sym 'lisp-indent-function 1)) -(dolist (sym '( ** repeat)) - (put sym 'lisp-indent-function 2)) +;; (`>=' and `=' are omitted because they are more likely to be used +;; as Lisp functions than RX constructs.) +(put 'group-n 'lisp-indent-function 1) +(put 'submatch-n 'lisp-indent-function 1) +(put '** 'lisp-indent-function 2) +(put 'repeat 'lisp-indent-function 2) (defun rx--translate (item) -- cgit v1.2.3 From a68508c10b0ab60e23d13164bd6c83e38ce36f93 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Thu, 30 Jun 2022 14:55:45 +0200 Subject: Don't say that macro-expansion error is a warning * lisp/emacs-lisp/gv.el: * lisp/emacs-lisp/macroexp.el (internal-macroexpand-for-load): Since eager macro-expansion errors are no longer warnings, don't say so. --- lisp/emacs-lisp/gv.el | 2 +- lisp/emacs-lisp/macroexp.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index 7cfa1f2dadc..54ddc7ac757 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -602,7 +602,7 @@ This is like the `*' operator of the C language. REF must have been previously obtained with `gv-ref'." (funcall (car ref))) ;; Don't use `declare' because it seems to introduce circularity problems: -;; Warning: Eager macro-expansion skipped due to cycle: +;; Eager macro-expansion skipped due to cycle: ;; … => (load "gv.el") => (macroexpand-all (defsubst gv-deref …)) => (macroexpand (defun …)) => (load "gv.el") (gv-define-setter gv-deref (v ref) `(funcall (cdr ,ref) ,v)) diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 0fb4cf680a8..4db50bbaa9b 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -796,7 +796,7 @@ test of free variables in the following ways: (if (eq (car-safe (car bt)) 'macroexpand-all) (setq bt (cdr bt))) (if macroexp--debug-eager (debug 'eager-macroexp-cycle) - (error "Warning: Eager macro-expansion skipped due to cycle:\n %s" + (error "Eager macro-expansion skipped due to cycle:\n %s" (mapconcat #'prin1-to-string (nreverse bt) " => "))) (push 'skip macroexp--pending-eager-loads) form)) -- cgit v1.2.3 From 77e99dcacb57cae558f833334a8367fbc9b4fd8a Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Thu, 30 Jun 2022 15:19:15 +0200 Subject: ; * lisp/emacs-lisp/rx.el: Don't set indentation prop for `repeat`. --- lisp/emacs-lisp/rx.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 182e48d7856..18eb168a70a 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -1113,11 +1113,10 @@ can expand to any number of values." ;; Declare Lisp indentation rules for constructs that take 1 or 2 ;; parameters before a body of RX forms. ;; (`>=' and `=' are omitted because they are more likely to be used -;; as Lisp functions than RX constructs.) +;; as Lisp functions than RX constructs; `repeat' is a `defcustom' type.) (put 'group-n 'lisp-indent-function 1) (put 'submatch-n 'lisp-indent-function 1) (put '** 'lisp-indent-function 2) -(put 'repeat 'lisp-indent-function 2) (defun rx--translate (item) -- cgit v1.2.3 From 15b2138719b34083967001c3903e7560d5e0947c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 30 Jun 2022 13:20:33 -0400 Subject: (syntax-wholeline-max): New var Try and reduce the pain caused by font-lock and syntax-propertize's wholeline-based operation in buffers made up of a few very long lines (bug#45898). * lisp/emacs-lisp/syntax.el (syntax-wholeline-max): New var. (syntax--lbp): New function. (syntax-propertize-wholelines): Use it. * lisp/jit-lock.el (jit-lock--antiblink-post-command): Use `syntax--lbp`. * lisp/font-lock.el (font-lock-extend-region-wholelines): Rewrite, using `syntax-propertize-wholelines`. --- etc/NEWS | 11 +++++++++++ lisp/emacs-lisp/syntax.el | 46 ++++++++++++++++++++++++++++++++++++++++------ lisp/font-lock.el | 33 +++++++++++++-------------------- lisp/jit-lock.el | 21 +++++++++++---------- 4 files changed, 75 insertions(+), 36 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/etc/NEWS b/etc/NEWS index e757435ff91..d3dd8965267 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -317,6 +317,17 @@ startup. Previously, these functions ignored * Changes in Emacs 29.1 +** New config variable 'syntax-wholeline-max' to reduce the cost of long lines. +This variable is used by some operations (mostly syntax-propertization +and font-locking) to treat lines longer than this variable as if they +were made up of various smaller lines. This can help reduce the +pathological slowdowns seen in buffers made of a single long line, but +can also cause misbehavior in the presence of such long lines (tho +most of that misbehavior should usually be limited to mis-highlighting). +You can recover the previous behavior with: + + (setq syntax-wholeline-max most-positive-fixnum) + --- ** New bindings in 'find-function-setup-keys' for 'find-library'. When 'find-function-setup-keys' is enabled, 'C-x L' is now bound to diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 36b0c56e953..e1be3015838 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -124,15 +124,49 @@ When the last position scanned holds the first character of a otherwise nil. That construct can be a two character comment delimiter or an Escaped or Char-quoted character.")) -(defun syntax-propertize-wholelines (start end) - "Extend the region delimited by START and END to whole lines. +(defvar syntax-wholeline-max 10000 + "Maximum line length for syntax operations. +If lines are longer than that, syntax operations will treat them as chunks +of this size. Misfontification may then occur. +This is a tradeoff between correctly applying the syntax rules, +and avoiding major slowdown on pathologically long lines.") + +(defun syntax--lbp (&optional arg) + "Like `line-beginning-position' but obeying `syntax-wholeline-max'." + (let ((pos (point)) + (res (line-beginning-position arg))) + (cond + ((< (abs (- pos res)) syntax-wholeline-max) res) + ;; For lines that are too long, round to the nearest multiple of + ;; `syntax-wholeline-max'. We use rounding rather than just + ;; (min res (+ pos syntax-wholeline-max)) so that repeated calls + ;; to `syntax-propertize-wholelines' don't keep growing the bounds, + ;; i.e. it really behaves like additional line-breaks. + ((< res pos) + (let ((max syntax-wholeline-max)) + (max (point-min) (* max (truncate pos max))))) + (t + (let ((max syntax-wholeline-max)) + (min (point-max) (* max (ceiling pos max)))))))) + +(defun syntax-propertize-wholelines (beg end) + "Extend the region delimited by BEG and END to whole lines. This function is useful for `syntax-propertize-extend-region-functions'; see Info node `(elisp) Syntax Properties'." - (goto-char start) - (cons (line-beginning-position) - (progn (goto-char end) - (if (bolp) (point) (line-beginning-position 2))))) + ;; This let-binding was taken from + ;; `font-lock-extend-region-wholelines' where it was used to avoid + ;; inf-looping (Bug#21615) but for some reason it was not applied + ;; here in syntax.el and was used only for the "beg" side. + (let ((inhibit-field-text-motion t)) + (let ((new-beg (progn (goto-char beg) + (if (bolp) beg + (syntax--lbp)))) + (new-end (progn (goto-char end) + (if (bolp) end + (syntax--lbp 2))))) + (unless (and (eql beg new-beg) (eql end new-end)) + (cons new-beg new-end))))) (defun syntax-propertize-multiline (beg end) "Let `syntax-propertize' pay attention to the syntax-multiline property." diff --git a/lisp/font-lock.el b/lisp/font-lock.el index df0a26f4d0f..7eeaf2f547f 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1260,18 +1260,11 @@ Put first the functions more likely to cause a change and cheaper to compute.") (defun font-lock-extend-region-wholelines () "Move fontification boundaries to beginning of lines." - (let ((changed nil)) - (goto-char font-lock-beg) - (unless (bolp) - (setq changed t font-lock-beg - (let ((inhibit-field-text-motion t)) - (line-beginning-position)))) - (goto-char font-lock-end) - (unless (bolp) - (unless (eq font-lock-end - (setq font-lock-end (line-beginning-position 2))) - (setq changed t))) - changed)) + (let ((new (syntax-propertize-wholelines font-lock-beg font-lock-end))) + (when new + (setq font-lock-beg (car new)) + (setq font-lock-end (cdr new)) + t))) (defun font-lock-default-fontify-region (beg end loudly) "Fontify the text between BEG and END. @@ -1565,7 +1558,7 @@ see `font-lock-syntactic-keywords'." (or (nth 3 highlight) (error "No match %d in highlight %S" match highlight)) (when (and (consp value) (not (numberp (car value)))) - (setq value (eval value))) + (setq value (eval value t))) (when (stringp value) (setq value (string-to-syntax value))) ;; Flush the syntax-cache. I believe this is not necessary for ;; font-lock's use of syntax-ppss, but I'm not 100% sure and it can @@ -1589,7 +1582,7 @@ KEYWORDS should be of the form MATCH-ANCHORED, see `font-lock-keywords', LIMIT can be modified by the value of its PRE-MATCH-FORM." (let ((matcher (nth 0 keywords)) (lowdarks (nthcdr 3 keywords)) highlights ;; Evaluate PRE-MATCH-FORM. - (pre-match-value (eval (nth 1 keywords)))) + (pre-match-value (eval (nth 1 keywords) t))) ;; Set LIMIT to value of PRE-MATCH-FORM or the end of line. (if (and (numberp pre-match-value) (> pre-match-value (point))) (setq limit pre-match-value) @@ -1605,7 +1598,7 @@ LIMIT can be modified by the value of its PRE-MATCH-FORM." (font-lock-apply-syntactic-highlight (car highlights)) (setq highlights (cdr highlights))))) ;; Evaluate POST-MATCH-FORM. - (eval (nth 2 keywords)))) + (eval (nth 2 keywords) t))) (defun font-lock-fontify-syntactic-keywords-region (start end) "Fontify according to `font-lock-syntactic-keywords' between START and END. @@ -1718,7 +1711,7 @@ HIGHLIGHT should be of the form MATCH-HIGHLIGHT, see `font-lock-keywords'." ;; No match but we might not signal an error. (or (nth 3 highlight) (error "No match %d in highlight %S" match highlight)) - (let ((val (eval (nth 1 highlight)))) + (let ((val (eval (nth 1 highlight) t))) (when (eq (car-safe val) 'face) (add-text-properties start end (cddr val)) (setq val (cadr val))) @@ -1753,7 +1746,7 @@ LIMIT can be modified by the value of its PRE-MATCH-FORM." (let ((matcher (nth 0 keywords)) (lowdarks (nthcdr 3 keywords)) highlights (lead-start (match-beginning 0)) ;; Evaluate PRE-MATCH-FORM. - (pre-match-value (eval (nth 1 keywords)))) + (pre-match-value (eval (nth 1 keywords) t))) ;; Set LIMIT to value of PRE-MATCH-FORM or the end of line. (if (not (and (numberp pre-match-value) (> pre-match-value (point)))) (setq limit (line-end-position)) @@ -1778,7 +1771,7 @@ LIMIT can be modified by the value of its PRE-MATCH-FORM." (font-lock-apply-highlight (car highlights)) (setq highlights (cdr highlights))))) ;; Evaluate POST-MATCH-FORM. - (eval (nth 2 keywords)))) + (eval (nth 2 keywords) t))) (defun font-lock-fontify-keywords-region (start end &optional loudly) "Fontify according to `font-lock-keywords' between START and END. @@ -1884,7 +1877,7 @@ If SYNTACTIC-KEYWORDS is non-nil, it means these keywords are used for (cond ((or (functionp keyword) (nlistp keyword)) ; MATCHER (list keyword '(0 font-lock-keyword-face))) ((eq (car keyword) 'eval) ; (eval . FORM) - (font-lock-compile-keyword (eval (cdr keyword)))) + (font-lock-compile-keyword (eval (cdr keyword) t))) ((eq (car-safe (cdr keyword)) 'quote) ; (MATCHER . 'FORM) ;; If FORM is a FACENAME then quote it. Otherwise ignore the quote. (if (symbolp (nth 2 keyword)) @@ -1905,7 +1898,7 @@ If SYNTACTIC-KEYWORDS is non-nil, it means these keywords are used for keywords (font-lock-eval-keywords (if (fboundp keywords) (funcall keywords) - (eval keywords))))) + (eval keywords t))))) (defun font-lock-value-in-major-mode (values) "If VALUES is a list, use `major-mode' as a key and return the `assq' value. diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index 17969d57620..a3ada443702 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -242,20 +242,20 @@ If you need to debug code run from jit-lock, see `jit-lock-debug-mode'." (when (and jit-lock-stealth-time (null jit-lock-stealth-timer)) (setq jit-lock-stealth-timer (run-with-idle-timer jit-lock-stealth-time t - 'jit-lock-stealth-fontify))) + #'jit-lock-stealth-fontify))) ;; Create, but do not activate, the idle timer for repeated ;; stealth fontification. (when (and jit-lock-stealth-time (null jit-lock-stealth-repeat-timer)) (setq jit-lock-stealth-repeat-timer (timer-create)) (timer-set-function jit-lock-stealth-repeat-timer - 'jit-lock-stealth-fontify '(t))) + #'jit-lock-stealth-fontify '(t))) ;; Init deferred fontification timer. (when (and jit-lock-defer-time (null jit-lock-defer-timer)) (setq jit-lock-defer-timer (run-with-idle-timer jit-lock-defer-time t - 'jit-lock-deferred-fontify))) + #'jit-lock-deferred-fontify))) ;; Initialize contextual fontification if requested. (when (eq jit-lock-contextually t) @@ -265,13 +265,13 @@ If you need to debug code run from jit-lock, see `jit-lock-debug-mode'." (lambda () (unless jit-lock--antiblink-grace-timer (jit-lock-context-fontify)))))) - (add-hook 'post-command-hook 'jit-lock--antiblink-post-command nil t) + (add-hook 'post-command-hook #'jit-lock--antiblink-post-command nil t) (setq jit-lock-context-unfontify-pos (or jit-lock-context-unfontify-pos (point-max)))) ;; Setup our hooks. - (add-hook 'after-change-functions 'jit-lock-after-change nil t) - (add-hook 'fontification-functions 'jit-lock-function nil t)) + (add-hook 'after-change-functions #'jit-lock-after-change nil t) + (add-hook 'fontification-functions #'jit-lock-function nil t)) ;; Turn Just-in-time Lock mode off. (t @@ -294,8 +294,9 @@ If you need to debug code run from jit-lock, see `jit-lock-debug-mode'." (setq jit-lock-defer-timer nil))) ;; Remove hooks. - (remove-hook 'after-change-functions 'jit-lock-after-change t) - (remove-hook 'fontification-functions 'jit-lock-function)))) + (remove-hook 'post-command-hook #'jit-lock--antiblink-post-command t) + (remove-hook 'after-change-functions #'jit-lock-after-change t) + (remove-hook 'fontification-functions #'jit-lock-function)))) (define-minor-mode jit-lock-debug-mode "Minor mode to help debug code run from jit-lock. @@ -707,8 +708,8 @@ will take place when text is fontified stealthily." (min jit-lock-context-unfontify-pos jit-lock-start)))))) (defun jit-lock--antiblink-post-command () - (let* ((new-l-b-p (copy-marker (line-beginning-position))) - (l-b-p-2 (line-beginning-position 2)) + (let* ((new-l-b-p (copy-marker (syntax--lbp))) + (l-b-p-2 (syntax--lbp 2)) (same-line (and jit-lock-antiblink-grace (not (= new-l-b-p l-b-p-2)) -- cgit v1.2.3 From 2736e61274381ee432f0cd0d15d308b0095436ab Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 30 Jun 2022 20:23:32 +0200 Subject: Fix define-obsolete-function-alias formatting in loaddefs-gen.el * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--print-form): Fix formatting of define-obsolete-function-alias statements (bug#56292). --- lisp/emacs-lisp/loaddefs-gen.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 7545ba1e5e8..2c92a8e7fe8 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -633,7 +633,8 @@ If GENERATE-FULL, don't update, but regenerate all the loaddefs files." "Print DEF in the way make-docfile.c expects it." (if (or (not (consp def)) (not (symbolp (car def))) - (eq (car def) 'make-obsolete) + (memq (car def) '( make-obsolete + define-obsolete-function-alias)) (not (stringp (nth 3 def)))) (prin1 def (current-buffer) t) ;; The salient point here is that we have to have the doc string -- cgit v1.2.3 From 6908309827c573288a029b74aa999adc057958be Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 30 Jun 2022 23:15:54 +0200 Subject: Doc fixes: don't refer to some obsolete items * admin/notes/multi-tty: * lisp/chistory.el (command-history): * lisp/emacs-lisp/nadvice.el: * lisp/vc/diff-mode.el: Doc fix; don't refer to obsolete variables and functions. --- admin/notes/multi-tty | 2 +- lisp/chistory.el | 4 ++-- lisp/emacs-lisp/nadvice.el | 2 +- lisp/vc/diff-mode.el | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/admin/notes/multi-tty b/admin/notes/multi-tty index 9b3f1606a1b..84bc1b77d4e 100644 --- a/admin/notes/multi-tty +++ b/admin/notes/multi-tty @@ -474,7 +474,7 @@ THINGS TO DO definition. Exceptions found so far: x-select-text and - x-selection-value (old name: x-cut-buffer-or-selection-value). + x-selection-value. ** Have a look at fatal_error_hook. diff --git a/lisp/chistory.el b/lisp/chistory.el index dd0f4997433..33b21422114 100644 --- a/lisp/chistory.el +++ b/lisp/chistory.el @@ -165,11 +165,11 @@ The buffer for that command is the previous current buffer." "Examine commands from variable `command-history' in a buffer. The number of commands listed is controlled by `list-command-history-max'. The command history is filtered by `list-command-history-filter' if non-nil. -Use \\\\[command-history-repeat] to repeat the command on the current line. +Use \\\\[command-history-repeat] to repeat the command on the current line. Otherwise much like Emacs-Lisp Mode except that there is no self-insertion and digits provide prefix arguments. Tab does not indent. -\\{command-history-map} +\\{command-history-mode-map} This command always recompiles the Command History listing and runs the normal hook `command-history-hook'." diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index 212499d10b0..eae4a0f0ec8 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el @@ -277,7 +277,7 @@ different, but `function-equal' will hopefully ignore those differences.") (defmacro add-function (where place function &optional props) ;; TODO: ;; - maybe let `where' specify some kind of predicate and use it - ;; to implement things like mode-local or eieio-defmethod. + ;; to implement things like mode-local or cl-defmethod. ;; Of course, that only makes sense if the predicates of all advices can ;; be combined and made more efficient. ;; :before is like a normal add-hook on a normal hook. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index cd1e1b9d087..f366261ae05 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2053,7 +2053,7 @@ For use in `add-log-current-defun-function'." (re-search-forward "^[^ ]" nil t)) (pcase-let ((`(,buf ,_line-offset ,pos ,src ,dst ,switched) (ignore-errors ;Signals errors in place of prompting. - ;; Use `noprompt' since this is used in which-func-mode + ;; Use `noprompt' since this is used in which-function-mode ;; and such. (diff-find-source-location nil nil 'noprompt)))) (when buf -- cgit v1.2.3 From 3b66c23325909fef077831c5f289221583e75bd7 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 2 Jul 2022 05:35:15 +0200 Subject: Font lock \\`' command substitutions in docstrings * lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2): Support \\`' command substitutions. --- lisp/emacs-lisp/lisp-mode.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 6d5391d1e90..3797217e1a0 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -476,8 +476,14 @@ This will generate compile-time constants from BINDINGS." "[ \t']*\\(" lisp-mode-symbol-regexp "\\)?") (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) - ;; Words inside \\[] tend to be for `substitute-command-keys'. - (,(concat "\\\\\\\\\\[\\(" lisp-mode-symbol-regexp "\\)\\]") + ;; Words inside \\[] or \\`' tend to be for `substitute-command-keys'. + (,(rx "\\\\[" (group (regexp lisp-mode-symbol-regexp)) "]") + (1 font-lock-constant-face prepend)) + (,(rx "\\\\`" (group + (+ (regexp lisp-mode-symbol-regexp) + ;; allow multiple words, e.g. "C-x a" + (? " "))) + "'") (1 font-lock-constant-face prepend)) ;; Ineffective backslashes (typically in need of doubling). ("\\(\\\\\\)\\([^\"\\]\\)" -- cgit v1.2.3 From 9230953f23c432699347bb3eeadebd82e4cbbfaa Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 2 Jul 2022 10:20:23 +0200 Subject: ; Fix typos. --- ChangeLog.3 | 30 +++++++++++----------- doc/emacs/ChangeLog.1 | 2 +- doc/misc/ert.texi | 2 +- lisp/elec-pair.el | 4 +-- lisp/emacs-lisp/cl-preloaded.el | 2 +- lisp/org/ob-comint.el | 2 +- lisp/org/ol-doi.el | 2 +- lisp/org/org-feed.el | 2 +- lisp/progmodes/gdb-mi.el | 2 +- lisp/transient.el | 2 +- src/lisp.h | 2 +- .../semantic-utest-ia-resources/teststruct.cpp | 2 +- 12 files changed, 27 insertions(+), 27 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/ChangeLog.3 b/ChangeLog.3 index d0ff14117be..907eb2ce6ff 100644 --- a/ChangeLog.3 +++ b/ChangeLog.3 @@ -2276,7 +2276,7 @@ 2021-12-27 Eli Zaretskii - Fix typos in in 'reset-language-environment' + Fix typos in 'reset-language-environment' * lisp/international/mule-cmds.el (reset-language-environment): Fix a typo in 'windows-nt'. (Bug#52816) @@ -15459,7 +15459,7 @@ Fix automatic hscrolling when line numbers are displayed * src/xdisp.c (hscroll_window_tree): When line numbers are - displayed, account for the the line-number space when calculating + displayed, account for the line-number space when calculating the desired X coordinate on the left. (Bug#49891) 2021-08-06 Eli Zaretskii @@ -27169,7 +27169,7 @@ * lisp/minibuffer.el (minibuffer--sort-by-length-alpha): New function. (minibuffer--sort-by-position): New function extracted from `completion-all-sorted-completions`. - (completion-all-sorted-completions): Use use them. + (completion-all-sorted-completions): Use them. 2021-04-19 Daniel Mendler @@ -42218,7 +42218,7 @@ string in the byte-code (so the two branches return `eq` strings). So, I think using `iso-2022-jp` is a bad idea here: it gives the - illusion that the the `charset` info exists, even it will be lost. + illusion that the `charset` info exists, even it will be lost. Eli discussed it with Handa-san a year ago, and they arrived at the conclusion that the charset information is indeed no longer important. @@ -67358,7 +67358,7 @@ wdired-do-renames: Speed up for long Emacs sessions `dired-rename-file' calls unconditionally `dired-rename-subdir'. - The second function performs performs a loop on all the Emacs + The second function performs a loop on all the Emacs buffers; this step is only needed if FILE is a directory (bug#32899). In a long lived Emacs session, this can make a difference @@ -74306,7 +74306,7 @@ (Bug#42563) - For some time, Eldoc has has some Elisp-specific code that shouldn't + For some time, Eldoc has some Elisp-specific code that shouldn't live there, but in elisp-mode.el. This can be fixed in Emacs master, but since ElDoc is distributed in GNU Elpa and is meant to work with Emacs 26 and 27, this means that that elisp-specific code must still @@ -74558,7 +74558,7 @@ Do this conservatively for now: if the ElDoc helper buffer (as returned by eldoc--doc-buffer) is visible and showing documentation - for the very same "situation" (as computed by the the new + for the very same "situation" (as computed by the new eldoc--request-state helper), don't request that documentation from sources again. @@ -77976,7 +77976,7 @@ * lisp/emacs-lisp/comp.el (comp-symbol-values-optimizable): New defconst. - (comp-function-call-maybe-remove): New logic to to remove + (comp-function-call-maybe-remove): New logic to remove unnecessary `symbol-value' calls. 2020-06-07 Juri Linkov @@ -85368,7 +85368,7 @@ 2020-03-10 AndreaCorallo - * Fix store_function_docstring for for native functions + * Fix store_function_docstring for native functions Do not Nil native_doc fields. This will be naturally dumped by pdumper. This was affecting dumped functions. @@ -114426,7 +114426,7 @@ 2019-08-21 Nicolas Petton - * etc/HISTORY: Add Emacs 26.3 release release date. + * etc/HISTORY: Add Emacs 26.3 release date. 2019-08-21 Nicolas Petton @@ -117408,7 +117408,7 @@ 2019-07-30 Lars Ingebrigtsen - Use decoded time accessors in in em-ls + Use decoded time accessors in em-ls * lisp/eshell/em-ls.el (eshell-ls-file): Use decoded time accessors. @@ -118983,7 +118983,7 @@ * doc/lispref/hash.texi (Creating Hash, Defining Hash): * src/fns.c (Fsxhash_eq, Fsxhash_eql, Fsxhash_equal): Say that hashes are fixnums. - (Fmake_hash_table): Say that that an integer rehash-size + (Fmake_hash_table): Say that an integer rehash-size should be a fixnum. * doc/lispref/hash.texi (Defining Hash): Say that hash and comparison functions should be consistent and pure, and should @@ -128629,7 +128629,7 @@ * lisp/emacs-lisp/package.el (package-install-from-archive): Fix last change - Don't place the unibyte content of of the downloaded file into + Don't place the unibyte content of the downloaded file into a multibyte buffer. 2019-05-24 Michael Albinus @@ -149671,7 +149671,7 @@ * lisp/textmodes/bibtex.el (bibtex-next-entry) (bibtex-previous-entry): New commands. - (bibtex-mode-map): Bind to to forward-paragraph and + (bibtex-mode-map): Bind to forward-paragraph and backward-paragraph. Add to menu under "Moving inside an Entry". 2018-08-27 Noam Postavsky @@ -186529,7 +186529,7 @@ Lay some groundwork for a more flexible approach that allows for different classes of diagnostics, not necessarily line-based. Importantly, one overlay per diagnostic is created, whereas the - original implementation had one per line, and on it it concatenated + original implementation had one per line, and on it concatenated the results of errors and warnings. This means that currently, an error and warning on the same line are diff --git a/doc/emacs/ChangeLog.1 b/doc/emacs/ChangeLog.1 index c1c5f5407da..048b7bd99a5 100644 --- a/doc/emacs/ChangeLog.1 +++ b/doc/emacs/ChangeLog.1 @@ -8529,7 +8529,7 @@ * text.texi (Cell Justification): * trouble.texi (After a Crash): * xresources.texi (GTK styles): - Delete duplicate duplicate words. + Delete duplicate words. 2005-07-17 Richard M. Stallman diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 91288db45a2..4dccd8edcf0 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -321,7 +321,7 @@ Show the list of @code{should} forms executed in the test @kindex m@r{, in ert results buffer} @findex ert-results-pop-to-messages-for-test-at-point Show any messages that were generated (with the Lisp function -@code{message}) in in a test or any of the code that it invoked +@code{message}) in a test or any of the code that it invoked (@code{ert-results-pop-to-messages-for-test-at-point}). @item L diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el index fa4d6d9849c..720f6083681 100644 --- a/lisp/elec-pair.el +++ b/lisp/elec-pair.el @@ -503,8 +503,8 @@ The decision is taken by order of preference: * According to C's syntax and the syntactic state of the buffer (both as defined by the major mode's syntax table). This is - done by looking up up the variables - `electric-pair-inhibit-predicate', `electric-pair-skip-self' + done by looking up the variables + `electric-pair-inhibit-predicate', `electric-pair-skip-self' and `electric-pair-skip-whitespace' (which see)." (let* ((pos (and electric-pair-mode (electric--after-char-pos))) (skip-whitespace-info)) diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index ec9fd86a55c..94f9654b239 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el @@ -146,7 +146,7 @@ supertypes from the most specific to least specific.") (while (recordp parent) (add-to-list (cl--struct-class-children-sym parent) tag) ;; Only register ourselves as a child of the leftmost parent since structs - ;; can only only have one parent. + ;; can only have one parent. (setq parent (car (cl--struct-class-parents parent))))) ;;;###autoload diff --git a/lisp/org/ob-comint.el b/lisp/org/ob-comint.el index 427aba34150..c99d6a8ba71 100644 --- a/lisp/org/ob-comint.el +++ b/lisp/org/ob-comint.el @@ -166,7 +166,7 @@ source block, and the name of the temp file.") (defvar-local org-babel-comint-async-chunk-callback nil "Callback function to clean Babel async output results before insertion. Its single argument is a string consisting of output from the -comint process. It should return a string that will be be passed +comint process. It should return a string that will be passed to `org-babel-insert-result'.") (defvar-local org-babel-comint-async-dangling nil diff --git a/lisp/org/ol-doi.el b/lisp/org/ol-doi.el index 94585e4c3e5..56239f65d43 100644 --- a/lisp/org/ol-doi.el +++ b/lisp/org/ol-doi.el @@ -44,7 +44,7 @@ PATH is a the path to search for, as a string." "Export a \"doi\" type link. PATH is the DOI name. DESC is the description of the link, or nil. BACKEND is a symbol representing the backend used for -export. INFO is a a plist containing the export parameters." +export. INFO is a plist containing the export parameters." (let ((uri (concat org-link-doi-server-url path))) (pcase backend (`html diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el index a5fea08882f..c7b4bde0d28 100644 --- a/lisp/org/org-feed.el +++ b/lisp/org/org-feed.el @@ -406,7 +406,7 @@ it can be a list structured like an entry in `org-feed-alist'." ;; Write the new status ;; We do this only now, in case something goes wrong above, so - ;; that would would end up with a status that does not reflect + ;; that would end up with a status that does not reflect ;; which items truly have been handled (org-feed-write-status inbox-pos drawer status) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 79ef6101e9b..03beb065699 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -2112,7 +2112,7 @@ is running." (not (null gdb-running-threads-count)) (> gdb-running-threads-count 0)))) -;; GUD displays the selected GDB frame. This might might not be the current +;; GUD displays the selected GDB frame. This might not be the current ;; GDB frame (after up, down etc). If no GDB frame is visible but the last ;; visited breakpoint is, use that window. (defun gdb-display-source-buffer (buffer) diff --git a/lisp/transient.el b/lisp/transient.el index 06e41061925..41b69b1abac 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -246,7 +246,7 @@ for infix argument are highlighted when only a long argument In the rare case that a short-hand is specified but does not match the key binding, then it is highlighed differently. -The highlighting is done using using `transient-mismatched-key' +The highlighting is done using `transient-mismatched-key' and `transient-nonstandard-key'." :package-version '(transient . "0.1.0") :group 'transient diff --git a/src/lisp.h b/src/lisp.h index 7a7d2e79979..e4a49b8ef94 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3451,7 +3451,7 @@ union specbinding #define WRAP_SPECPDL_REF 1 #endif -/* Abstract reference to to a specpdl entry. +/* Abstract reference to a specpdl entry. The number is always a multiple of sizeof (union specbinding). */ #ifdef WRAP_SPECPDL_REF /* Use a proper type for specpdl_ref if it does not make the code slower, diff --git a/test/lisp/cedet/semantic-utest-ia-resources/teststruct.cpp b/test/lisp/cedet/semantic-utest-ia-resources/teststruct.cpp index e7d85101a1a..f5b6d641842 100644 --- a/test/lisp/cedet/semantic-utest-ia-resources/teststruct.cpp +++ b/test/lisp/cedet/semantic-utest-ia-resources/teststruct.cpp @@ -20,7 +20,7 @@ // along with GNU Emacs. If not, see . -// Note: initially provided by by Alex Ott. +// Note: initially provided by Alex Ott. template struct grammar { -- cgit v1.2.3 From 05d240997aeb6ffe3db21e7f4c8e2f181edc37b6 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 2 Jul 2022 12:59:41 +0200 Subject: Add native-compile-prune-cache command * lisp/emacs-lisp/comp.el (native-compile-prune-cache): New command (bug#48108). --- etc/NEWS | 9 ++++++++- lisp/emacs-lisp/comp.el | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/etc/NEWS b/etc/NEWS index 30404cc13c2..4b3a02b2e00 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -148,8 +148,15 @@ This is run at the end of the Emacs startup process, and is meant to be used to reinitialize structures that would normally be done at load time. +** Native Compilation + +--- +*** New command 'native-compile-prune-cache'. +This command deletes older .eln cache entries (but not the ones for +the current Emacs version). + --- -** New function 'startup-redirect-eln-cache'. +*** New function 'startup-redirect-eln-cache'. This function can be called in your init files to change the user-specific directory where Emacs stores the "*.eln" files produced by native compilation of Lisp packages Emacs loads. The default diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 4ce2ce75e10..2109aa9923a 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -4288,6 +4288,30 @@ of (commands) to run simultaneously." (let ((load (not (not load)))) (native--compile-async files recursively load selector))) +(defun native-compile-prune-cache () + "Remove .eln files that aren't applicable to the current Emacs invocation." + (interactive) + (dolist (dir native-comp-eln-load-path) + ;; If a directory is non absolute it is assumed to be relative to + ;; `invocation-directory'. + (setq dir (expand-file-name dir invocation-directory)) + (when (file-exists-p dir) + (dolist (subdir (directory-files dir t)) + (when (and (file-directory-p subdir) + (file-writable-p subdir) + (not (equal (file-name-nondirectory + (directory-file-name subdir)) + comp-native-version-dir))) + (message "Deleting %s..." subdir) + ;; We're being overly cautious here -- there shouldn't be + ;; anything but .eln files in these directories. + (dolist (eln (directory-files subdir t "\\.eln\\(\\.tmp\\)?\\'")) + (when (file-writable-p eln) + (delete-file eln))) + (when (directory-empty-p subdir) + (delete-directory subdir)))))) + (message "Cache cleared")) + (provide 'comp) ;; LocalWords: limplified limplified limplification limplify Limple LIMPLE libgccjit elc eln -- cgit v1.2.3 From 8d68760ddee3690b4312fdb5d85210cb21b4eb7d Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Sat, 2 Jul 2022 12:01:18 +0200 Subject: ; Fix typos. --- admin/nt/dist-build/README-scripts | 2 +- doc/lispref/display.texi | 2 +- doc/lispref/loading.texi | 2 +- doc/lispref/processes.texi | 2 +- etc/tutorials/TUTORIAL.nl | 2 +- lisp/allout.el | 2 +- lisp/calc/calc-prog.el | 2 +- lisp/cedet/semantic/edit.el | 2 +- lisp/cedet/semantic/lex-spp.el | 2 +- lisp/emacs-lisp/easy-mmode.el | 2 +- lisp/env.el | 2 +- lisp/font-lock.el | 2 +- lisp/international/emoji.el | 2 +- lisp/mail/unrmail.el | 2 +- lisp/minibuffer.el | 2 +- lisp/mouse.el | 6 +++--- lisp/nxml/nxml-parse.el | 2 +- lisp/progmodes/cperl-mode.el | 2 +- lisp/progmodes/idlwave.el | 2 +- lisp/ps-print.el | 2 +- lisp/textmodes/texnfo-upd.el | 2 +- lisp/whitespace.el | 2 +- src/lread.c | 2 +- src/print.c | 2 +- 24 files changed, 26 insertions(+), 26 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/admin/nt/dist-build/README-scripts b/admin/nt/dist-build/README-scripts index 6b1adbe03e1..e99fbe07062 100644 --- a/admin/nt/dist-build/README-scripts +++ b/admin/nt/dist-build/README-scripts @@ -131,7 +131,7 @@ The process is the same as for building from the master branch, except that the release branch should already exist as a worktree, and the version number must be added to the command line with `build-zips.sh -V 27 -s`. The final zips will be named after the branch rather than -the version (e.g emacs-27-2019-12-26.zip) rather than than the Emacs +the version (e.g emacs-27-2019-12-26.zip) rather than the Emacs version (e.g emacs-27.0.50.zip). diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index e85d492bbb5..81799a2a577 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -8551,7 +8551,7 @@ displayed in the echo area. @vindex use-system-tooltips When Emacs is built with the GTK+ toolkit or Haiku windowing support, it by default displays tooltips using toolkit functions, and the -appearance of the tooltips is then controlled by by the toolkit's +appearance of the tooltips is then controlled by the toolkit's settings. Toolkit-provided tooltips can be disabled by changing the value of the variable @code{use-system-tooltips} to @code{nil}. The rest of this subsection describes how to control non-toolkit tooltips, diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index 00a1fe05fdd..54fc16ec9f0 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -728,7 +728,7 @@ variables to control this: The value of this constant is a regexp that matches autoload cookies. @code{loaddefs-generate} copies the Lisp form that follows the cookie into the autoload file it generates. This will match comments -like like @samp{;;;###autoload} and @samp{;;;###calc-autoload}. +like @samp{;;;###autoload} and @samp{;;;###calc-autoload}. @end defvar @defvar generated-autoload-file diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 14856b9e050..80c371e1c6a 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -3547,7 +3547,7 @@ and @code{#x1c} @code{#x28} to @w{@code{(3 5 10 11 12)}}. @item fill @var{len} @var{len} bytes used as a mere filler. In packing, these bytes are -are left unchanged, which normally means they remain zero. +left unchanged, which normally means they remain zero. When unpacking, this just returns nil. @item align @var{len} diff --git a/etc/tutorials/TUTORIAL.nl b/etc/tutorials/TUTORIAL.nl index 2ec3fac11bd..7aaed218ff6 100644 --- a/etc/tutorials/TUTORIAL.nl +++ b/etc/tutorials/TUTORIAL.nl @@ -1158,7 +1158,7 @@ overeenkomende commandonaam zoals find-file. -------------------- Je kunt meer over Emacs leren door haar handleiding te lezen. Deze is -zowel als boek als in in Emacs beschikbaar (gebruik het Help menu of +zowel als boek als in Emacs beschikbaar (gebruik het Help menu of tik C-h r). Kijk bijvoorbeeld eens naar "completion", wat minder tikwerk oplevert, of "dired" wat het omgaan met bestanden vereenvoudigt. diff --git a/lisp/allout.el b/lisp/allout.el index 4624c236f5a..de8ee85b391 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -26,7 +26,7 @@ ;;; Commentary: ;; Allout outline minor mode provides extensive outline formatting and -;; and manipulation beyond standard Emacs outline mode. Some features: +;; manipulation beyond standard Emacs outline mode. Some features: ;; ;; - Classic outline-mode topic-oriented navigation and exposure adjustment ;; - Topic-oriented editing including coherent topic and subtopic diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index dc2a086bbd7..ec30ee7e0fa 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -1949,7 +1949,7 @@ Redefine the corresponding command." ;; The variable math-exp-env is local to math-define-body, but is ;; used by math-define-exp, which is called (indirectly) by -;; by math-define-body. +;; math-define-body. (defvar math-exp-env) (defun math-define-body (body exp-env) diff --git a/lisp/cedet/semantic/edit.el b/lisp/cedet/semantic/edit.el index 76230d438a1..4679500ed99 100644 --- a/lisp/cedet/semantic/edit.el +++ b/lisp/cedet/semantic/edit.el @@ -610,7 +610,7 @@ This function is for internal use by `semantic-edits-incremental-parser'." (setq last-cond "Beginning of buffer") (setq parse-start ;; Don't worry about parents since - ;; there there would be an exact + ;; there would be an exact ;; match in the tag list otherwise ;; and the routine would fail. (point-min) diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el index 57e59f4e9fe..4bdaaf77acf 100644 --- a/lisp/cedet/semantic/lex-spp.el +++ b/lisp/cedet/semantic/lex-spp.el @@ -1074,7 +1074,7 @@ and variable state from the current buffer." )) ;; Second Cheat: copy key variables regarding macro state from the - ;; the originating buffer we are parsing. We need to do this every time + ;; originating buffer we are parsing. We need to do this every time ;; since the state changes. (dolist (V important-vars) (set V (buffer-local-value V origbuff))) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index f35362b371c..c3a4e9fc7ab 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -408,7 +408,7 @@ or call the function `%s'.")))) No problems result if this variable is not bound. `add-hook' automatically binds it. (This is true for all hook variables.)" modefun))) - ;; Allow using using `M-x customize-variable' on the hook. + ;; Allow using `M-x customize-variable' on the hook. (put ',hook 'custom-type 'hook) (put ',hook 'standard-value (list nil)) diff --git a/lisp/env.el b/lisp/env.el index a630bf120f8..a35383a13b1 100644 --- a/lisp/env.el +++ b/lisp/env.el @@ -225,7 +225,7 @@ VARIABLES is a list of variable settings of the form (VAR VALUE), where VAR is the name of the variable (a string) and VALUE is its value (also a string). -The previous values will be be restored upon exit." +The previous values will be restored upon exit." (declare (indent 1) (debug (sexp body))) (unless (consp variables) (error "Invalid VARIABLES: %s" variables)) diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 7eeaf2f547f..206879b1694 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -2361,7 +2361,7 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item." ;; e.g. assembler code and GNU linker script in Linux kernel. ;; `cpp-font-lock-keywords' is handy for modes for the files. ;; -;; Here we cannot use `regexp-opt' because because regex-opt is not preloaded +;; Here we cannot use `regexp-opt' because regex-opt is not preloaded ;; while font-lock.el is preloaded to emacs. So values pre-calculated with ;; regexp-opt are used here. diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index b108788571c..27b725b0aad 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el @@ -711,7 +711,7 @@ FACTOR is the multiplication factor for the size." (interactive) (message (substitute-command-keys - "Zoom with with \\\\[emoji-zoom-increase] and \\[emoji-zoom-decrease]")) + "Zoom with \\\\[emoji-zoom-increase] and \\[emoji-zoom-decrease]")) (set-transient-map emoji-zoom-map t) (let* ((factor (or factor 1.1)) (old (get-text-property (point) 'face)) diff --git a/lisp/mail/unrmail.el b/lisp/mail/unrmail.el index 8ce5afa9622..9e7194e4a02 100644 --- a/lisp/mail/unrmail.el +++ b/lisp/mail/unrmail.el @@ -208,7 +208,7 @@ The variable `unrmail-mbox-format' controls which mbox format to use." (setq mail-from (or (let ((from (mail-fetch-field "Mail-From"))) ;; mail-mbox-from (below) returns a ;; string that ends in a newline, but - ;; but mail-fetch-field does not, so + ;; mail-fetch-field does not, so ;; we append a newline here. (if from (format "%s\n" from))) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 9ffaff7c8e2..69a10ce4e2d 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2135,7 +2135,7 @@ and with BASE-SIZE appended as the last element." (lambda (elem) (let ((str ;; Don't modify the string itself, but a copy, since the - ;; the string may be read-only or used for other purposes. + ;; string may be read-only or used for other purposes. ;; Furthermore, since `completions' may come from ;; display-completion-list, `elem' may be a list. (if (consp elem) diff --git a/lisp/mouse.el b/lisp/mouse.el index 98e49c3598f..ddcb51aecf2 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1200,7 +1200,7 @@ frame with the mouse." (<= (- right parent-right) snap-width) snap-x (<= (- last-x snap-x) snap-width)) ;; Stay snapped when the mouse moved rightward but - ;; not more more than `snap-width' pixels from the + ;; not more than `snap-width' pixels from the ;; time FRAME snapped. (setq left (- parent-right native-width))) (t @@ -1222,7 +1222,7 @@ frame with the mouse." (<= (- parent-top top) snap-width) snap-y (<= (- snap-y last-y) snap-width)) ;; Stay snapped when the mouse moved upward but - ;; not more more than `snap-width' pixels from the + ;; not more than `snap-width' pixels from the ;; time FRAME snapped. (setq top parent-top)) (t @@ -1244,7 +1244,7 @@ frame with the mouse." (<= (- bottom parent-bottom) snap-width) snap-y (<= (- last-y snap-y) snap-width)) ;; Stay snapped when the mouse moved downward but - ;; not more more than `snap-width' pixels from the + ;; not more than `snap-width' pixels from the ;; time FRAME snapped. (setq top (- parent-bottom native-height))) (t diff --git a/lisp/nxml/nxml-parse.el b/lisp/nxml/nxml-parse.el index ff9eda3fd2a..56ba4480bfa 100644 --- a/lisp/nxml/nxml-parse.el +++ b/lisp/nxml/nxml-parse.el @@ -246,7 +246,7 @@ same way as well-formedness error." parsed-attributes))) (setq atts (cdr atts))) ;; We want to end up with the attributes followed by the - ;; the namespace attributes in the same order as + ;; namespace attributes in the same order as ;; xmltok-attributes and xmltok-namespace-attributes respectively. (when parsed-namespace-attributes (setq parsed-attributes diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index e571cee83c6..f51d2fcb115 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -1322,7 +1322,7 @@ name, and one for the discovery of a following BLOCK.") ,cperl--ws+-rx (group-n 2 ,cperl--normal-identifier-rx)) "A regular expression to detect a subroutine start. -Contains three groups: One one to distinguish lexical from +Contains three groups: One to distinguish lexical from \"normal\" subroutines, for the keyword \"sub\", and one for the subroutine name.") diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index edb53793e64..f55e3449e4a 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -3247,7 +3247,7 @@ ignored." ;; In the following while statements, after one iteration ;; point will be at the beginning of a line in which case ;; the while will not be executed for the - ;; the first paragraph line and thus will not affect the + ;; first paragraph line and thus will not affect the ;; indentation. ;; ;; First check to see if indentation is based on hanging indent. diff --git a/lisp/ps-print.el b/lisp/ps-print.el index 8df5204fa12..069d116907e 100644 --- a/lisp/ps-print.el +++ b/lisp/ps-print.el @@ -6415,7 +6415,7 @@ If FACE is not a valid face name, use default face." (ps-end-job needs-begin-file) ;; Setting this variable tells the unwind form that the - ;; the PostScript was generated without error. + ;; PostScript was generated without error. (setq completed-safely t)) ;; Unwind form: If some bad mojo occurred while generating diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el index 5b468dc808b..e44aa06e3dd 100644 --- a/lisp/textmodes/texnfo-upd.el +++ b/lisp/textmodes/texnfo-upd.el @@ -1367,7 +1367,7 @@ left at the end of the node line." ;; There may be an @chapter or other such command between ;; the top node line and the next node line, as a title ;; for an `ifinfo' section. This @chapter command must - ;; must be skipped. So the procedure is to search for + ;; be skipped. So the procedure is to search for ;; the next `@node' line, and then copy its name. (if (re-search-forward "^@node" nil t) (progn diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 98f21ce9a5f..240f99effc2 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -1697,7 +1697,7 @@ cleaning up these problems." (rstart (min start end)) (rend (max start end)) ;; Fall back to whitespace-style so we can run before - ;; before the mode is active. + ;; the mode is active. (style (copy-sequence (or whitespace-active-style whitespace-style))) (bogus-list diff --git a/src/lread.c b/src/lread.c index 66b13916465..ef2bb036e35 100644 --- a/src/lread.c +++ b/src/lread.c @@ -4877,7 +4877,7 @@ oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff /* Like 'oblookup', but considers 'Vread_symbol_shorthands', potentially recognizing that IN is shorthand for some other - longhand name, which is then then placed in OUT. In that case, + longhand name, which is then placed in OUT. In that case, memory is malloc'ed for OUT (which the caller must free) while SIZE_OUT and SIZE_BYTE_OUT respectively hold the character and byte sizes of the transformed symbol name. If IN is not recognized diff --git a/src/print.c b/src/print.c index d562500b619..4d7e42df1e8 100644 --- a/src/print.c +++ b/src/print.c @@ -727,7 +727,7 @@ Optional argument OVERRIDES should be a list of settings for print-related variables. An element in this list can be the symbol t, which means "reset all the values to their defaults". Otherwise, an element should be a pair, where the `car' or the pair is the setting symbol, and the `cdr' is the -value of of the setting to use for this `prin1' call. +value of the setting to use for this `prin1' call. For instance: -- cgit v1.2.3 From b31680ef040d4a232619e8d070794a43d2cdca2c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 3 Jul 2022 12:55:00 +0200 Subject: Add new function `seq-split' * doc/lispref/sequences.texi (Sequence Functions): Document it. * lisp/emacs-lisp/seq.el (seq-split): New function. * lisp/emacs-lisp/shortdoc.el (sequence): Mention it. --- doc/lispref/sequences.texi | 14 ++++++++++++++ etc/NEWS | 4 ++++ lisp/emacs-lisp/seq.el | 15 +++++++++++++++ lisp/emacs-lisp/shortdoc.el | 2 ++ test/lisp/emacs-lisp/seq-tests.el | 21 +++++++++++++++++++++ 5 files changed, 56 insertions(+) (limited to 'lisp/emacs-lisp') diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index c3f4cff3015..39230d0adc4 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi @@ -577,6 +577,20 @@ starting from the first one for which @var{predicate} returns @code{nil}. @end example @end defun +@defun seq-split sequence length + This function returns a list consisting of sub-sequences of +@var{sequence} of (at most) length @var{length}. (The final element +may be shorter than @var{length} if the length of @var{sequence} isn't +a multiple of @var{length}. + +@example +@group +(seq-split [0 1 2 3 4] 2) +@result{} ([0 1] [2 3] [4]) +@end group +@end example +@end defun + @defun seq-do function sequence This function applies @var{function} to each element of @var{sequence} in turn (presumably for side effects), and returns diff --git a/etc/NEWS b/etc/NEWS index af3240e5046..e1cdbd5077a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2250,6 +2250,10 @@ patcomp.el, pc-mode.el, pc-select.el, s-region.el, and sregex.el. * Lisp Changes in Emacs 29.1 ++++ +** New function 'seq-split'. +This returns a list of sub-sequences of the specified sequence. + +++ ** 'plist-get', 'plist-put' and 'plist-member' are no longer limited to 'eq'. These function now take an optional comparison predicate argument. diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 947b64e8687..36c17f4cd5e 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -632,5 +632,20 @@ Signal an error if SEQUENCE is empty." ;; we automatically highlight macros. (add-hook 'emacs-lisp-mode-hook #'seq--activate-font-lock-keywords)) +(defun seq-split (sequence length) + "Split SEQUENCE into a list of sub-sequences of at most LENGTH. +All the sub-sequences will be of LENGTH, except the last one, +which may be shorter." + (when (< length 1) + (error "Sub-sequence length must be larger than zero")) + (let ((result nil) + (seq-length (length sequence)) + (start 0)) + (while (< start seq-length) + (push (seq-subseq sequence start + (setq start (min seq-length (+ start length)))) + result)) + (nreverse result))) + (provide 'seq) ;;; seq.el ends here diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index c82aa3365cd..f53e783111c 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -889,6 +889,8 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'), :eval (seq-subseq '(a b c d e) 2 4)) (seq-take :eval (seq-take '(a b c d e) 3)) + (seq-split + :eval (seq-split [0 1 2 3 5] 2)) (seq-take-while :eval (seq-take-while #'cl-evenp [2 4 9 6 5])) (seq-uniq diff --git a/test/lisp/emacs-lisp/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el index 9e5d59163f9..d979604910e 100644 --- a/test/lisp/emacs-lisp/seq-tests.el +++ b/test/lisp/emacs-lisp/seq-tests.el @@ -511,5 +511,26 @@ Evaluate BODY for each created sequence. (should (equal (seq-difference '(1 nil) '(2 nil)) '(1))))) +(ert-deftest test-seq-split () + (let ((seq [0 1 2 3 4 5 6 7 8 9 10])) + (should (equal seq (car (seq-split seq 20)))) + (should (equal seq (car (seq-split seq 11)))) + (should (equal (seq-split seq 10) + '([0 1 2 3 4 5 6 7 8 9] [10]))) + (should (equal (seq-split seq 5) + '([0 1 2 3 4] [5 6 7 8 9] [10]))) + (should (equal (seq-split seq 1) + '([0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]))) + (should-error (seq-split seq 0)) + (should-error (seq-split seq -10))) + (let ((seq '(0 1 2 3 4 5 6 7 8 9))) + (should (equal (seq-split seq 5) + '((0 1 2 3 4) (5 6 7 8 9))))) + (let ((seq "0123456789")) + (should (equal (seq-split seq 2) + '("01" "23" "45" "67" "89"))) + (should (equal (seq-split seq 3) + '("012" "345" "678" "9"))))) + (provide 'seq-tests) ;;; seq-tests.el ends here -- cgit v1.2.3 From b72e4b149329797b8f2c947953251f92615ee73e Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 3 Jul 2022 14:05:01 +0200 Subject: Make string-limit with encoding return complete glyphs * lisp/emacs-lisp/subr-x.el (string-limit): Return more correct results in the CODING-SYSTEM case for coding systems with BOM and charset designations (bug#48324). Also amend the algorithm to return complete glyphs, not just complete code points. --- lisp/emacs-lisp/subr-x.el | 83 ++++++++++++++++++++++-------------- test/lisp/emacs-lisp/subr-x-tests.el | 23 ++++++++-- 2 files changed, 71 insertions(+), 35 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 390e505f009..56e8c2aa862 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -167,9 +167,9 @@ non-nil, return the last LENGTH characters instead. If CODING-SYSTEM is non-nil, STRING will be encoded before limiting, and LENGTH is interpreted as the number of bytes to limit the string to. The result will be a unibyte string that is -shorter than LENGTH, but will not contain \"partial\" characters, -even if CODING-SYSTEM encodes characters with several bytes per -character. +shorter than LENGTH, but will not contain \"partial\" +characters (or glyphs), even if CODING-SYSTEM encodes characters +with several bytes per character. When shortening strings for display purposes, `truncate-string-to-width' is almost always a better alternative @@ -177,34 +177,55 @@ than this function." (unless (natnump length) (signal 'wrong-type-argument (list 'natnump length))) (if coding-system - (let ((result nil) - (result-length 0) - (index (if end (1- (length string)) 0))) - ;; FIXME: This implementation, which uses encode-coding-char - ;; to encode the string one character at a time, is in general - ;; incorrect: coding-systems that produce prefix or suffix - ;; bytes, such as ISO-2022-based or UTF-8/16 with BOM, will - ;; produce those bytes for each character, instead of just - ;; once for the entire string. encode-coding-char attempts to - ;; remove those extra bytes at least in some situations, but - ;; it cannot do that in all cases. And in any case, producing - ;; what is supposed to be a UTF-16 or ISO-2022-CN encoded - ;; string which lacks the BOM bytes at the beginning and the - ;; charset designation sequences at the head and tail of the - ;; result will definitely surprise the callers in some cases. - (while (let ((encoded (encode-coding-char - (aref string index) coding-system))) - (and (<= (+ (length encoded) result-length) length) - (progn - (push encoded result) - (cl-incf result-length (length encoded)) - (setq index (if end (1- index) - (1+ index)))) - (if end (> index -1) - (< index (length string))))) - ;; No body. - ) - (apply #'concat (if end result (nreverse result)))) + ;; The previous implementation here tried to encode char by + ;; char, and then adding up the length of the encoded octets, + ;; but that's not reliably in the presence of BOM marks and + ;; ISO-2022-CN which may add charset designations at the + ;; start/end of each encoded char (which we don't want). So + ;; iterate (with a binary search) instead to find the desired + ;; length. + (let* ((glyphs (string-glyph-split string)) + (nglyphs (length glyphs)) + (too-long (1+ nglyphs)) + (stop (max (/ nglyphs 2) 1)) + (gap stop) + candidate encoded found candidate-stop) + ;; We're returning the end of the string. + (when end + (setq glyphs (nreverse glyphs))) + (while (and (not found) + (< stop too-long)) + (setq encoded + (encode-coding-string (string-join (seq-take glyphs stop)) + coding-system)) + (cond + ((= (length encoded) length) + (setq found encoded + candidate-stop stop)) + ;; Too long; try shortening. + ((> (length encoded) length) + (setq too-long stop + stop (max (- stop gap) 1))) + ;; Too short; try lengthening. + (t + (setq candidate encoded + candidate-stop stop) + (setq stop + (if (>= stop nglyphs) + too-long + (min (+ stop gap) nglyphs))))) + (setq gap (max (/ gap 2) 1))) + (cond + ((not (or found candidate)) + "") + ;; We're returning the end, so redo the encoding. + (end + (encode-coding-string + (string-join (nreverse (seq-take glyphs candidate-stop))) + coding-system)) + (t + (or found candidate)))) + ;; Char-based version. (cond ((<= (length string) length) string) (end (substring string (- (length string) length))) diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index 0bec9db36e9..99c0e822155 100644 --- a/test/lisp/emacs-lisp/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el @@ -607,21 +607,36 @@ (should (equal (string-limit "foó" 4 nil 'utf-8) "fo\303\263")) (should (equal (string-limit "foóa" 4 nil 'utf-8) "fo\303\263")) (should (equal (string-limit "foóá" 4 nil 'utf-8) "fo\303\263")) + (should (equal (string-limit "foóá" 2 nil 'utf-8-with-signature) + "")) (should (equal (string-limit "foóá" 4 nil 'utf-8-with-signature) - "fo\303\263")) + "\357\273\277f")) (should (equal (string-limit "foóa" 4 nil 'iso-8859-1) "fo\363a")) (should (equal (string-limit "foóá" 4 nil 'iso-8859-1) "fo\363\341")) - (should (equal (string-limit "foóá" 4 nil 'utf-16) "\000f\000o")) + (should (equal (string-limit "foóá" 3 nil 'utf-16) "")) + (should (equal (string-limit "foóá" 6 nil 'utf-16) "\376\377\000f\000o")) (should (equal (string-limit "foó" 10 t 'utf-8) "fo\303\263")) (should (equal (string-limit "foó" 3 t 'utf-8) "o\303\263")) (should (equal (string-limit "foó" 4 t 'utf-8) "fo\303\263")) (should (equal (string-limit "foóa" 4 t 'utf-8) "o\303\263a")) (should (equal (string-limit "foóá" 4 t 'utf-8) "\303\263\303\241")) - (should (equal (string-limit "foóá" 2 t 'utf-8-with-signature) "\303\241")) + (should (equal (string-limit "foóá" 2 t 'utf-8-with-signature) + "")) (should (equal (string-limit "foóa" 4 t 'iso-8859-1) "fo\363a")) (should (equal (string-limit "foóá" 4 t 'iso-8859-1) "fo\363\341")) - (should (equal (string-limit "foóá" 4 t 'utf-16) "\000\363\000\341"))) + (should (equal (string-limit "foóá" 6 t 'utf-16) "\376\377\000\363\000\341"))) + +(ert-deftest subr-string-limit-glyphs () + (should (equal (encode-coding-string "Hello, 👼🏻🧑🏼‍🤝‍🧑🏻" 'utf-8) + "Hello, \360\237\221\274\360\237\217\273\360\237\247\221\360\237\217\274\342\200\215\360\237\244\235\342\200\215\360\237\247\221\360\237\217\273")) + (should (= (length (encode-coding-string "Hello, 👼🏻🧑🏼‍🤝‍🧑🏻" 'utf-8)) 41)) + (should (equal (string-limit "Hello, 👼🏻🧑🏼‍🤝‍🧑🏻" 100 nil 'utf-8) + "Hello, \360\237\221\274\360\237\217\273\360\237\247\221\360\237\217\274\342\200\215\360\237\244\235\342\200\215\360\237\247\221\360\237\217\273")) + (should (equal (string-limit "Hello, 👼🏻🧑🏼‍🤝‍🧑🏻" 15 nil 'utf-8) + "Hello, \360\237\221\274\360\237\217\273")) + (should (equal (string-limit "Hello, 👼🏻🧑🏼‍🤝‍🧑🏻" 10 nil 'utf-8) + "Hello, "))) (ert-deftest subr-string-lines () (should (equal (string-lines "foo") '("foo"))) -- cgit v1.2.3 From b000bd47a6efbd12cab6e6a1b19a59014931abd8 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 3 Jul 2022 20:59:00 +0200 Subject: Font lock \\<> and \\{} command substitutions in docstrings * lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2): Support \\<> and \\{} command substitutions. --- lisp/emacs-lisp/lisp-mode.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 3797217e1a0..ac56d423391 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -476,9 +476,13 @@ This will generate compile-time constants from BINDINGS." "[ \t']*\\(" lisp-mode-symbol-regexp "\\)?") (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) - ;; Words inside \\[] or \\`' tend to be for `substitute-command-keys'. + ;; Words inside \\[], \\<>, \\{} or \\`' tend to be for + ;; `substitute-command-keys'. (,(rx "\\\\[" (group (regexp lisp-mode-symbol-regexp)) "]") (1 font-lock-constant-face prepend)) + (,(rx "\\\\" (or (seq "<" (group-n 1 (regexp lisp-mode-symbol-regexp)) ">") + (seq "{" (group-n 1 (regexp lisp-mode-symbol-regexp)) "}"))) + (1 font-lock-variable-name-face prepend)) (,(rx "\\\\`" (group (+ (regexp lisp-mode-symbol-regexp) ;; allow multiple words, e.g. "C-x a" -- cgit v1.2.3 From ae3416d69431fe80e767813bfe9837df599eca98 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 3 Jul 2022 23:05:50 +0200 Subject: Simplify lisp-el-font-lock-keywords-2 definition slightly * lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2): Simplify slightly. --- lisp/emacs-lisp/lisp-mode.el | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index ac56d423391..d61432b7ddf 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -478,17 +478,15 @@ This will generate compile-time constants from BINDINGS." (2 font-lock-constant-face nil t)) ;; Words inside \\[], \\<>, \\{} or \\`' tend to be for ;; `substitute-command-keys'. - (,(rx "\\\\[" (group (regexp lisp-mode-symbol-regexp)) "]") + (,(rx "\\\\" (or (seq "[" (group-n 1 (regexp lisp-mode-symbol-regexp)) "]") + (seq "`" (group-n 1 (+ (regexp lisp-mode-symbol-regexp) + ;; allow multiple words, e.g. "C-x a" + (? " "))) + "'"))) (1 font-lock-constant-face prepend)) (,(rx "\\\\" (or (seq "<" (group-n 1 (regexp lisp-mode-symbol-regexp)) ">") (seq "{" (group-n 1 (regexp lisp-mode-symbol-regexp)) "}"))) (1 font-lock-variable-name-face prepend)) - (,(rx "\\\\`" (group - (+ (regexp lisp-mode-symbol-regexp) - ;; allow multiple words, e.g. "C-x a" - (? " "))) - "'") - (1 font-lock-constant-face prepend)) ;; Ineffective backslashes (typically in need of doubling). ("\\(\\\\\\)\\([^\"\\]\\)" (1 (elisp--font-lock-backslash) prepend)) @@ -496,7 +494,7 @@ This will generate compile-time constants from BINDINGS." (,(concat "[`‘']\\(" lisp-mode-symbol-regexp "\\)['’]") (1 font-lock-constant-face prepend)) ;; \\= tends to be an escape in doc strings. - ("\\\\\\\\=" + (,(rx "\\\\=") (0 font-lock-builtin-face prepend)) ;; Constant values. (,(concat "\\_<:" lisp-mode-symbol-regexp "\\_>") -- cgit v1.2.3 From 1ac383bcb69578ac9e89ab00538d81ee8daee022 Mon Sep 17 00:00:00 2001 From: Daanturo Date: Mon, 4 Jul 2022 13:07:51 +0200 Subject: Add file-parent-directory function * doc/lispref/files.texi: Document the function. * etc/NEWS: Add its entry. * lisp/emacs-lisp/shortdoc.el: Add it to 'file-name' group. * lisp/files.el: implementation (bug#56355). --- doc/lispref/files.texi | 6 ++++++ etc/NEWS | 4 ++++ lisp/emacs-lisp/shortdoc.el | 7 +++++++ lisp/files.el | 17 +++++++++++++++++ 4 files changed, 34 insertions(+) (limited to 'lisp/emacs-lisp') diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index ea8683a6d8e..ee4e1ec4d96 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -2445,6 +2445,12 @@ You can use this function for directory names and for file names, because it recognizes abbreviations even as part of the name. @end defun +@defun file-parent-directory filename +This function returns the parent directory of @var{filename}. If +@var{filename} is at the top level, return @code{nil}. @var{filename} +can be relative to @code{default-directory}. +@end defun + @node File Name Expansion @subsection Functions that Expand Filenames @cindex expansion of file names diff --git a/etc/NEWS b/etc/NEWS index 3836efa6927..7967190c6e7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -339,6 +339,10 @@ increase and decrease the font size globally. Additionally, the variable 'global-text-scale-adjust-resizes-frames' controls whether the frames are resized when the font size is changed. ++++ +** New function 'file-parent-directory'. +Get the parent directory of a file. + ** New config variable 'syntax-wholeline-max' to reduce the cost of long lines. This variable is used by some operations (mostly syntax-propertization and font-locking) to treat lines longer than this variable as if they diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index f53e783111c..68293931c3c 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -353,6 +353,13 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'), (abbreviate-file-name :no-eval (abbreviate-file-name "/home/some-user") :eg-result "~some-user") + (file-parent-directory + :eval (file-parent-directory "/foo/bar") + :eval (file-parent-directory "~") + :eval (file-parent-directory "/tmp/") + :eval (file-parent-directory "foo/bar") + :eval (file-parent-directory "foo") + :eval (file-parent-directory "/")) "Quoted File Names" (file-name-quote :args (name) diff --git a/lisp/files.el b/lisp/files.el index 1295c24c933..b952b08ff47 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5145,6 +5145,23 @@ On most systems, this will be true: (setq filename nil)))) components)) +(defun file-parent-directory (filename) + "Return the parent directory of FILENAME. +If FILENAME is at the top level, return nil. FILENAME can be +relative to `default-directory'." + (let* ((expanded-filename (expand-file-name filename)) + (parent (file-name-directory (directory-file-name expanded-filename)))) + (cond + ;; filename is at top-level, therefore no parent + ((or (null parent) + (file-equal-p parent expanded-filename)) + nil) + ;; filename is relative, return relative parent + ((not (file-name-absolute-p filename)) + (file-relative-name parent)) + (t + parent)))) + (defcustom make-backup-file-name-function #'make-backup-file-name--default-function "A function that `make-backup-file-name' uses to create backup file names. -- cgit v1.2.3 From 544361d37f3877b2f10c362936a283f4a0b2fa71 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Mon, 4 Jul 2022 14:12:24 +0200 Subject: Replace lisp-mode-symbol-regexp with (rx lisp-mode-symbol) This is shorter, simplifies use inside rx expressions, and removes need for eval-when-compile elsewhere (for later exploitation). * lisp/emacs-lisp/lisp-mode.el (lisp-mode-symbol): New rx-define. (lisp-mode-symbol-regexp): Redefine using lisp-mode-symbol. (lisp-imenu-generic-expression, lisp--el-match-keyword) (lisp-fdefs, lisp-string-in-doc-position-p): * lisp/emacs-lisp/checkdoc.el (checkdoc--error-bad-format-p): * lisp/emacs-lisp/shorthands.el (shorthands-font-lock-shorthands): Use lisp-mode-symbol instead of lisp-mode-symbol-regexp. --- lisp/emacs-lisp/checkdoc.el | 6 ++--- lisp/emacs-lisp/lisp-mode.el | 56 +++++++++++++++++++++++-------------------- lisp/emacs-lisp/shorthands.el | 2 +- 3 files changed, 34 insertions(+), 30 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 2cb5fa120e0..2c9adfe2d27 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -165,7 +165,7 @@ (require 'cl-lib) (require 'help-mode) ;; for help-xref-info-regexp (require 'thingatpt) ;; for handy thing-at-point-looking-at -(require 'lisp-mode) ;; for lisp-mode-symbol-regexp +(require 'lisp-mode) ;; for lisp-mode-symbol regexp (eval-when-compile (require 'dired)) ;; for dired-map-over-marks (require 'lisp-mnt) @@ -2604,13 +2604,13 @@ The correct format is \"Foo\" or \"some-symbol: Foo\". See also (unless (let ((case-fold-search nil)) (looking-at (rx (or upper-case "%s")))) ;; A defined Lisp symbol is always okay. - (unless (and (looking-at (rx (group (regexp lisp-mode-symbol-regexp)))) + (unless (and (looking-at (rx (group lisp-mode-symbol))) (or (fboundp (intern (match-string 1))) (boundp (intern (match-string 1))))) ;; Other Lisp symbols are sometimes okay. (rx-let ((c (? "\\\n"))) ; `c' is for a continued line (let ((case-fold-search nil) - (some-symbol (rx (regexp lisp-mode-symbol-regexp) + (some-symbol (rx lisp-mode-symbol c ":" c (+ (any " \t\n")))) (lowercase-str (rx c (group (any "a-z") (+ wordchar))))) (if (looking-at some-symbol) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index d61432b7ddf..ab572d57952 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -89,8 +89,12 @@ table) "Syntax table used in `lisp-mode'.") +(rx-define lisp-mode-symbol (+ (| (syntax word) + (syntax symbol) + (: "\\" nonl)))) + (eval-and-compile - (defconst lisp-mode-symbol-regexp "\\(?:\\sw\\|\\s_\\|\\\\.\\)+")) + (defconst lisp-mode-symbol-regexp (rx lisp-mode-symbol))) (defvar lisp-imenu-generic-expression (list @@ -117,7 +121,7 @@ ;; CLOS and EIEIO "defgeneric" "defmethod") t)) - "\\s-+\\(" lisp-mode-symbol-regexp "\\)")) + "\\s-+\\(" (rx lisp-mode-symbol) "\\)")) 2) ;; Like the previous, but uses a quoted symbol as the name. (list nil @@ -126,7 +130,7 @@ (regexp-opt '("defalias" "define-obsolete-function-alias") t)) - "\\s-+'\\(" lisp-mode-symbol-regexp "\\)")) + "\\s-+'\\(" (rx lisp-mode-symbol) "\\)")) 2) (list (purecopy "Variables") (purecopy (concat "^\\s-*(" @@ -138,12 +142,12 @@ "defconstant" "defparameter" "define-symbol-macro") t)) - "\\s-+\\(" lisp-mode-symbol-regexp "\\)")) + "\\s-+\\(" (rx lisp-mode-symbol) "\\)")) 2) ;; For `defvar'/`defvar-local', we ignore (defvar FOO) constructs. (list (purecopy "Variables") (purecopy (concat "^\\s-*(defvar\\(?:-local\\)?\\s-+\\(" - lisp-mode-symbol-regexp "\\)" + (rx lisp-mode-symbol) "\\)" "[[:space:]\n]+[^)]")) 1) (list (purecopy "Types") @@ -160,7 +164,7 @@ ;; CLOS and EIEIO "defclass") t)) - "\\s-+'?\\(" lisp-mode-symbol-regexp "\\)")) + "\\s-+'?\\(" (rx lisp-mode-symbol) "\\)")) 2)) "Imenu generic expression for Lisp mode. See `imenu-generic-expression'.") @@ -270,7 +274,7 @@ to a package-local -loaddefs.el file.") (catch 'found (while (re-search-forward (eval-when-compile - (concat "(\\(" lisp-mode-symbol-regexp "\\)\\_>")) + (concat "(\\(" (rx lisp-mode-symbol) "\\)\\_>")) limit t) (let ((sym (intern-soft (match-string 1)))) (when (and (or (special-form-p sym) (macrop sym)) @@ -419,8 +423,8 @@ This will generate compile-time constants from BINDINGS." ;; Any whitespace and defined object. "[ \t']*" "\\(([ \t']*\\)?" ;; An opening paren. - "\\(\\(setf\\)[ \t]+" lisp-mode-symbol-regexp - "\\|" lisp-mode-symbol-regexp "\\)?") + "\\(\\(setf\\)[ \t]+" (rx lisp-mode-symbol) + "\\|" (rx lisp-mode-symbol) "\\)?") (1 font-lock-keyword-face) (3 (let ((type (get (intern-soft (match-string 1)) 'lisp-define-type))) (cond ((eq type 'var) font-lock-variable-name-face) @@ -446,8 +450,8 @@ This will generate compile-time constants from BINDINGS." ;; Any whitespace and defined object. "[ \t']*" "\\(([ \t']*\\)?" ;; An opening paren. - "\\(\\(setf\\)[ \t]+" lisp-mode-symbol-regexp - "\\|" lisp-mode-symbol-regexp "\\)?") + "\\(\\(setf\\)[ \t]+" (rx lisp-mode-symbol) + "\\|" (rx lisp-mode-symbol) "\\)?") (1 font-lock-keyword-face) (3 (let ((type (get (intern-soft (match-string 1)) 'lisp-define-type))) (cond ((eq type 'var) font-lock-variable-name-face) @@ -473,34 +477,34 @@ This will generate compile-time constants from BINDINGS." (lisp--el-match-keyword . 1) ;; Exit/Feature symbols as constants. (,(concat "(\\(catch\\|throw\\|featurep\\|provide\\|require\\)\\_>" - "[ \t']*\\(" lisp-mode-symbol-regexp "\\)?") + "[ \t']*\\(" (rx lisp-mode-symbol) "\\)?") (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) ;; Words inside \\[], \\<>, \\{} or \\`' tend to be for ;; `substitute-command-keys'. - (,(rx "\\\\" (or (seq "[" (group-n 1 (regexp lisp-mode-symbol-regexp)) "]") - (seq "`" (group-n 1 (+ (regexp lisp-mode-symbol-regexp) + (,(rx "\\\\" (or (seq "[" (group-n 1 lisp-mode-symbol) "]") + (seq "`" (group-n 1 (+ lisp-mode-symbol ;; allow multiple words, e.g. "C-x a" (? " "))) "'"))) (1 font-lock-constant-face prepend)) - (,(rx "\\\\" (or (seq "<" (group-n 1 (regexp lisp-mode-symbol-regexp)) ">") - (seq "{" (group-n 1 (regexp lisp-mode-symbol-regexp)) "}"))) + (,(rx "\\\\" (or (seq "<" (group-n 1 lisp-mode-symbol) ">") + (seq "{" (group-n 1 lisp-mode-symbol) "}"))) (1 font-lock-variable-name-face prepend)) ;; Ineffective backslashes (typically in need of doubling). ("\\(\\\\\\)\\([^\"\\]\\)" (1 (elisp--font-lock-backslash) prepend)) ;; Words inside ‘’, '' and `' tend to be symbol names. - (,(concat "[`‘']\\(" lisp-mode-symbol-regexp "\\)['’]") + (,(concat "[`‘']\\(" (rx lisp-mode-symbol) "\\)['’]") (1 font-lock-constant-face prepend)) ;; \\= tends to be an escape in doc strings. (,(rx "\\\\=") (0 font-lock-builtin-face prepend)) ;; Constant values. - (,(concat "\\_<:" lisp-mode-symbol-regexp "\\_>") + (,(concat "\\_<:" (rx lisp-mode-symbol) "\\_>") (0 font-lock-builtin-face)) ;; ELisp and CLisp `&' keywords as types. - (,(concat "\\_<&" lisp-mode-symbol-regexp "\\_>") + (,(concat "\\_<&" (rx lisp-mode-symbol) "\\_>") . font-lock-type-face) ;; ELisp regexp grouping constructs (,(lambda (bound) @@ -537,30 +541,30 @@ This will generate compile-time constants from BINDINGS." (,(concat "(" cl-kws-re "\\_>") . 1) ;; Exit/Feature symbols as constants. (,(concat "(\\(catch\\|throw\\|provide\\|require\\)\\_>" - "[ \t']*\\(" lisp-mode-symbol-regexp "\\)?") + "[ \t']*\\(" (rx lisp-mode-symbol) "\\)?") (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) ;; Erroneous structures. (,(concat "(" cl-errs-re "\\_>") (1 font-lock-warning-face)) ;; Words inside ‘’ and `' tend to be symbol names. - (,(concat "[`‘]\\(" lisp-mode-symbol-regexp "\\)['’]") + (,(concat "[`‘]\\(" (rx lisp-mode-symbol) "\\)['’]") (1 font-lock-constant-face prepend)) ;; Uninterned symbols, e.g., (defpackage #:my-package ...) ;; must come before keywords below to have effect - (,(concat "#:" lisp-mode-symbol-regexp "") 0 font-lock-builtin-face) + (,(concat "#:" (rx lisp-mode-symbol) "") 0 font-lock-builtin-face) ;; Constant values. - (,(concat "\\_<:" lisp-mode-symbol-regexp "\\_>") + (,(concat "\\_<:" (rx lisp-mode-symbol) "\\_>") (0 font-lock-builtin-face)) ;; ELisp and CLisp `&' keywords as types. - (,(concat "\\_<&" lisp-mode-symbol-regexp "\\_>") + (,(concat "\\_<&" (rx lisp-mode-symbol) "\\_>") . font-lock-type-face) ;; This is too general -- rms. ;; A user complained that he has functions whose names start with `do' ;; and that they get the wrong color. ;; That user has violated the https://www.cliki.net/Naming+conventions: ;; CL (but not EL!) `with-' (context) and `do-' (iteration) - (,(concat "(\\(\\(do-\\|with-\\)" lisp-mode-symbol-regexp "\\)") + (,(concat "(\\(\\(do-\\|with-\\)" (rx lisp-mode-symbol) "\\)") (1 font-lock-keyword-face)) (lisp--match-hidden-arg (0 '(face font-lock-warning-face @@ -596,7 +600,7 @@ containing STARTPOS." (and (looking-at (eval-when-compile (concat "([ \t\n]*\\(" - lisp-mode-symbol-regexp "\\)"))) + (rx lisp-mode-symbol) "\\)"))) (match-string 1))))) (docelt (and firstsym (function-get (intern-soft firstsym) diff --git a/lisp/emacs-lisp/shorthands.el b/lisp/emacs-lisp/shorthands.el index a9e4343715c..75cbe5f1923 100644 --- a/lisp/emacs-lisp/shorthands.el +++ b/lisp/emacs-lisp/shorthands.el @@ -62,7 +62,7 @@ (when read-symbol-shorthands (while (re-search-forward (eval-when-compile - (concat "\\_<\\(" lisp-mode-symbol-regexp "\\)\\_>")) + (concat "\\_<\\(" (rx lisp-mode-symbol) "\\)\\_>")) limit t) (let* ((existing (get-text-property (match-beginning 1) 'face)) (probe (and (not (memq existing '(font-lock-comment-face -- cgit v1.2.3 From 1268902db17501862e5efbd51a41108ffc5105f3 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Mon, 4 Jul 2022 14:52:50 +0200 Subject: Remove some useless `eval-when-compile` * lisp/cedet/semantic/java.el (semantic-java-number-regexp): * lisp/cedet/semantic/lex.el (semantic-lex-number-expression): * lisp/emacs-lisp/cl-indent.el (common-lisp-indent-function-1): * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression) (lisp--el-match-keyword, lisp-string-in-doc-position-p): * lisp/emacs-lisp/shorthands.el (shorthands-font-lock-shorthands): * lisp/net/socks.el (socks-send-command): * lisp/progmodes/meta-mode.el (meta-font-lock-keywords): * lisp/shell.el (shell--parse-pcomplete-arguments): * lisp/textmodes/sgml-mode.el (sgml-mode): * lisp/textmodes/tex-mode.el (tex--guess-mode) (tex-common-initialization, tex-input-files-re): * lisp/textmodes/tildify.el (tildify-mode): * lisp/xdg.el (xdg-line-regexp): Eliminate `eval-when-compile` when the argument would be evaluated by the compiler anyway. --- lisp/cedet/semantic/java.el | 37 ++++++++--------- lisp/cedet/semantic/lex.el | 37 ++++++++--------- lisp/emacs-lisp/cl-indent.el | 7 ++-- lisp/emacs-lisp/lisp-mode.el | 96 ++++++++++++++++++++----------------------- lisp/emacs-lisp/shorthands.el | 3 +- lisp/net/socks.el | 9 ++-- lisp/progmodes/meta-mode.el | 41 +++++++++--------- lisp/shell.el | 11 +++-- lisp/textmodes/sgml-mode.el | 11 +++-- lisp/textmodes/tex-mode.el | 33 +++++++-------- lisp/textmodes/tildify.el | 5 +-- lisp/xdg.el | 13 +++--- 12 files changed, 141 insertions(+), 162 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/cedet/semantic/java.el b/lisp/cedet/semantic/java.el index 9b70afd0a33..53fd4de2975 100644 --- a/lisp/cedet/semantic/java.el +++ b/lisp/cedet/semantic/java.el @@ -37,25 +37,24 @@ ;;; Lexical analysis ;; (defconst semantic-java-number-regexp - (eval-when-compile - (concat "\\(" - "\\<[0-9]+[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" - "\\|" - "\\<[0-9]+[.][eE][-+]?[0-9]+[fFdD]?\\>" - "\\|" - "\\<[0-9]+[.][fFdD]\\>" - "\\|" - "\\<[0-9]+[.]" - "\\|" - "[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" - "\\|" - "\\<[0-9]+[eE][-+]?[0-9]+[fFdD]?\\>" - "\\|" - "\\<0[xX][[:xdigit:]]+[lL]?\\>" - "\\|" - "\\<[0-9]+[lLfFdD]?\\>" - "\\)" - )) + (concat "\\(" + "\\<[0-9]+[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" + "\\|" + "\\<[0-9]+[.][eE][-+]?[0-9]+[fFdD]?\\>" + "\\|" + "\\<[0-9]+[.][fFdD]\\>" + "\\|" + "\\<[0-9]+[.]" + "\\|" + "[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" + "\\|" + "\\<[0-9]+[eE][-+]?[0-9]+[fFdD]?\\>" + "\\|" + "\\<0[xX][[:xdigit:]]+[lL]?\\>" + "\\|" + "\\<[0-9]+[lLfFdD]?\\>" + "\\)" + ) "Lexer regexp to match Java number terminals. Following is the specification of Java number literals. diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el index 885ffbf5a73..9c64cc9f7e5 100644 --- a/lisp/cedet/semantic/lex.el +++ b/lisp/cedet/semantic/lex.el @@ -574,25 +574,24 @@ may need to be overridden for some special languages.") (defvar-local semantic-lex-number-expression ;; This expression was written by David Ponce for Java, and copied ;; here for C and any other similar language. - (eval-when-compile - (concat "\\(" - "\\<[0-9]+[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" - "\\|" - "\\<[0-9]+[.][eE][-+]?[0-9]+[fFdD]?\\>" - "\\|" - "\\<[0-9]+[.][fFdD]\\>" - "\\|" - "\\<[0-9]+[.]" - "\\|" - "[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" - "\\|" - "\\<[0-9]+[eE][-+]?[0-9]+[fFdD]?\\>" - "\\|" - "\\<0[xX][[:xdigit:]]+[lL]?\\>" - "\\|" - "\\<[0-9]+[lLfFdD]?\\>" - "\\)" - )) + (concat "\\(" + "\\<[0-9]+[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" + "\\|" + "\\<[0-9]+[.][eE][-+]?[0-9]+[fFdD]?\\>" + "\\|" + "\\<[0-9]+[.][fFdD]\\>" + "\\|" + "\\<[0-9]+[.]" + "\\|" + "[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" + "\\|" + "\\<[0-9]+[eE][-+]?[0-9]+[fFdD]?\\>" + "\\|" + "\\<0[xX][[:xdigit:]]+[lL]?\\>" + "\\|" + "\\<[0-9]+[lLfFdD]?\\>" + "\\)" + ) "Regular expression for matching a number. If this value is nil, no number extraction is done during lex. This expression tries to match C and Java like numbers. diff --git a/lisp/emacs-lisp/cl-indent.el b/lisp/emacs-lisp/cl-indent.el index 213eecf88d4..fe7e4506d7c 100644 --- a/lisp/emacs-lisp/cl-indent.el +++ b/lisp/emacs-lisp/cl-indent.el @@ -378,10 +378,9 @@ instead." function) (setq tentative-defun t)) ((string-match - (eval-when-compile - (concat "\\`\\(" - (regexp-opt '("with" "without" "do")) - "\\)-")) + (concat "\\`\\(" + (regexp-opt '("with" "without" "do")) + "\\)-") function) (setq method '(&lambda &body)))))) ;; backwards compatibility. Bletch. diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index ab572d57952..888e3397199 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -100,48 +100,45 @@ (list (list nil (purecopy (concat "^\\s-*(" - (eval-when-compile - (regexp-opt - '("defun" "defmacro" - ;; Elisp. - "defun*" "defsubst" "define-inline" - "define-advice" "defadvice" "define-skeleton" - "define-compilation-mode" "define-minor-mode" - "define-global-minor-mode" - "define-globalized-minor-mode" - "define-derived-mode" "define-generic-mode" - "ert-deftest" - "cl-defun" "cl-defsubst" "cl-defmacro" - "cl-define-compiler-macro" "cl-defgeneric" - "cl-defmethod" - ;; CL. - "define-compiler-macro" "define-modify-macro" - "defsetf" "define-setf-expander" - "define-method-combination" - ;; CLOS and EIEIO - "defgeneric" "defmethod") - t)) + (regexp-opt + '("defun" "defmacro" + ;; Elisp. + "defun*" "defsubst" "define-inline" + "define-advice" "defadvice" "define-skeleton" + "define-compilation-mode" "define-minor-mode" + "define-global-minor-mode" + "define-globalized-minor-mode" + "define-derived-mode" "define-generic-mode" + "ert-deftest" + "cl-defun" "cl-defsubst" "cl-defmacro" + "cl-define-compiler-macro" "cl-defgeneric" + "cl-defmethod" + ;; CL. + "define-compiler-macro" "define-modify-macro" + "defsetf" "define-setf-expander" + "define-method-combination" + ;; CLOS and EIEIO + "defgeneric" "defmethod") + t) "\\s-+\\(" (rx lisp-mode-symbol) "\\)")) 2) ;; Like the previous, but uses a quoted symbol as the name. (list nil (purecopy (concat "^\\s-*(" - (eval-when-compile - (regexp-opt - '("defalias" "define-obsolete-function-alias") - t)) + (regexp-opt + '("defalias" "define-obsolete-function-alias") + t) "\\s-+'\\(" (rx lisp-mode-symbol) "\\)")) 2) (list (purecopy "Variables") (purecopy (concat "^\\s-*(" - (eval-when-compile - (regexp-opt - '(;; Elisp - "defconst" "defcustom" - ;; CL - "defconstant" - "defparameter" "define-symbol-macro") - t)) + (regexp-opt + '(;; Elisp + "defconst" "defcustom" + ;; CL + "defconstant" + "defparameter" "define-symbol-macro") + t) "\\s-+\\(" (rx lisp-mode-symbol) "\\)")) 2) ;; For `defvar'/`defvar-local', we ignore (defvar FOO) constructs. @@ -152,18 +149,17 @@ 1) (list (purecopy "Types") (purecopy (concat "^\\s-*(" - (eval-when-compile - (regexp-opt - '(;; Elisp - "defgroup" "deftheme" - "define-widget" "define-error" - "defface" "cl-deftype" "cl-defstruct" - ;; CL - "deftype" "defstruct" - "define-condition" "defpackage" - ;; CLOS and EIEIO - "defclass") - t)) + (regexp-opt + '(;; Elisp + "defgroup" "deftheme" + "define-widget" "define-error" + "defface" "cl-deftype" "cl-defstruct" + ;; CL + "deftype" "defstruct" + "define-condition" "defpackage" + ;; CLOS and EIEIO + "defclass") + t) "\\s-+'?\\(" (rx lisp-mode-symbol) "\\)")) 2)) @@ -273,8 +269,7 @@ to a package-local -loaddefs.el file.") ;; FIXME: Move to elisp-mode.el. (catch 'found (while (re-search-forward - (eval-when-compile - (concat "(\\(" (rx lisp-mode-symbol) "\\)\\_>")) + (concat "(\\(" (rx lisp-mode-symbol) "\\)\\_>") limit t) (let ((sym (intern-soft (match-string 1)))) (when (and (or (special-form-p sym) (macrop sym)) @@ -591,16 +586,15 @@ This will generate compile-time constants from BINDINGS." "Gaudy highlighting from Emacs Lisp mode used in Backtrace mode.") (defun lisp-string-in-doc-position-p (listbeg startpos) - "Return non-nil if a doc string may occur at STARTPOS inside a list. + "Return non-nil if a doc string may occur at STARTPOS inside a list. LISTBEG is the position of the start of the innermost list containing STARTPOS." (let* ((firstsym (and listbeg (save-excursion (goto-char listbeg) (and (looking-at - (eval-when-compile - (concat "([ \t\n]*\\(" - (rx lisp-mode-symbol) "\\)"))) + (concat "([ \t\n]*\\(" + (rx lisp-mode-symbol) "\\)")) (match-string 1))))) (docelt (and firstsym (function-get (intern-soft firstsym) diff --git a/lisp/emacs-lisp/shorthands.el b/lisp/emacs-lisp/shorthands.el index 75cbe5f1923..ffd3856db6c 100644 --- a/lisp/emacs-lisp/shorthands.el +++ b/lisp/emacs-lisp/shorthands.el @@ -61,8 +61,7 @@ (defun shorthands-font-lock-shorthands (limit) (when read-symbol-shorthands (while (re-search-forward - (eval-when-compile - (concat "\\_<\\(" (rx lisp-mode-symbol) "\\)\\_>")) + (concat "\\_<\\(" (rx lisp-mode-symbol) "\\)\\_>") limit t) (let* ((existing (get-text-property (match-beginning 1) 'face)) (probe (and (not (memq existing '(font-lock-comment-face diff --git a/lisp/net/socks.el b/lisp/net/socks.el index 8df0773e1d2..2ba1c20566f 100644 --- a/lisp/net/socks.el +++ b/lisp/net/socks.el @@ -407,11 +407,10 @@ When ATYPE indicates an IP, param ADDRESS must be given as raw bytes." (setq version (process-get proc 'socks-server-protocol)) (cond ((equal version 'http) - (setq request (format (eval-when-compile - (concat - "CONNECT %s:%d HTTP/1.0\r\n" - "User-Agent: Emacs/SOCKS v1.0\r\n" - "\r\n")) + (setq request (format (concat + "CONNECT %s:%d HTTP/1.0\r\n" + "User-Agent: Emacs/SOCKS v1.0\r\n" + "\r\n") (cond ((equal atype socks-address-type-name) address) (t diff --git a/lisp/progmodes/meta-mode.el b/lisp/progmodes/meta-mode.el index 5aaa277431a..34288e0e4fb 100644 --- a/lisp/progmodes/meta-mode.el +++ b/lisp/progmodes/meta-mode.el @@ -108,30 +108,27 @@ (macro-keywords-2 "\\(primarydef\\|secondarydef\\|tertiarydef\\)") (args-keywords - (eval-when-compile - (regexp-opt - '("expr" "suffix" "text" "primary" "secondary" "tertiary") - t))) + (regexp-opt + '("expr" "suffix" "text" "primary" "secondary" "tertiary") + t)) (type-keywords - (eval-when-compile - (regexp-opt - '("boolean" "color" "numeric" "pair" "path" "pen" "picture" - "string" "transform" "newinternal") - t))) + (regexp-opt + '("boolean" "color" "numeric" "pair" "path" "pen" "picture" + "string" "transform" "newinternal") + t)) (syntactic-keywords - (eval-when-compile - (regexp-opt - '("for" "forever" "forsuffixes" "endfor" - "step" "until" "upto" "downto" "thru" "within" - "iff" "if" "elseif" "else" "fi" "exitif" "exitunless" - "let" "def" "vardef" "enddef" "mode_def" - "true" "false" "known" "unknown" "and" "or" "not" - "save" "interim" "inner" "outer" "relax" - "begingroup" "endgroup" "expandafter" "scantokens" - "generate" "input" "endinput" "end" "bye" - "message" "errmessage" "errhelp" "special" "numspecial" - "readstring" "readfrom" "write") - t))) + (regexp-opt + '("for" "forever" "forsuffixes" "endfor" + "step" "until" "upto" "downto" "thru" "within" + "iff" "if" "elseif" "else" "fi" "exitif" "exitunless" + "let" "def" "vardef" "enddef" "mode_def" + "true" "false" "known" "unknown" "and" "or" "not" + "save" "interim" "inner" "outer" "relax" + "begingroup" "endgroup" "expandafter" "scantokens" + "generate" "input" "endinput" "end" "bye" + "message" "errmessage" "errhelp" "special" "numspecial" + "readstring" "readfrom" "write") + t)) ) (list ;; embedded TeX code in btex ... etex diff --git a/lisp/shell.el b/lisp/shell.el index 8bcc578406a..85225b128ab 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -440,12 +440,11 @@ Useful for shells like zsh that has this feature." (push (point) begins) (let ((arg ())) (while (looking-at - (eval-when-compile - (concat - "\\(?:[^\s\t\n\\\"';]+" - "\\|'\\([^']*\\)'?" - "\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?" - "\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)"))) + (concat + "\\(?:[^\s\t\n\\\"';]+" + "\\|'\\([^']*\\)'?" + "\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?" + "\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)")) (goto-char (match-end 0)) (cond ((match-beginning 3) ;Backslash escape. diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index ff881377a7e..13ff3dcab6a 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -600,12 +600,11 @@ Do \\[describe-key] on the following bindings to discover what they do. (setq-local tildify-foreach-region-function (apply-partially 'tildify-foreach-ignore-environments - `((,(eval-when-compile - (concat - "<\\(" - (regexp-opt '("pre" "dfn" "code" "samp" "kbd" "var" - "PRE" "DFN" "CODE" "SAMP" "KBD" "VAR")) - "\\)\\>[^>]*>")) + `((,(concat + "<\\(" + (regexp-opt '("pre" "dfn" "code" "samp" "kbd" "var" + "PRE" "DFN" "CODE" "SAMP" "KBD" "VAR")) + "\\)\\>[^>]*>") . ("")) ("") ("<" . ">")))) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 473643bb483..e90d214a127 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -983,14 +983,13 @@ Inherits `shell-mode-map' with a few additions.") (when (and slash (not comment)) (setq mode (if (looking-at - (eval-when-compile - (concat - (regexp-opt '("documentstyle" "documentclass" - "begin" "subsection" "section" - "part" "chapter" "newcommand" - "renewcommand" "RequirePackage") - 'words) - "\\|NeedsTeXFormat{LaTeX"))) + (concat + (regexp-opt '("documentstyle" "documentclass" + "begin" "subsection" "section" + "part" "chapter" "newcommand" + "renewcommand" "RequirePackage") + 'words) + "\\|NeedsTeXFormat{LaTeX")) (if (and (looking-at "document\\(style\\|class\\)\\(\\[.*\\]\\)?{slides}") ;; SliTeX is almost never used any more nowadays. @@ -1242,11 +1241,10 @@ Entering SliTeX mode runs the hook `text-mode-hook', then the hook (apply-partially #'tildify-foreach-ignore-environments `(("\\\\\\\\" . "") ; do not remove this - (,(eval-when-compile - (concat "\\\\begin{\\(" - (regexp-opt '("verbatim" "math" "displaymath" - "equation" "eqnarray" "eqnarray*")) - "\\)}")) + (,(concat "\\\\begin{\\(" + (regexp-opt '("verbatim" "math" "displaymath" + "equation" "eqnarray" "eqnarray*")) + "\\)}") . ("\\\\end{" 1 "}")) ("\\\\verb\\*?\\(.\\)" . (1)) ("\\$\\$?" . (0)) @@ -2126,11 +2124,10 @@ If NOT-ALL is non-nil, save the `.dvi' file." (defvar tex-compile-history nil) (defvar tex-input-files-re - (eval-when-compile - (concat "\\." (regexp-opt '("tex" "texi" "texinfo" - "bbl" "ind" "sty" "cls") t) - ;; Include files with no dots (for directories). - "\\'\\|\\`[^.]+\\'"))) + (concat "\\." (regexp-opt '("tex" "texi" "texinfo" + "bbl" "ind" "sty" "cls") t) + ;; Include files with no dots (for directories). + "\\'\\|\\`[^.]+\\'")) (defcustom tex-use-reftex t "If non-nil, use RefTeX's list of files to determine what command to use." diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el index 9dcfb10d6df..2a7ad295ab7 100644 --- a/lisp/textmodes/tildify.el +++ b/lisp/textmodes/tildify.el @@ -494,9 +494,8 @@ variable will be set to the representation." (if (not (string-equal " " (or space tildify-space-string))) (when space (setq tildify-space-string space)) - (message (eval-when-compile - (concat "Hard space is a single space character, tildify-" - "mode won't have any effect, disabling."))) + (message (concat "Hard space is a single space character, tildify-" + "mode won't have any effect, disabling.")) (setq tildify-mode nil)))) (if tildify-mode (add-hook 'post-self-insert-hook #'tildify-space nil t) diff --git a/lisp/xdg.el b/lisp/xdg.el index 6a0b1dedd1d..c7d9c0e785e 100644 --- a/lisp/xdg.el +++ b/lisp/xdg.el @@ -171,13 +171,12 @@ file:///foo/bar.jpg" ;; https://www.freedesktop.org/wiki/Software/xdg-user-dirs/ (defconst xdg-line-regexp - (eval-when-compile - (rx "XDG_" - (group-n 1 (or "DESKTOP" "DOWNLOAD" "TEMPLATES" "PUBLICSHARE" - "DOCUMENTS" "MUSIC" "PICTURES" "VIDEOS")) - "_DIR=\"" - (group-n 2 (or "/" "$HOME/") (*? (or (not (any "\"")) "\\\""))) - "\"")) + (rx "XDG_" + (group-n 1 (or "DESKTOP" "DOWNLOAD" "TEMPLATES" "PUBLICSHARE" + "DOCUMENTS" "MUSIC" "PICTURES" "VIDEOS")) + "_DIR=\"" + (group-n 2 (or "/" "$HOME/") (*? (or (not (any "\"")) "\\\""))) + "\"") "Regexp matching non-comment lines in `xdg-user-dirs' config files.") (defvar xdg-user-dirs nil -- cgit v1.2.3 From c933f988254168ae537301f37841e1f1ebeb42e9 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 4 Jul 2022 15:06:52 +0200 Subject: Fix scrolling backwards in Helper-help * lisp/emacs-lisp/helper.el (Helper-help-scroller): Fix scrolling backwards. --- lisp/emacs-lisp/helper.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/helper.el b/lisp/emacs-lisp/helper.el index 930dbfe6c49..cbc0afc3a72 100644 --- a/lisp/emacs-lisp/helper.el +++ b/lisp/emacs-lisp/helper.el @@ -77,9 +77,11 @@ (setq continue (read-event)) (cond ((and (memq continue '(?\s ?\C-v)) (< state 2)) (scroll-up)) - ((= continue ?\C-l) + ((eq continue ?\C-l) (recenter)) - ((and (= continue ?\177) (zerop (% state 2))) + ((and (or (eq continue 'backspace) + (eq continue ?\177)) + (zerop (% state 2))) (scroll-down)) (t (setq continue nil)))))))) -- cgit v1.2.3 From 0e5d790c6b8e38bbdffa146085771b7d10e6fc15 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 4 Jul 2022 15:45:18 +0200 Subject: Use substitute-command-keys in Helper-help * lisp/emacs-lisp/helper.el (Helper-help-scroller) (Helper-help-options, Helper-help): Use substitute-command-keys. (Helper-help-map): Prefer defvar-keymap. --- lisp/emacs-lisp/helper.el | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/helper.el b/lisp/emacs-lisp/helper.el index cbc0afc3a72..654dbbc5fef 100644 --- a/lisp/emacs-lisp/helper.el +++ b/lisp/emacs-lisp/helper.el @@ -1,6 +1,6 @@ ;;; helper.el --- utility help package supporting help in electric modes -*- lexical-binding: t; -*- -;; Copyright (C) 1985, 2001-2022 Free Software Foundation, Inc. +;; Copyright (C) 1985-2022 Free Software Foundation, Inc. ;; Author: K. Shane Hartman ;; Maintainer: emacs-devel@gnu.org @@ -39,19 +39,16 @@ ;; keymap either. -(defvar Helper-help-map - (let ((map (make-sparse-keymap))) - ;(fillarray map 'undefined) - (define-key map "m" 'Helper-describe-mode) - (define-key map "b" 'Helper-describe-bindings) - (define-key map "c" 'Helper-describe-key-briefly) - (define-key map "k" 'Helper-describe-key) - ;(define-key map "f" 'Helper-describe-function) - ;(define-key map "v" 'Helper-describe-variable) - (define-key map "?" 'Helper-help-options) - (define-key map (char-to-string help-char) 'Helper-help-options) - (fset 'Helper-help-map map) - map)) +(defvar-keymap Helper-help-map + "m" #'Helper-describe-mode + "b" #'Helper-describe-bindings + "c" #'Helper-describe-key-briefly + "k" #'Helper-describe-key + ;;"f" #'Helper-describe-function + ;;"v" #'Helper-describe-variable + "?" #'Helper-help-options + (key-description (char-to-string help-char)) #'Helper-help-options) +(fset 'Helper-help-map Helper-help-map) (defun Helper-help-scroller () (let ((blurb (or (and (boundp 'Helper-return-blurb) @@ -68,11 +65,13 @@ (setq state (+ (* 2 (if (pos-visible-in-window-p (point-max)) 1 0)) (if (pos-visible-in-window-p (point-min)) 1 0))) (message - (nth state - '("Space forward, Delete back. Other keys %s" - "Space scrolls forward. Other keys %s" - "Delete scrolls back. Other keys %s" - "Type anything to %s")) + (nth state + (mapcar + #'substitute-command-keys + '("\\`SPC' forward, \\`DEL' back. Other keys %s" + "\\`SPC' scrolls forward. Other keys %s" + "\\`DEL' scrolls back. Other keys %s" + "Type anything to %s"))) blurb) (setq continue (read-event)) (cond ((and (memq continue '(?\s ?\C-v)) (< state 2)) @@ -88,8 +87,8 @@ (defun Helper-help-options () "Describe help options." (interactive) - (message "c (key briefly), m (mode), k (key), b (bindings)") - ;(message "c (key briefly), m (mode), k (key), v (variable), f (function)") + (message (substitute-command-keys + "\\`c' (key briefly), \\`m' (mode), \\`k' (key), \\`b' (bindings)")) (sit-for 4)) (defun Helper-describe-key-briefly (key) @@ -142,7 +141,8 @@ (interactive) (let ((continue t) c) (while continue - (message "Help (Type ? for further options)") + (message (substitute-command-keys + "Help (Type \\`?' for further options)")) (setq c (read-key-sequence nil)) (setq c (lookup-key Helper-help-map c)) (cond ((eq c 'Helper-help-options) -- cgit v1.2.3 From cfc754a67c049e9297c19eb5400f8ea38159a0d9 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Mon, 4 Jul 2022 15:54:14 +0200 Subject: ; remove regexp ambiguity --- lisp/emacs-lisp/lisp-mode.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 888e3397199..65f76a4fa35 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -478,10 +478,10 @@ This will generate compile-time constants from BINDINGS." ;; Words inside \\[], \\<>, \\{} or \\`' tend to be for ;; `substitute-command-keys'. (,(rx "\\\\" (or (seq "[" (group-n 1 lisp-mode-symbol) "]") - (seq "`" (group-n 1 (+ lisp-mode-symbol - ;; allow multiple words, e.g. "C-x a" - (? " "))) - "'"))) + (seq "`" (group-n 1 + ;; allow multiple words, e.g. "C-x a" + lisp-mode-symbol (* " " lisp-mode-symbol)) + "'"))) (1 font-lock-constant-face prepend)) (,(rx "\\\\" (or (seq "<" (group-n 1 lisp-mode-symbol) ">") (seq "{" (group-n 1 lisp-mode-symbol) "}"))) -- cgit v1.2.3 From 162c6c12f97db9b4b3042dc8d122027e9fb01e71 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 4 Jul 2022 18:42:26 +0200 Subject: Prefer defvar-keymap in emacs-lisp/*.el * lisp/emacs-lisp/backtrace.el (backtrace-mode-map): * lisp/emacs-lisp/bytecomp.el (emacs-lisp-compilation-mode-map): * lisp/emacs-lisp/checkdoc.el (checkdoc-minor-mode-map): * lisp/emacs-lisp/crm.el (crm-local-completion-map) (crm-local-must-match-map): * lisp/emacs-lisp/debug.el (debugger-mode-map): * lisp/emacs-lisp/edebug.el (edebug-mode-map, edebug-global-map) (edebug-eval-mode-map): * lisp/emacs-lisp/eieio-custom.el (eieio-custom-mode-map): * lisp/emacs-lisp/elp.el (elp-results-symname-map): * lisp/emacs-lisp/lisp-mode.el (lisp-mode-shared-map): * lisp/emacs-lisp/re-builder.el (reb-mode-map) (reb-lisp-mode-map, reb-subexp-mode-map): * lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode-map) (tabulated-list-sort-button-map): * lisp/emacs-lisp/timer-list.el (timer-list-mode-map): --- lisp/emacs-lisp/backtrace.el | 114 ++++++++++---------- lisp/emacs-lisp/bytecomp.el | 6 +- lisp/emacs-lisp/checkdoc.el | 56 +++++----- lisp/emacs-lisp/crm.el | 39 +++---- lisp/emacs-lisp/debug.el | 93 +++++++++-------- lisp/emacs-lisp/edebug.el | 213 ++++++++++++++++++-------------------- lisp/emacs-lisp/eieio-custom.el | 8 +- lisp/emacs-lisp/elp.el | 12 +-- lisp/emacs-lisp/lisp-mode.el | 35 +++---- lisp/emacs-lisp/re-builder.el | 60 +++++------ lisp/emacs-lisp/tabulated-list.el | 49 ++++----- lisp/emacs-lisp/timer-list.el | 12 +-- 12 files changed, 332 insertions(+), 365 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el index 3231877a30c..e305822af1f 100644 --- a/lisp/emacs-lisp/backtrace.el +++ b/lisp/emacs-lisp/backtrace.el @@ -199,63 +199,63 @@ functions returns non-nil. When adding a function to this hook, you should also set the :source-available flag for the backtrace frames where the source code location is known.") -(defvar backtrace-mode-map - (let ((map (copy-keymap special-mode-map))) - (set-keymap-parent map button-buffer-map) - (define-key map "n" 'backtrace-forward-frame) - (define-key map "p" 'backtrace-backward-frame) - (define-key map "v" 'backtrace-toggle-locals) - (define-key map "#" 'backtrace-toggle-print-circle) - (define-key map ":" 'backtrace-toggle-print-gensym) - (define-key map "s" 'backtrace-goto-source) - (define-key map "\C-m" 'backtrace-help-follow-symbol) - (define-key map "+" 'backtrace-multi-line) - (define-key map "-" 'backtrace-single-line) - (define-key map "." 'backtrace-expand-ellipses) - (define-key map [follow-link] 'mouse-face) - (define-key map [mouse-2] 'mouse-select-window) - (easy-menu-define nil map "" - '("Backtrace" - ["Next Frame" backtrace-forward-frame - :help "Move cursor forwards to the start of a backtrace frame"] - ["Previous Frame" backtrace-backward-frame - :help "Move cursor backwards to the start of a backtrace frame"] - "--" - ["Show Variables" backtrace-toggle-locals - :style toggle - :active (backtrace-get-index) - :selected (plist-get (backtrace-get-view) :show-locals) - :help "Show or hide the local variables for the frame at point"] - ["Show Circular Structures" backtrace-toggle-print-circle - :style toggle - :active (backtrace-get-index) - :selected (plist-get (backtrace-get-view) :print-circle) - :help - "Condense or expand shared or circular structures in the frame at point"] - ["Show Uninterned Symbols" backtrace-toggle-print-gensym - :style toggle - :active (backtrace-get-index) - :selected (plist-get (backtrace-get-view) :print-gensym) - :help - "Toggle unique printing of uninterned symbols in the frame at point"] - ["Expand \"...\"s" backtrace-expand-ellipses - :help "Expand all the abbreviated forms in the current frame"] - ["Show on Multiple Lines" backtrace-multi-line - :help "Use line breaks and indentation to make a form more readable"] - ["Show on Single Line" backtrace-single-line] - "--" - ["Go to Source" backtrace-goto-source - :active (and (backtrace-get-index) - (plist-get (backtrace-frame-flags - (nth (backtrace-get-index) backtrace-frames)) - :source-available)) - :help "Show the source code for the current frame"] - ["Help for Symbol" backtrace-help-follow-symbol - :help "Show help for symbol at point"] - ["Describe Backtrace Mode" describe-mode - :help "Display documentation for backtrace-mode"])) - map) - "Local keymap for `backtrace-mode' buffers.") +(defvar-keymap backtrace-mode-map + :doc "Local keymap for `backtrace-mode' buffers." + :parent (make-composed-keymap special-mode-map + button-buffer-map) + "n" #'backtrace-forward-frame + "p" #'backtrace-backward-frame + "v" #'backtrace-toggle-locals + "#" #'backtrace-toggle-print-circle + ":" #'backtrace-toggle-print-gensym + "s" #'backtrace-goto-source + "RET" #'backtrace-help-follow-symbol + "+" #'backtrace-multi-line + "-" #'backtrace-single-line + "." #'backtrace-expand-ellipses + "" 'mouse-face + "" #'mouse-select-window + + :menu + '("Backtrace" + ["Next Frame" backtrace-forward-frame + :help "Move cursor forwards to the start of a backtrace frame"] + ["Previous Frame" backtrace-backward-frame + :help "Move cursor backwards to the start of a backtrace frame"] + "--" + ["Show Variables" backtrace-toggle-locals + :style toggle + :active (backtrace-get-index) + :selected (plist-get (backtrace-get-view) :show-locals) + :help "Show or hide the local variables for the frame at point"] + ["Show Circular Structures" backtrace-toggle-print-circle + :style toggle + :active (backtrace-get-index) + :selected (plist-get (backtrace-get-view) :print-circle) + :help + "Condense or expand shared or circular structures in the frame at point"] + ["Show Uninterned Symbols" backtrace-toggle-print-gensym + :style toggle + :active (backtrace-get-index) + :selected (plist-get (backtrace-get-view) :print-gensym) + :help + "Toggle unique printing of uninterned symbols in the frame at point"] + ["Expand \"...\"s" backtrace-expand-ellipses + :help "Expand all the abbreviated forms in the current frame"] + ["Show on Multiple Lines" backtrace-multi-line + :help "Use line breaks and indentation to make a form more readable"] + ["Show on Single Line" backtrace-single-line] + "--" + ["Go to Source" backtrace-goto-source + :active (and (backtrace-get-index) + (plist-get (backtrace-frame-flags + (nth (backtrace-get-index) backtrace-frames)) + :source-available)) + :help "Show the source code for the current frame"] + ["Help for Symbol" backtrace-help-follow-symbol + :help "Show help for symbol at point"] + ["Describe Backtrace Mode" describe-mode + :help "Display documentation for backtrace-mode"])) (defconst backtrace--flags-width 2 "Width in characters of the flags for a backtrace frame.") diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index bd3db85c148..6545c8d961d 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1123,10 +1123,8 @@ message buffer `default-directory'." :type '(repeat (choice (const :tag "Default" nil) (string :tag "Directory")))) -(defvar emacs-lisp-compilation-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "g" 'emacs-lisp-compilation-recompile) - map)) +(defvar-keymap emacs-lisp-compilation-mode-map + "g" #'emacs-lisp-compilation-recompile) (defvar emacs-lisp-compilation--current-file nil) diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 2c9adfe2d27..611f32e23c6 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1279,38 +1279,30 @@ TEXT, START, END and UNFIXABLE conform to ;;; Minor Mode specification ;; -(defvar checkdoc-minor-mode-map - (let ((map (make-sparse-keymap)) - (pmap (make-sparse-keymap))) - ;; Override some bindings - (define-key map "\C-\M-x" #'checkdoc-eval-defun) - (define-key map "\C-x`" #'checkdoc-continue) - (define-key map [menu-bar emacs-lisp eval-buffer] - #'checkdoc-eval-current-buffer) - ;; Add some new bindings under C-c ? - (define-key pmap "x" #'checkdoc-defun) - (define-key pmap "X" #'checkdoc-ispell-defun) - (define-key pmap "`" #'checkdoc-continue) - (define-key pmap "~" #'checkdoc-ispell-continue) - (define-key pmap "s" #'checkdoc-start) - (define-key pmap "S" #'checkdoc-ispell-start) - (define-key pmap "d" #'checkdoc) - (define-key pmap "D" #'checkdoc-ispell) - (define-key pmap "b" #'checkdoc-current-buffer) - (define-key pmap "B" #'checkdoc-ispell-current-buffer) - (define-key pmap "e" #'checkdoc-eval-current-buffer) - (define-key pmap "m" #'checkdoc-message-text) - (define-key pmap "M" #'checkdoc-ispell-message-text) - (define-key pmap "c" #'checkdoc-comments) - (define-key pmap "C" #'checkdoc-ispell-comments) - (define-key pmap " " #'checkdoc-rogue-spaces) - - ;; bind our submap into map - (define-key map "\C-c?" pmap) - map) - "Keymap used to override evaluation key-bindings for documentation checking.") - -;; Add in a menubar with easy-menu +(defvar-keymap checkdoc-minor-mode-map + :doc "Keymap used to override evaluation key-bindings for documentation checking." + ;; Override some bindings + "C-M-x" #'checkdoc-eval-defun + "C-x `" #'checkdoc-continue + " " #'checkdoc-eval-current-buffer + + ;; Add some new bindings under C-c ? + "C-c ? x" #'checkdoc-defun + "C-c ? X" #'checkdoc-ispell-defun + "C-c ? `" #'checkdoc-continue + "C-c ? ~" #'checkdoc-ispell-continue + "C-c ? s" #'checkdoc-start + "C-c ? S" #'checkdoc-ispell-start + "C-c ? d" #'checkdoc + "C-c ? D" #'checkdoc-ispell + "C-c ? b" #'checkdoc-current-buffer + "C-c ? B" #'checkdoc-ispell-current-buffer + "C-c ? e" #'checkdoc-eval-current-buffer + "C-c ? m" #'checkdoc-message-text + "C-c ? M" #'checkdoc-ispell-message-text + "C-c ? c" #'checkdoc-comments + "C-c ? C" #'checkdoc-ispell-comments + "C-c ? SPC" #'checkdoc-rogue-spaces) (easy-menu-define nil checkdoc-minor-mode-map "Checkdoc Minor Mode Menu." diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el index 8a5c3d3730c..9d9c91e510e 100644 --- a/lisp/emacs-lisp/crm.el +++ b/lisp/emacs-lisp/crm.el @@ -87,28 +87,23 @@ It should be a regexp that does not match the list of completion candidates. The default value is `crm-default-separator'.") -(defvar crm-local-completion-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map minibuffer-local-completion-map) - (define-key map [remap minibuffer-complete] #'crm-complete) - (define-key map [remap minibuffer-complete-word] #'crm-complete-word) - (define-key map [remap minibuffer-completion-help] #'crm-completion-help) - map) - "Local keymap for minibuffer multiple input with completion. -Analog of `minibuffer-local-completion-map'.") - -(defvar crm-local-must-match-map - (let ((map (make-sparse-keymap))) - ;; We'd want to have multiple inheritance here. - (set-keymap-parent map minibuffer-local-must-match-map) - (define-key map [remap minibuffer-complete] #'crm-complete) - (define-key map [remap minibuffer-complete-word] #'crm-complete-word) - (define-key map [remap minibuffer-completion-help] #'crm-completion-help) - (define-key map [remap minibuffer-complete-and-exit] - #'crm-complete-and-exit) - map) - "Local keymap for minibuffer multiple input with exact match completion. -Analog of `minibuffer-local-must-match-map' for crm.") +(defvar-keymap crm-local-completion-map + :doc "Local keymap for minibuffer multiple input with completion. +Analog of `minibuffer-local-completion-map'." + :parent minibuffer-local-completion-map + " " #'crm-complete + " " #'crm-complete-word + " " #'crm-completion-help) + +(defvar-keymap crm-local-must-match-map + :doc "Local keymap for minibuffer multiple input with exact match completion. +Analog of `minibuffer-local-must-match-map' for crm." + ;; We'd want to have multiple inheritance here. + :parent minibuffer-local-must-match-map + " " #'crm-complete + " " #'crm-complete-word + " " #'crm-completion-help + " " #'crm-complete-and-exit) (defvar crm-completion-table nil "An alist whose elements' cars are strings, or an obarray. diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index c4929eb2b01..460057b3afd 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -560,52 +560,53 @@ The environment used is the one when entering the activation frame at point." 'backtrace-toggle-locals "28.1") -(defvar debugger-mode-map - (let ((map (make-keymap))) - (set-keymap-parent map backtrace-mode-map) - (define-key map "b" 'debugger-frame) - (define-key map "c" 'debugger-continue) - (define-key map "j" 'debugger-jump) - (define-key map "r" 'debugger-return-value) - (define-key map "u" 'debugger-frame-clear) - (define-key map "d" 'debugger-step-through) - (define-key map "l" 'debugger-list-functions) - (define-key map "q" 'debugger-quit) - (define-key map "e" 'debugger-eval-expression) - (define-key map "R" 'debugger-record-expression) - (define-key map [mouse-2] 'push-button) - (easy-menu-define nil map "" - '("Debugger" - ["Step through" debugger-step-through - :help "Proceed, stepping through subexpressions of this expression"] - ["Continue" debugger-continue - :help "Continue, evaluating this expression without stopping"] - ["Jump" debugger-jump - :help "Continue to exit from this frame, with all debug-on-entry suspended"] - ["Eval Expression..." debugger-eval-expression - :help "Eval an expression, in an environment like that outside the debugger"] - ["Display and Record Expression" debugger-record-expression - :help "Display a variable's value and record it in `*Backtrace-record*' buffer"] - ["Return value..." debugger-return-value - :help "Continue, specifying value to return."] - "--" - ["Debug frame" debugger-frame - :help "Request entry to debugger when this frame exits"] - ["Cancel debug frame" debugger-frame-clear - :help "Do not enter debugger when this frame exits"] - ["List debug on entry functions" debugger-list-functions - :help "Display a list of all the functions now set to debug on entry"] - "--" - ["Next Line" next-line - :help "Move cursor down"] - ["Help for Symbol" backtrace-help-follow-symbol - :help "Show help for symbol at point"] - ["Describe Debugger Mode" describe-mode - :help "Display documentation for debugger-mode"] - "--" - ["Quit" debugger-quit - :help "Quit debugging and return to top level"])) - map)) +(defvar-keymap debugger-mode-map + :full t + :parent backtrace-mode-map + "b" #'debugger-frame + "c" #'debugger-continue + "j" #'debugger-jump + "r" #'debugger-return-value + "u" #'debugger-frame-clear + "d" #'debugger-step-through + "l" #'debugger-list-functions + "q" #'debugger-quit + "e" #'debugger-eval-expression + "R" #'debugger-record-expression + + "" #'push-button + + :menu + '("Debugger" + ["Step through" debugger-step-through + :help "Proceed, stepping through subexpressions of this expression"] + ["Continue" debugger-continue + :help "Continue, evaluating this expression without stopping"] + ["Jump" debugger-jump + :help "Continue to exit from this frame, with all debug-on-entry suspended"] + ["Eval Expression..." debugger-eval-expression + :help "Eval an expression, in an environment like that outside the debugger"] + ["Display and Record Expression" debugger-record-expression + :help "Display a variable's value and record it in `*Backtrace-record*' buffer"] + ["Return value..." debugger-return-value + :help "Continue, specifying value to return."] + "--" + ["Debug frame" debugger-frame + :help "Request entry to debugger when this frame exits"] + ["Cancel debug frame" debugger-frame-clear + :help "Do not enter debugger when this frame exits"] + ["List debug on entry functions" debugger-list-functions + :help "Display a list of all the functions now set to debug on entry"] + "--" + ["Next Line" next-line + :help "Move cursor down"] + ["Help for Symbol" backtrace-help-follow-symbol + :help "Show help for symbol at point"] + ["Describe Debugger Mode" describe-mode + :help "Display documentation for debugger-mode"] + "--" + ["Quit" debugger-quit + :help "Quit debugging and return to top level"])) (put 'debugger-mode 'mode-class 'special) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index b05ec3a7683..1a1d58d6e36 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -3809,74 +3809,72 @@ be installed in `emacs-lisp-mode-map'.") ;; The following isn't a GUD binding. (define-key emacs-lisp-mode-map "\C-x\C-a\C-m" 'edebug-set-initial-mode)) -(defvar edebug-mode-map - (let ((map (copy-keymap emacs-lisp-mode-map))) - ;; control - (define-key map " " 'edebug-step-mode) - (define-key map "n" 'edebug-next-mode) - (define-key map "g" 'edebug-go-mode) - (define-key map "G" 'edebug-Go-nonstop-mode) - (define-key map "t" 'edebug-trace-mode) - (define-key map "T" 'edebug-Trace-fast-mode) - (define-key map "c" 'edebug-continue-mode) - (define-key map "C" 'edebug-Continue-fast-mode) - - ;;(define-key map "f" 'edebug-forward) not implemented - (define-key map "f" 'edebug-forward-sexp) - (define-key map "h" 'edebug-goto-here) - - (define-key map "I" 'edebug-instrument-callee) - (define-key map "i" 'edebug-step-in) - (define-key map "o" 'edebug-step-out) - - ;; quitting and stopping - (define-key map "q" 'top-level) - (define-key map "Q" 'edebug-top-level-nonstop) - (define-key map "a" 'abort-recursive-edit) - (define-key map "S" 'edebug-stop) - - ;; breakpoints - (define-key map "b" 'edebug-set-breakpoint) - (define-key map "u" 'edebug-unset-breakpoint) - (define-key map "U" 'edebug-unset-breakpoints) - (define-key map "B" 'edebug-next-breakpoint) - (define-key map "x" 'edebug-set-conditional-breakpoint) - (define-key map "X" 'edebug-set-global-break-condition) - (define-key map "D" 'edebug-toggle-disable-breakpoint) - - ;; evaluation - (define-key map "r" 'edebug-previous-result) - (define-key map "e" 'edebug-eval-expression) - (define-key map "\C-x\C-e" 'edebug-eval-last-sexp) - (define-key map "E" 'edebug-visit-eval-list) - - ;; views - (define-key map "w" 'edebug-where) - (define-key map "v" 'edebug-view-outside) ;; maybe obsolete?? - (define-key map "p" 'edebug-bounce-point) - (define-key map "P" 'edebug-view-outside) ;; same as v - (define-key map "W" 'edebug-toggle-save-windows) - - ;; misc - (define-key map "?" 'edebug-help) - (define-key map "d" 'edebug-pop-to-backtrace) - - (define-key map "-" 'negative-argument) - - ;; statistics - (define-key map "=" 'edebug-temp-display-freq-count) - - ;; GUD bindings - (define-key map "\C-c\C-s" 'edebug-step-mode) - (define-key map "\C-c\C-n" 'edebug-next-mode) - (define-key map "\C-c\C-c" 'edebug-go-mode) - - (define-key map "\C-x " 'edebug-set-breakpoint) - (define-key map "\C-c\C-d" 'edebug-unset-breakpoint) - (define-key map "\C-c\C-t" - (lambda () (interactive) (edebug-set-breakpoint t))) - (define-key map "\C-c\C-l" 'edebug-where) - map)) +(defvar-keymap edebug-mode-map + :parent emacs-lisp-mode-map + ;; control + "SPC" #'edebug-step-mode + "n" #'edebug-next-mode + "g" #'edebug-go-mode + "G" #'edebug-Go-nonstop-mode + "t" #'edebug-trace-mode + "T" #'edebug-Trace-fast-mode + "c" #'edebug-continue-mode + "C" #'edebug-Continue-fast-mode + + ;;"f" #'edebug-forward ; not implemented + "f" #'edebug-forward-sexp + "h" #'edebug-goto-here + + "I" #'edebug-instrument-callee + "i" #'edebug-step-in + "o" #'edebug-step-out + + ;; quitting and stopping + "q" #'top-level + "Q" #'edebug-top-level-nonstop + "a" #'abort-recursive-edit + "S" #'edebug-stop + + ;; breakpoints + "b" #'edebug-set-breakpoint + "u" #'edebug-unset-breakpoint + "U" #'edebug-unset-breakpoints + "B" #'edebug-next-breakpoint + "x" #'edebug-set-conditional-breakpoint + "X" #'edebug-set-global-break-condition + "D" #'edebug-toggle-disable-breakpoint + + ;; evaluation + "r" #'edebug-previous-result + "e" #'edebug-eval-expression + "C-x C-e" #'edebug-eval-last-sexp + "E" #'edebug-visit-eval-list + + ;; views + "w" #'edebug-where + "v" #'edebug-view-outside ; maybe obsolete?? + "p" #'edebug-bounce-point + "P" #'edebug-view-outside ; same as v + "W" #'edebug-toggle-save-windows + + ;; misc + "?" #'edebug-help + "d" #'edebug-pop-to-backtrace + + "-" #'negative-argument + + ;; statistics + "=" #'edebug-temp-display-freq-count + + ;; GUD bindings + "C-c C-s" #'edebug-step-mode + "C-c C-n" #'edebug-next-mode + "C-c C-c" #'edebug-go-mode + + "C-x SPC" #'edebug-set-breakpoint + "C-c C-d" #'edebug-unset-breakpoint + "C-c C-t" (lambda () (interactive) (edebug-set-breakpoint t)) + "C-c C-l" #'edebug-where) ;; Autoloading these global bindings doesn't make sense because ;; they cannot be used anyway unless Edebug is already loaded and active. @@ -3891,38 +3889,35 @@ be installed in `emacs-lisp-mode-map'.") (define-obsolete-variable-alias 'global-edebug-map 'edebug-global-map "28.1") -(defvar edebug-global-map - (let ((map (make-sparse-keymap))) - - (define-key map " " 'edebug-step-mode) - (define-key map "g" 'edebug-go-mode) - (define-key map "G" 'edebug-Go-nonstop-mode) - (define-key map "t" 'edebug-trace-mode) - (define-key map "T" 'edebug-Trace-fast-mode) - (define-key map "c" 'edebug-continue-mode) - (define-key map "C" 'edebug-Continue-fast-mode) - - ;; breakpoints - (define-key map "b" 'edebug-set-breakpoint) - (define-key map "u" 'edebug-unset-breakpoint) - (define-key map "U" 'edebug-unset-breakpoints) - (define-key map "x" 'edebug-set-conditional-breakpoint) - (define-key map "X" 'edebug-set-global-break-condition) - (define-key map "D" 'edebug-toggle-disable-breakpoint) - - ;; views - (define-key map "w" 'edebug-where) - (define-key map "W" 'edebug-toggle-save-windows) - - ;; quitting - (define-key map "q" 'top-level) - (define-key map "Q" 'edebug-top-level-nonstop) - (define-key map "a" 'abort-recursive-edit) - - ;; statistics - (define-key map "=" 'edebug-display-freq-count) - map) - "Global map of edebug commands, available from any buffer.") +(defvar-keymap edebug-global-map + :doc "Global map of edebug commands, available from any buffer." + "SPC" #'edebug-step-mode + "g" #'edebug-go-mode + "G" #'edebug-Go-nonstop-mode + "t" #'edebug-trace-mode + "T" #'edebug-Trace-fast-mode + "c" #'edebug-continue-mode + "C" #'edebug-Continue-fast-mode + + ;; breakpoints + "b" #'edebug-set-breakpoint + "u" #'edebug-unset-breakpoint + "U" #'edebug-unset-breakpoints + "x" #'edebug-set-conditional-breakpoint + "X" #'edebug-set-global-break-condition + "D" #'edebug-toggle-disable-breakpoint + + ;; views + "w" #'edebug-where + "W" #'edebug-toggle-save-windows + + ;; quitting + "q" #'top-level + "Q" #'edebug-top-level-nonstop + "a" #'abort-recursive-edit + + ;; statistics + "=" #'edebug-display-freq-count) (when edebug-global-prefix (global-unset-key edebug-global-prefix) @@ -4093,16 +4088,14 @@ May only be called from within `edebug--recursive-edit'." -(defvar edebug-eval-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map lisp-interaction-mode-map) - (define-key map "\C-c\C-w" 'edebug-where) - (define-key map "\C-c\C-d" 'edebug-delete-eval-item) - (define-key map "\C-c\C-u" 'edebug-update-eval-list) - (define-key map "\C-x\C-e" 'edebug-eval-last-sexp) - (define-key map "\C-j" 'edebug-eval-print-last-sexp) - map) - "Keymap for Edebug Eval mode. Superset of Lisp Interaction mode.") +(defvar-keymap edebug-eval-mode-map + :doc "Keymap for Edebug Eval mode. Superset of Lisp Interaction mode." + :parent lisp-interaction-mode-map + "C-c C-w" #'edebug-where + "C-c C-d" #'edebug-delete-eval-item + "C-c C-u" #'edebug-update-eval-list + "C-x C-e" #'edebug-eval-last-sexp + "C-j" #'edebug-eval-print-last-sexp) (put 'edebug-eval-mode 'mode-class 'special) diff --git a/lisp/emacs-lisp/eieio-custom.el b/lisp/emacs-lisp/eieio-custom.el index ebb6f2cd8c8..4b8b4275f1a 100644 --- a/lisp/emacs-lisp/eieio-custom.el +++ b/lisp/emacs-lisp/eieio-custom.el @@ -329,11 +329,9 @@ Argument OBJ is the object that has been customized." Optional argument GROUP is the sub-group of slots to display." (eieio-customize-object obj group)) -(defvar eieio-custom-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map widget-keymap) - map) - "Keymap for EIEIO Custom mode.") +(defvar-keymap eieio-custom-mode-map + :doc "Keymap for EIEIO Custom mode." + :parent widget-keymap) (define-derived-mode eieio-custom-mode fundamental-mode "EIEIO Custom" "Major mode for customizing EIEIO objects. diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el index 385ddb3f414..03c5b94e3b4 100644 --- a/lisp/emacs-lisp/elp.el +++ b/lisp/emacs-lisp/elp.el @@ -472,13 +472,11 @@ original definition, use \\[elp-restore-function] or \\[elp-restore-all]." (insert atstr)) (insert "\n")))) -(defvar elp-results-symname-map - (let ((map (make-sparse-keymap))) - (define-key map [mouse-2] 'elp-results-jump-to-definition) - (define-key map [follow-link] 'mouse-face) - (define-key map "\C-m" 'elp-results-jump-to-definition) - map) - "Keymap used on the function name column." ) +(defvar-keymap elp-results-symname-map + :doc "Keymap used on the function name column." + "" #'elp-results-jump-to-definition + "" 'mouse-face + "RET" #'elp-results-jump-to-definition) (defun elp-results-jump-to-definition (&optional event) "Jump to the definition of the function at point." diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 65f76a4fa35..c559dd427cb 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -753,17 +753,16 @@ font-lock keywords will not be case sensitive." (progn (forward-sexp 1) (point))))))) -(defvar lisp-mode-shared-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map prog-mode-map) - (define-key map "\e\C-q" 'indent-sexp) - (define-key map "\177" 'backward-delete-char-untabify) - ;; This gets in the way when viewing a Lisp file in view-mode. As - ;; long as [backspace] is mapped into DEL via the - ;; function-key-map, this should remain disabled!! - ;;;(define-key map [backspace] 'backward-delete-char-untabify) - map) - "Keymap for commands shared by all sorts of Lisp modes.") +(defvar-keymap lisp-mode-shared-map + :doc "Keymap for commands shared by all sorts of Lisp modes." + :parent prog-mode-map + "C-M-q" #'indent-sexp + "DEL" #'backward-delete-char-untabify + ;; This gets in the way when viewing a Lisp file in view-mode. As + ;; long as [backspace] is mapped into DEL via the + ;; function-key-map, this should remain disabled!! + ;;;"" #'backward-delete-char-untabify + ) (defcustom lisp-mode-hook nil "Hook run when entering Lisp mode." @@ -779,14 +778,12 @@ font-lock keywords will not be case sensitive." ;;; Generic Lisp mode. -(defvar lisp-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map lisp-mode-shared-map) - (define-key map "\e\C-x" 'lisp-eval-defun) - (define-key map "\C-c\C-z" 'run-lisp) - map) - "Keymap for ordinary Lisp mode. -All commands in `lisp-mode-shared-map' are inherited by this map.") +(defvar-keymap lisp-mode-map + :doc "Keymap for ordinary Lisp mode. +All commands in `lisp-mode-shared-map' are inherited by this map." + :parent lisp-mode-shared-map + "C-M-x" #'lisp-eval-defun + "C-c C-z" #'run-lisp) (easy-menu-define lisp-mode-menu lisp-mode-map "Menu for ordinary Lisp mode." diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el index 24770fac67f..46b429ce6fe 100644 --- a/lisp/emacs-lisp/re-builder.el +++ b/lisp/emacs-lisp/re-builder.el @@ -216,19 +216,17 @@ Except for Lisp syntax this is the same as `reb-regexp'.") "Buffer to use for the RE Builder.") ;; Define the local "\C-c" keymap -(defvar reb-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "\C-c\C-c" 'reb-toggle-case) - (define-key map "\C-c\C-q" 'reb-quit) - (define-key map "\C-c\C-w" 'reb-copy) - (define-key map "\C-c\C-s" 'reb-next-match) - (define-key map "\C-c\C-r" 'reb-prev-match) - (define-key map "\C-c\C-i" 'reb-change-syntax) - (define-key map "\C-c\C-e" 'reb-enter-subexp-mode) - (define-key map "\C-c\C-b" 'reb-change-target-buffer) - (define-key map "\C-c\C-u" 'reb-force-update) - map) - "Keymap used by the RE Builder.") +(defvar-keymap reb-mode-map + :doc "Keymap used by the RE Builder." + "C-c C-c" #'reb-toggle-case + "C-c C-q" #'reb-quit + "C-c C-w" #'reb-copy + "C-c C-s" #'reb-next-match + "C-c C-r" #'reb-prev-match + "C-c C-i" #'reb-change-syntax + "C-c C-e" #'reb-enter-subexp-mode + "C-c C-b" #'reb-change-target-buffer + "C-c C-u" #'reb-force-update) (easy-menu-define reb-mode-menu reb-mode-map "Menu for the RE Builder." @@ -263,12 +261,10 @@ Except for Lisp syntax this is the same as `reb-regexp'.") (setq-local blink-matching-paren nil) (reb-mode-common)) -(defvar reb-lisp-mode-map - (let ((map (make-sparse-keymap))) - ;; Use the same "\C-c" keymap as `reb-mode' and use font-locking from - ;; `emacs-lisp-mode' - (define-key map "\C-c" (lookup-key reb-mode-map "\C-c")) - map)) +(defvar-keymap reb-lisp-mode-map + ;; Use the same "\C-c" keymap as `reb-mode' and use font-locking from + ;; `emacs-lisp-mode' + "C-c" (keymap-lookup reb-mode-map "C-c")) (define-derived-mode reb-lisp-mode emacs-lisp-mode "RE Builder Lisp" @@ -278,16 +274,22 @@ Except for Lisp syntax this is the same as `reb-regexp'.") (require 'rx)) ; require rx anyway (reb-mode-common)) -(defvar reb-subexp-mode-map - (let ((m (make-keymap))) - (suppress-keymap m) - ;; Again share the "\C-c" keymap for the commands - (define-key m "\C-c" (lookup-key reb-mode-map "\C-c")) - (define-key m "q" 'reb-quit-subexp-mode) - (dotimes (digit 10) - (define-key m (int-to-string digit) 'reb-display-subexp)) - m) - "Keymap used by the RE Builder for the subexpression mode.") +(defvar-keymap reb-subexp-mode-map + :doc "Keymap used by the RE Builder for the subexpression mode." + :full t :suppress t + ;; Again share the "\C-c" keymap for the commands + "C-c" (keymap-lookup reb-mode-map "C-c") + "q" #'reb-quit-subexp-mode + "0" #'reb-display-subexp + "1" #'reb-display-subexp + "2" #'reb-display-subexp + "3" #'reb-display-subexp + "4" #'reb-display-subexp + "5" #'reb-display-subexp + "6" #'reb-display-subexp + "7" #'reb-display-subexp + "8" #'reb-display-subexp + "9" #'reb-display-subexp) (defun reb-mode-common () "Setup functions common to functions `reb-mode' and `reb-lisp-mode'." diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el index 7d815a3cedc..9868d8c4ec0 100644 --- a/lisp/emacs-lisp/tabulated-list.el +++ b/lisp/emacs-lisp/tabulated-list.el @@ -216,33 +216,28 @@ If ADVANCE is non-nil, move forward by one line afterwards." (while (re-search-forward re nil 'noerror) (tabulated-list-put-tag empty))))) -(defvar tabulated-list-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map (make-composed-keymap - button-buffer-map - special-mode-map)) - (define-key map "n" 'next-line) - (define-key map "p" 'previous-line) - (define-key map (kbd "M-") 'tabulated-list-previous-column) - (define-key map (kbd "M-") 'tabulated-list-next-column) - (define-key map "S" 'tabulated-list-sort) - (define-key map "}" 'tabulated-list-widen-current-column) - (define-key map "{" 'tabulated-list-narrow-current-column) - (define-key map [follow-link] 'mouse-face) - (define-key map [mouse-2] 'mouse-select-window) - map) - "Local keymap for `tabulated-list-mode' buffers.") - -(defvar tabulated-list-sort-button-map - (let ((map (make-sparse-keymap))) - (define-key map [header-line mouse-1] 'tabulated-list-col-sort) - (define-key map [header-line mouse-2] 'tabulated-list-col-sort) - (define-key map [mouse-1] 'tabulated-list-col-sort) - (define-key map [mouse-2] 'tabulated-list-col-sort) - (define-key map "\C-m" 'tabulated-list-sort) - (define-key map [follow-link] 'mouse-face) - map) - "Local keymap for `tabulated-list-mode' sort buttons.") +(defvar-keymap tabulated-list-mode-map + :doc "Local keymap for `tabulated-list-mode' buffers." + :parent (make-composed-keymap button-buffer-map + special-mode-map) + "n" #'next-line + "p" #'previous-line + "M-" #'tabulated-list-previous-column + "M-" #'tabulated-list-next-column + "S" #'tabulated-list-sort + "}" #'tabulated-list-widen-current-column + "{" #'tabulated-list-narrow-current-column + "" 'mouse-face + "" #'mouse-select-window) + +(defvar-keymap tabulated-list-sort-button-map + :doc "Local keymap for `tabulated-list-mode' sort buttons." + " " #'tabulated-list-col-sort + " " #'tabulated-list-col-sort + "" #'tabulated-list-col-sort + "" #'tabulated-list-col-sort + "RET" #'tabulated-list-sort + "" 'mouse-face) (defun tabulated-list-make-glyphless-char-display-table () "Make the `glyphless-char-display' table used for text-mode frames. diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el index aef18d0ba27..8c56108dcbc 100644 --- a/lisp/emacs-lisp/timer-list.el +++ b/lisp/emacs-lisp/timer-list.el @@ -81,13 +81,11 @@ ;; doing. Kids, don't try this at home! ;;;###autoload (put 'list-timers 'disabled "Beware: manually canceling timers can ruin your Emacs session.") -(defvar timer-list-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "c" 'timer-list-cancel) - (easy-menu-define nil map "" - '("Timers" - ["Cancel" timer-list-cancel t])) - map)) +(defvar-keymap timer-list-mode-map + "c" #'timer-list-cancel + :menu + '("Timers" + ["Cancel" timer-list-cancel t])) (define-derived-mode timer-list-mode tabulated-list-mode "Timer-List" "Mode for listing and controlling timers." -- cgit v1.2.3 From 7540f98c5ac57247066f017889b6cffe1dd690fc Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 4 Jul 2022 18:44:24 +0200 Subject: Add quit-window entry to list-timers menu * lisp/emacs-lisp/timer-list.el (timer-list-mode-map): Add quit-window entry to menu. --- lisp/emacs-lisp/timer-list.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el index 8c56108dcbc..d48698234fc 100644 --- a/lisp/emacs-lisp/timer-list.el +++ b/lisp/emacs-lisp/timer-list.el @@ -85,7 +85,8 @@ "c" #'timer-list-cancel :menu '("Timers" - ["Cancel" timer-list-cancel t])) + ["Cancel" timer-list-cancel t] + ["Quit" quit-window])) (define-derived-mode timer-list-mode tabulated-list-mode "Timer-List" "Mode for listing and controlling timers." -- cgit v1.2.3 From 8681bf1e851dd4abda066ddab5199768f310db8a Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 5 Jul 2022 13:07:56 +0200 Subject: Mention byte order marks in string-limit doc string * lisp/emacs-lisp/subr-x.el (string-limit): Mention byte order marks (bug#48324). --- lisp/emacs-lisp/subr-x.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 56e8c2aa862..39697a8e725 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -169,7 +169,12 @@ limiting, and LENGTH is interpreted as the number of bytes to limit the string to. The result will be a unibyte string that is shorter than LENGTH, but will not contain \"partial\" characters (or glyphs), even if CODING-SYSTEM encodes characters -with several bytes per character. +with several bytes per character. If the coding system specifies +things like byte order marks (aka \"BOM\") or language tags, they +will normally be part of the calculation. This is the case, for +instance, with `utf-16'. If this isn't desired, use a coding +system that doesn't specify a BOM, like `utf-16le' or +`utf-16be'. When shortening strings for display purposes, `truncate-string-to-width' is almost always a better alternative -- cgit v1.2.3 From 9d866a1f8da870dcf82f87d5ed9d5ca932d5477b Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 5 Jul 2022 16:26:45 +0200 Subject: Make some defcustom types more restrictive * lisp/abbrev.el (abbrev-suggest-hint-threshold): * lisp/bookmark.el (bookmark-bmenu-file-column) (bookmark-menu-length): * lisp/buff-menu.el (Buffer-menu-size-width) (Buffer-menu-mode-width): * lisp/calendar/calendar.el (calendar-week-start-day) (calendar-intermonth-spacing, calendar-column-width) (calendar-day-digit-width): * lisp/calc/calc.el (calc-undo-length): * lisp/calendar/timeclock.el (timeclock-workday): * lisp/comint.el (comint-buffer-maximum-size) (comint-input-ring-size): * lisp/doc-view.el (doc-view-resolution, doc-view-image-width): * lisp/emacs-lisp/bytecomp.el (byte-compile-docstring-max-column): * lisp/emacs-lisp/comp.el (native-comp-debug) (native-comp-verbose, native-comp-async-jobs-number): * lisp/emacs-lisp/package.el (package-name-column-width) (package-version-column-width, package-status-column-width) (package-archive-column-width): * lisp/eshell/esh-mode.el (eshell-buffer-maximum-lines): * lisp/frame.el (blink-cursor-blinks): * lisp/info.el (Info-breadcrumbs-depth): * lisp/jit-lock.el (jit-lock-chunk-size): * lisp/kmacro.el (kmacro-ring-max): * lisp/menu-bar.el (yank-menu-length, yank-menu-max-items): * lisp/midnight.el (clean-buffer-list-delay-general) (clean-buffer-list-delay-special): * lisp/net/dictionary.el (dictionary-port) (dictionary-proxy-port): * lisp/net/ldap.el (ldap-default-port): * lisp/net/pop3.el (pop3-port, pop3-stream-length): * lisp/net/rcirc.el (rcirc-default-port): * lisp/net/sieve-manage.el (sieve-manage-default-port): * lisp/play/spook.el (spook-phrase-default-count): * lisp/play/tetris.el (tetris-buffer-width) (tetris-buffer-height, tetris-width, tetris-height) (tetris-top-left-x, tetris-top-left-y): * lisp/profiler.el (profiler-sampling-interval): * lisp/progmodes/sql.el (sql-port): * lisp/recentf.el (recentf-max-menu-items): * lisp/strokes.el (strokes-grid-resolution): * lisp/tab-bar.el (tab-bar-tab-name-truncated-max): * lisp/term/xterm.el (xterm-max-cut-length): * lisp/time.el (display-time-interval, world-clock-timer-second): * lisp/url/url-cache.el (url-cache-expire-time): * lisp/url/url-cookie.el (url-cookie-save-interval): * lisp/url/url-history.el (url-history-save-interval): * lisp/url/url-queue.el (url-queue-parallel-processes) (url-queue-timeout): * lisp/url/url-vars.el (url-max-password-attempts) (url-max-redirections): * lisp/vc/emerge.el (emerge-min-visible-lines): * lisp/vc/vc.el (vc-log-show-limit): * lisp/window.el (window-min-height, window-min-width): * lisp/winner.el (winner-ring-size): Use :type natnum. * lisp/savehist.el (savehist-file-modes): Fix setting to nil value and use :type natnum. --- lisp/abbrev.el | 4 ++-- lisp/bookmark.el | 4 ++-- lisp/buff-menu.el | 4 ++-- lisp/calc/calc.el | 2 +- lisp/calendar/calendar.el | 8 ++++---- lisp/calendar/timeclock.el | 2 +- lisp/comint.el | 4 ++-- lisp/doc-view.el | 4 ++-- lisp/emacs-lisp/bytecomp.el | 4 ++-- lisp/emacs-lisp/comp.el | 6 +++--- lisp/emacs-lisp/package.el | 8 ++++---- lisp/eshell/esh-mode.el | 2 +- lisp/frame.el | 2 +- lisp/info.el | 2 +- lisp/jit-lock.el | 2 +- lisp/kmacro.el | 2 +- lisp/menu-bar.el | 4 ++-- lisp/midnight.el | 4 ++-- lisp/net/dictionary.el | 4 ++-- lisp/net/ldap.el | 2 +- lisp/net/pop3.el | 4 ++-- lisp/net/rcirc.el | 2 +- lisp/net/sieve-manage.el | 2 +- lisp/play/spook.el | 2 +- lisp/play/tetris.el | 12 ++++++------ lisp/profiler.el | 2 +- lisp/progmodes/sql.el | 4 ++-- lisp/recentf.el | 2 +- lisp/savehist.el | 3 ++- lisp/strokes.el | 2 +- lisp/tab-bar.el | 2 +- lisp/term/xterm.el | 2 +- lisp/time.el | 4 ++-- lisp/url/url-cache.el | 2 +- lisp/url/url-cookie.el | 2 +- lisp/url/url-history.el | 2 +- lisp/url/url-queue.el | 4 ++-- lisp/url/url-vars.el | 4 ++-- lisp/vc/emerge.el | 2 +- lisp/vc/vc.el | 2 +- lisp/window.el | 4 ++-- lisp/winner.el | 2 +- 42 files changed, 71 insertions(+), 70 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/abbrev.el b/lisp/abbrev.el index e875d77faae..21aa3311d6f 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -885,8 +885,8 @@ longer than the abbrev, the benefit of informing the user is not significant. If you always want to be informed about existing abbrevs for the text you type, set this value to zero or less. This setting only applies if `abbrev-suggest' is non-nil." - :type 'number - :version "28.1") + :type 'natnum + :version "28.1") (defun abbrev--suggest-get-active-tables-including-parents () "Return a list of all active abbrev tables, including parent tables." diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 7138822447c..b2130557dcc 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -160,7 +160,7 @@ This includes the annotations column.") (defcustom bookmark-bmenu-file-column 30 "Column at which to display filenames in a buffer listing bookmarks. You can toggle whether files are shown with \\\\[bookmark-bmenu-toggle-filenames]." - :type 'integer) + :type 'natnum) (defcustom bookmark-bmenu-toggle-filenames t @@ -174,7 +174,7 @@ A non-nil value may result in truncated bookmark names." (defcustom bookmark-menu-length 70 "Maximum length of a bookmark name displayed on a popup menu." - :type 'integer) + :type 'natnum) ;; FIXME: Is it really worth a customization option? (defcustom bookmark-search-delay 0.2 diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 179cc5484cd..539ef673f0b 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -92,13 +92,13 @@ number." (defcustom Buffer-menu-size-width 7 "Width of buffer size column in the Buffer Menu." - :type 'number + :type 'natnum :group 'Buffer-menu :version "24.3") (defcustom Buffer-menu-mode-width 16 "Width of mode name column in the Buffer Menu." - :type 'number + :type 'natnum :group 'Buffer-menu) (defcustom Buffer-menu-use-frame-buffer-list t diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index b03dcfeb5b7..254c703ee22 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -412,7 +412,7 @@ and deleted by `calc-pop'." (defcustom calc-undo-length 100 "The number of undo steps that will be preserved when Calc is quit." - :type 'integer) + :type 'natnum) (defcustom calc-highlight-selections-with-faces nil "If non-nil, use a separate face to indicate selected sub-formulas. diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 9a77ae72d02..0d9e6976443 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -211,7 +211,7 @@ If you change this variable directly (without using customize) after starting `calendar', you should call `calendar-redraw' to update the calendar display to reflect the change, otherwise movement commands will not work correctly." - :type 'integer + :type 'natnum ;; Change the initialize so that if you reload calendar.el, it will not ;; cause a redraw. :initialize 'custom-initialize-default @@ -511,7 +511,7 @@ Then redraw the calendar, if necessary." :initialize #'custom-initialize-default :set (lambda (sym val) (calendar-set-layout-variable sym val 1)) - :type 'integer + :type 'natnum :version "23.1") ;; FIXME calendar-month-column-width? @@ -520,7 +520,7 @@ Then redraw the calendar, if necessary." :initialize #'custom-initialize-default :set (lambda (sym val) (calendar-set-layout-variable sym val 3)) - :type 'integer + :type 'natnum :version "23.1") (defun calendar-day-header-construct (&optional width) @@ -553,7 +553,7 @@ Must be at least one less than `calendar-column-width'." :initialize #'custom-initialize-default :set (lambda (sym val) (calendar-set-layout-variable sym val 2)) - :type 'integer + :type 'natnum :version "23.1") (defcustom calendar-intermonth-header nil diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el index 1c6a557a0d3..7bdaf7ceff6 100644 --- a/lisp/calendar/timeclock.el +++ b/lisp/calendar/timeclock.el @@ -86,7 +86,7 @@ (defcustom timeclock-workday (* 8 60 60) "The length of a work period in seconds." - :type 'integer) + :type 'natnum) (defvar timeclock--previous-workday nil) diff --git a/lisp/comint.el b/lisp/comint.el index 4fc1ffcf0cd..7e22aa78fce 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -330,12 +330,12 @@ This variable is buffer-local in all Comint buffers." "The maximum size in lines for Comint buffers. Comint buffers are truncated from the top to be no greater than this number, if the function `comint-truncate-buffer' is on `comint-output-filter-functions'." - :type 'integer + :type 'natnum :group 'comint) (defcustom comint-input-ring-size 500 "Size of the input history ring in `comint-mode'." - :type 'integer + :type 'natnum :group 'comint :version "23.2") diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 63be1b16f3d..25c476b99ba 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -225,7 +225,7 @@ are available (see Info node `(emacs)Document View')" (defcustom doc-view-resolution 100 "Dots per inch resolution used to render the documents. Higher values result in larger images." - :type 'number) + :type 'natnum) (defvar doc-view-doc-type nil "The type of document in the current buffer. @@ -301,7 +301,7 @@ scaling." Has only an effect if `doc-view-scale-internally' is non-nil and support for scaling is compiled into Emacs." :version "24.1" - :type 'number) + :type 'natnum) (defcustom doc-view-dvipdfm-program "dvipdfm" "Program to convert DVI files to PDF. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 6545c8d961d..5ef517d7e32 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1725,8 +1725,8 @@ The byte-compiler will emit a warning for documentation strings containing lines wider than this. If `fill-column' has a larger value, it will override this variable." :group 'bytecomp - :type 'integer - :safe #'integerp + :type 'natnum + :safe #'natnump :version "28.1") (define-obsolete-function-alias 'byte-compile-docstring-length-warn diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 2109aa9923a..73285e0f24d 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -63,7 +63,7 @@ This is intended for debugging the compiler itself. 2 emit debug symbols and dump pseudo C code. 3 emit debug symbols and dump: pseudo C code, GCC intermediate passes and libgccjit log file." - :type 'integer + :type 'natnum :safe #'natnump :version "28.1") @@ -74,7 +74,7 @@ This is intended for debugging the compiler itself. 1 final LIMPLE is logged. 2 LAP, final LIMPLE, and some pass info are logged. 3 max verbosity." - :type 'integer + :type 'natnum :risky t :version "28.1") @@ -111,7 +111,7 @@ during bootstrap." "Default number of subprocesses used for async native compilation. Value of zero means to use half the number of the CPU's execution units, or one if there's just one execution unit." - :type 'integer + :type 'natnum :risky t :version "28.1") diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 2c43db98993..85a154a8e07 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -418,22 +418,22 @@ synchronously." (defcustom package-name-column-width 30 "Column width for the Package name in the package menu." - :type 'number + :type 'natnum :version "28.1") (defcustom package-version-column-width 14 "Column width for the Package version in the package menu." - :type 'number + :type 'natnum :version "28.1") (defcustom package-status-column-width 12 "Column width for the Package status in the package menu." - :type 'number + :type 'natnum :version "28.1") (defcustom package-archive-column-width 8 "Column width for the Package archive in the package menu." - :type 'number + :type 'natnum :version "28.1") diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index db36909fb86..972d4f9df00 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -146,7 +146,7 @@ See variable `eshell-scroll-to-bottom-on-output' and function Eshell buffers are truncated from the top to be no greater than this number, if the function `eshell-truncate-buffer' is on `eshell-output-filter-functions'." - :type 'integer) + :type 'natnum) (defcustom eshell-output-filter-functions '(eshell-postoutput-scroll-to-bottom diff --git a/lisp/frame.el b/lisp/frame.el index 6996bb2e9c6..9476cb0ec46 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2841,7 +2841,7 @@ Values smaller than 0.2 sec are treated as 0.2 sec." "How many times to blink before using a solid cursor on NS, X, and MS-Windows. Use 0 or negative value to blink forever." :version "24.4" - :type 'integer + :type 'natnum :group 'cursor) (defvar blink-cursor-blinks-done 1 diff --git a/lisp/info.el b/lisp/info.el index f9d63b0f32d..906385fdc71 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -260,7 +260,7 @@ This only has an effect if `Info-hide-note-references' is non-nil." "Depth of breadcrumbs to display. 0 means do not display breadcrumbs." :version "23.1" - :type 'integer) + :type 'natnum) (defcustom Info-search-whitespace-regexp "\\s-+" "If non-nil, regular expression to match a sequence of whitespace chars. diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index a3ada443702..be26ca55f0d 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -51,7 +51,7 @@ This variable controls both `display-time' and stealth fontification. The optimum value is a little over the typical number of buffer characters which fit in a typical window." - :type 'integer) + :type 'natnum) (defcustom jit-lock-stealth-time nil diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 14be909722b..92118ad1433 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -129,7 +129,7 @@ Set to nil if no mouse binding is desired." (defcustom kmacro-ring-max 8 "Maximum number of keyboard macros to save in macro ring." - :type 'integer) + :type 'natnum) (defcustom kmacro-execute-before-append t diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 92989fcfb2e..a134654a020 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -2194,12 +2194,12 @@ otherwise it could decide to silently do nothing." (defcustom yank-menu-length 20 "Text of items in `yank-menu' longer than this will be truncated." - :type 'integer + :type 'natnum :group 'menu) (defcustom yank-menu-max-items 60 "Maximum number of entries to display in the `yank-menu'." - :type 'integer + :type 'natnum :group 'menu :version "29.1") diff --git a/lisp/midnight.el b/lisp/midnight.el index 3e309a5c881..60d9b565ef0 100644 --- a/lisp/midnight.el +++ b/lisp/midnight.el @@ -67,14 +67,14 @@ The autokilling is done by `clean-buffer-list' when it is in `midnight-hook'. Currently displayed and/or modified (unsaved) buffers, as well as buffers matching `clean-buffer-list-kill-never-buffer-names' and `clean-buffer-list-kill-never-regexps' are excluded." - :type 'integer) + :type 'natnum) (defcustom clean-buffer-list-delay-special 3600 "The number of seconds before some buffers become eligible for autokilling. Buffers matched by `clean-buffer-list-kill-regexps' and `clean-buffer-list-kill-buffer-names' are killed if they were last displayed more than this many seconds ago." - :type 'integer) + :type 'natnum) (defcustom clean-buffer-list-kill-regexps '("\\`\\*Man ") "List of regexps saying which buffers will be killed at midnight. diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index e0824f39716..eec405373db 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -89,7 +89,7 @@ You can specify here: This port is probably always 2628 so there should be no need to modify it." :group 'dictionary :set #'dictionary-set-server-var - :type 'number + :type 'natnum :version "28.1") (defcustom dictionary-identification @@ -206,7 +206,7 @@ where the current word was found." "The port of the proxy server, used only when `dictionary-use-http-proxy' is set." :group 'dictionary-proxy :set #'dictionary-set-server-var - :type 'number + :type 'natnum :version "28.1") (defcustom dictionary-use-single-buffer diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el index da45457891b..0f2943cbb03 100644 --- a/lisp/net/ldap.el +++ b/lisp/net/ldap.el @@ -54,7 +54,7 @@ a separator." Initialized from the LDAP library at build time. Default value is 389." :type '(choice (const :tag "Use library default" nil) - (integer :tag "Port number"))) + (natnum :tag "Port number"))) (defcustom ldap-default-base nil "Default base for LDAP searches. diff --git a/lisp/net/pop3.el b/lisp/net/pop3.el index 0f6dfb6ad46..de225d76dcc 100644 --- a/lisp/net/pop3.el +++ b/lisp/net/pop3.el @@ -59,7 +59,7 @@ (defcustom pop3-port 110 "POP3 port." :version "22.1" ;; Oort Gnus - :type 'number + :type 'natnum :group 'pop3) (defcustom pop3-password-required t @@ -88,7 +88,7 @@ valid value is `apop'." The lower the number, the more latency-sensitive the fetching will be. If your pop3 server doesn't support streaming at all, set this to 1." - :type 'number + :type 'natnum :version "24.1" :group 'pop3) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 36352a46734..dc0946fb09a 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -130,7 +130,7 @@ be displayed instead." (defcustom rcirc-default-port 6667 "The default port to connect to." - :type 'integer) + :type 'natnum) (defcustom rcirc-default-nick (user-login-name) "Your nick." diff --git a/lisp/net/sieve-manage.el b/lisp/net/sieve-manage.el index 50342b9105a..a39e35a53a1 100644 --- a/lisp/net/sieve-manage.el +++ b/lisp/net/sieve-manage.el @@ -131,7 +131,7 @@ for doing the actual authentication." (defcustom sieve-manage-default-port "sieve" "Default port number or service name for managesieve protocol." - :type '(choice integer string) + :type '(choice natnum string) :version "24.4") (defcustom sieve-manage-default-stream 'network diff --git a/lisp/play/spook.el b/lisp/play/spook.el index f2bdba1c2aa..ccff2e75b0a 100644 --- a/lisp/play/spook.el +++ b/lisp/play/spook.el @@ -49,7 +49,7 @@ (defcustom spook-phrase-default-count 15 "Default number of phrases to insert." - :type 'integer) + :type 'natnum) ;;;###autoload (defun spook () diff --git a/lisp/play/tetris.el b/lisp/play/tetris.el index d9bc0dd020c..a6bfea81ee1 100644 --- a/lisp/play/tetris.el +++ b/lisp/play/tetris.el @@ -95,27 +95,27 @@ If the return value is a number, it is used as the timer period." (defcustom tetris-buffer-width 30 "Width of used portion of buffer." - :type 'number) + :type 'natnum) (defcustom tetris-buffer-height 22 "Height of used portion of buffer." - :type 'number) + :type 'natnum) (defcustom tetris-width 10 "Width of playing area." - :type 'number) + :type 'natnum) (defcustom tetris-height 20 "Height of playing area." - :type 'number) + :type 'natnum) (defcustom tetris-top-left-x 3 "X position of top left of playing area." - :type 'number) + :type 'natnum) (defcustom tetris-top-left-y 1 "Y position of top left of playing area." - :type 'number) + :type 'natnum) (defcustom tetris-allow-repetitions t "If non-nil, use a random selection for each shape. diff --git a/lisp/profiler.el b/lisp/profiler.el index 94c24c62aa6..8670e5786a4 100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el @@ -38,7 +38,7 @@ (defcustom profiler-sampling-interval 1000000 "Default sampling interval in nanoseconds." - :type 'integer + :type 'natnum :group 'profiler) diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index ef8375e859c..b950f93f2a0 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -274,8 +274,8 @@ file. Since that is a plaintext file, this could be dangerous." (defcustom sql-port 0 "Default port for connecting to a MySQL or Postgres server." :version "24.1" - :type 'number - :safe 'numberp) + :type 'natnum + :safe 'natnump) (defcustom sql-default-directory nil "Default directory for SQL processes." diff --git a/lisp/recentf.el b/lisp/recentf.el index 601b2642f76..4bc1ab5c219 100644 --- a/lisp/recentf.el +++ b/lisp/recentf.el @@ -178,7 +178,7 @@ The default is to call `find-file' to edit the selected file." (defcustom recentf-max-menu-items 10 "Maximum number of items in the recentf menu." :group 'recentf - :type 'integer) + :type 'natnum) (defcustom recentf-menu-filter nil "Function used to filter files displayed in the recentf menu. diff --git a/lisp/savehist.el b/lisp/savehist.el index 172acaa4e87..8924c8dde23 100644 --- a/lisp/savehist.el +++ b/lisp/savehist.el @@ -97,7 +97,8 @@ This is decimal, not octal. The default is 384 (0600 in octal). Set to nil to use the default permissions that Emacs uses, typically mandated by umask. The default is a bit more restrictive to protect the user's privacy." - :type 'integer) + :type '(choice (natnum :tag "Specify") + (const :tag "Use default" :value nil))) (defcustom savehist-autosave-interval (* 5 60) "The interval between autosaves of minibuffer history. diff --git a/lisp/strokes.el b/lisp/strokes.el index 5402ebf1e1c..376cbc0cfee 100644 --- a/lisp/strokes.el +++ b/lisp/strokes.el @@ -252,7 +252,7 @@ WARNING: Changing the value of this variable will gravely affect the figure out what it should be based on your needs and on how quick the particular platform(s) you're operating on, and only then start programming in your custom strokes." - :type 'integer) + :type 'natnum) (defcustom strokes-file (locate-user-emacs-file "strokes" ".strokes") "File containing saved strokes for Strokes mode." diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 4ca177f73b7..fdfbe207b5f 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -618,7 +618,7 @@ Also add the number of windows in the window configuration." "Maximum length of the tab name from the current buffer. Effective when `tab-bar-tab-name-function' is customized to `tab-bar-tab-name-truncated'." - :type 'integer + :type 'natnum :group 'tab-bar :version "27.1") diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index a7e257f41c5..08e38c9a050 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -66,7 +66,7 @@ If you select a region larger than this size, it won't be copied to your system clipboard. Since clipboard data is base 64 encoded, the actual number of string bytes that can be copied is 3/4 of this value." :version "25.1" - :type 'integer) + :type 'natnum) (defcustom xterm-set-window-title nil "Whether Emacs should set window titles to an Emacs frame in an XTerm." diff --git a/lisp/time.el b/lisp/time.el index cd985bfb288..e7066cae7a5 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -93,7 +93,7 @@ Non-nil means \\[display-time] should display day and date as well as time." (defcustom display-time-interval 60 "Seconds between updates of time in the mode line." - :type 'integer) + :type 'natnum) (defcustom display-time-24hr-format nil "Non-nil indicates time should be displayed as hh:mm, 0 <= hh <= 23. @@ -519,7 +519,7 @@ If the value is t instead of an alist, use the value of (defcustom world-clock-timer-second 60 "Interval in seconds for updating the `world-clock' buffer." - :type 'integer + :type 'natnum :version "28.1") (defface world-clock-label diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el index 3e69227124f..db8c121cf00 100644 --- a/lisp/url/url-cache.el +++ b/lisp/url/url-cache.el @@ -37,7 +37,7 @@ "Default maximum time in seconds before cache files expire. Used by the function `url-cache-expired'." :version "24.1" - :type 'integer + :type 'natnum :group 'url-cache) ;; Cache manager diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el index 15c78512c64..0709cdd3fa1 100644 --- a/lisp/url/url-cookie.el +++ b/lisp/url/url-cookie.el @@ -360,7 +360,7 @@ to run the `url-cookie-setup-save-timer' function manually." (set-default var val) (if (bound-and-true-p url-setup-done) (url-cookie-setup-save-timer))) - :type 'integer + :type 'natnum :group 'url-cookie) (defun url-cookie-setup-save-timer () diff --git a/lisp/url/url-history.el b/lisp/url/url-history.el index cb4814afcad..058e601301b 100644 --- a/lisp/url/url-history.el +++ b/lisp/url/url-history.el @@ -63,7 +63,7 @@ to run the `url-history-setup-save-timer' function manually." (set-default var val) (if (bound-and-true-p url-setup-done) (url-history-setup-save-timer))) - :type 'integer + :type 'natnum :group 'url-history) (defvar url-history-timer nil) diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el index b2e24607e11..cf45a7f681a 100644 --- a/lisp/url/url-queue.el +++ b/lisp/url/url-queue.el @@ -36,13 +36,13 @@ (defcustom url-queue-parallel-processes 6 "The number of concurrent processes." :version "24.1" - :type 'integer + :type 'natnum :group 'url) (defcustom url-queue-timeout 5 "How long to let a job live once it's started (in seconds)." :version "24.1" - :type 'integer + :type 'natnum :group 'url) ;;; Internal variables. diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el index 1012525568b..de42599e0d4 100644 --- a/lisp/url/url-vars.el +++ b/lisp/url/url-vars.el @@ -297,7 +297,7 @@ get the first available language (as opposed to the default)." (defcustom url-max-password-attempts 5 "Maximum number of times a password will be prompted for. Applies when a protected document is denied by the server." - :type 'integer + :type 'natnum :group 'url) (defcustom url-show-status t @@ -330,7 +330,7 @@ undefined." (defcustom url-max-redirections 30 "The maximum number of redirection requests to honor in a HTTP connection. A negative number means to honor an unlimited number of redirection requests." - :type 'integer + :type 'natnum :group 'url) (defcustom url-confirmation-func 'y-or-n-p diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el index 6e94ea07157..422ed5c0a4d 100644 --- a/lisp/vc/emerge.el +++ b/lisp/vc/emerge.el @@ -221,7 +221,7 @@ depend on the flags." (defcustom emerge-min-visible-lines 3 "Number of lines to show above and below the flags when displaying a difference." - :type 'integer) + :type 'natnum) (defcustom emerge-temp-file-prefix (expand-file-name "emerge" temporary-file-directory) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index d6f0f4a4977..d3e53858c16 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -824,7 +824,7 @@ for the backend you use." "Limit the number of items shown by the VC log commands. Zero means unlimited. Not all VC backends are able to support this feature." - :type 'integer) + :type 'natnum) (defcustom vc-allow-async-revert nil "Specifies whether the diff during \\[vc-revert] may be asynchronous. diff --git a/lisp/window.el b/lisp/window.el index eba888a89dd..a3ef2521bb7 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -451,7 +451,7 @@ window to a height less than the one specified here, an application should instead call `window-resize' with a non-nil IGNORE argument. In order to have `split-window' make a window shorter, explicitly specify the SIZE argument of that function." - :type 'integer + :type 'natnum :version "24.1" :group 'windows) @@ -483,7 +483,7 @@ window to a width less than the one specified here, an application should instead call `window-resize' with a non-nil IGNORE argument. In order to have `split-window' make a window narrower, explicitly specify the SIZE argument of that function." - :type 'integer + :type 'natnum :version "24.1" :group 'windows) diff --git a/lisp/winner.el b/lisp/winner.el index 9b2433b4929..38ab5f51016 100644 --- a/lisp/winner.el +++ b/lisp/winner.el @@ -50,7 +50,7 @@ (defcustom winner-ring-size 200 "Maximum number of stored window configurations per frame." - :type 'integer) + :type 'natnum) (defcustom winner-boring-buffers '("*Completions*") "List of buffer names whose windows `winner-undo' will not restore. -- cgit v1.2.3 From 99872bedf07315f642d143feaed9075a7ea20cba Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 5 Jul 2022 19:45:35 +0300 Subject: ; * lisp/emacs-lisp/subr-x.el (string-limit): Clarify doc string. --- lisp/emacs-lisp/subr-x.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 39697a8e725..5159e8784a5 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -170,11 +170,10 @@ limit the string to. The result will be a unibyte string that is shorter than LENGTH, but will not contain \"partial\" characters (or glyphs), even if CODING-SYSTEM encodes characters with several bytes per character. If the coding system specifies -things like byte order marks (aka \"BOM\") or language tags, they -will normally be part of the calculation. This is the case, for -instance, with `utf-16'. If this isn't desired, use a coding -system that doesn't specify a BOM, like `utf-16le' or -`utf-16be'. +prefix like the byte order mark (aka \"BOM\") or a shift-in sequence, +their bytes will be normally counted as part of LENGTH. This is +the case, for instance, with `utf-16'. If this isn't desired, use a +coding system that doesn't specify a BOM, like `utf-16le' or `utf-16be'. When shortening strings for display purposes, `truncate-string-to-width' is almost always a better alternative -- cgit v1.2.3 From ef218ac936c3ffe219b57e37e684fd8400389c38 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 6 Jul 2022 12:31:01 +0200 Subject: ; * lisp/emacs-lisp/ert.el: Remove installation instructions. --- lisp/emacs-lisp/ert.el | 2 -- 1 file changed, 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 82722add42a..262d85f9b43 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -47,8 +47,6 @@ ;; environment (like availability of features, external binaries, etc). ;; ;; See ERT's info manual as well as the docstrings for more details. -;; To compile the manual, run `makeinfo ert.texinfo' in the ERT -;; directory, then C-u M-x info ert.info in Emacs to view it. ;; ;; To see some examples of tests written in ERT, see its self-tests in ;; ert-tests.el. Some of these are tricky due to the bootstrapping -- cgit v1.2.3 From f9d01e504711676d7c223ad9543256a9d34fde55 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 6 Jul 2022 12:31:01 +0200 Subject: ; * lisp/emacs-lisp/ert.el: Remove installation instructions. (cherry picked from commit ef218ac936c3ffe219b57e37e684fd8400389c38) --- lisp/emacs-lisp/ert.el | 2 -- 1 file changed, 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 41180f9914a..156eeadb5db 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -47,8 +47,6 @@ ;; environment (like availability of features, external binaries, etc). ;; ;; See ERT's info manual as well as the docstrings for more details. -;; To compile the manual, run `makeinfo ert.texinfo' in the ERT -;; directory, then C-u M-x info ert.info in Emacs to view it. ;; ;; To see some examples of tests written in ERT, see its self-tests in ;; ert-tests.el. Some of these are tricky due to the bootstrapping -- cgit v1.2.3 From 22bcbf8e2cc271555a737c176c48e89daa0c17be Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 6 Jul 2022 15:25:56 +0200 Subject: Fix missing :value with defcustom const :type * lisp/calendar/calendar.el (calendar-intermonth-header) (calendar-intermonth-text, calendar-date-style): * lisp/calendar/diary-lib.el (diary-face-attrs): * lisp/emacs-lisp/package.el (package-check-signature): * lisp/erc/erc-dcc.el (erc-dcc-get-default-directory): * lisp/gnus/gnus-art.el (gnus-auto-select-part): * lisp/gnus/gnus-cus.el (gnus-agent-parameters): * lisp/gnus/gnus.el (gnus-user-agent): * lisp/mail/rmail.el (rmail-retry-ignored-headers): * lisp/progmodes/sh-script.el (sh-indent-after-continuation): Fix missing :value with defcustom const :type. --- lisp/calendar/calendar.el | 10 +++++----- lisp/calendar/diary-lib.el | 10 +++++----- lisp/emacs-lisp/package.el | 8 ++++---- lisp/erc/erc-dcc.el | 2 +- lisp/gnus/gnus-art.el | 6 +++--- lisp/gnus/gnus-cus.el | 2 +- lisp/gnus/gnus.el | 10 +++++----- lisp/mail/rmail.el | 2 +- lisp/progmodes/sh-script.el | 6 +++--- 9 files changed, 28 insertions(+), 28 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 0d9e6976443..c1f176050c2 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -565,7 +565,7 @@ See `calendar-intermonth-text'." :set (lambda (sym val) (set sym val) (calendar-redraw)) - :type '(choice (const nil :tag "Nothing") + :type '(choice (const :value nil :tag "Nothing") (string :tag "Fixed string") (sexp :value (propertize "WK" 'font-lock-face @@ -597,7 +597,7 @@ See also `calendar-intermonth-header'." :set (lambda (sym val) (set sym val) (calendar-redraw)) - :type '(choice (const nil :tag "Nothing") + :type '(choice (const :value nil :tag "Nothing") (string :tag "Fixed string") (sexp :value (propertize @@ -742,9 +742,9 @@ Setting this variable directly does not take effect (if the calendar package is already loaded). Rather, use either \\[customize] or the function `calendar-set-date-style'." :version "23.1" - :type '(choice (const american :tag "Month/Day/Year") - (const european :tag "Day/Month/Year") - (const iso :tag "Year/Month/Day")) + :type '(choice (const :value american :tag "American (Month/Day/Year)") + (const :value european :tag "European (Day/Month/Year)") + (const :value iso :tag "ISO 8601 (Year/Month/Day)")) :initialize 'custom-initialize-default :set (lambda (_symbol value) (calendar-set-date-style value)) diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 48dbf33adff..084d2d7d55e 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -100,11 +100,11 @@ are: `string', `symbol', `int', `tnil', `stringtnil'." :type '(repeat (list (regexp :tag "Regular expression") (integer :tag "Sub-expression") (symbol :tag "Attribute (e.g. :foreground)") - (choice (const string :tag "A string") - (const symbol :tag "A symbol") - (const int :tag "An integer") - (const tnil :tag "t or nil") - (const stringtnil + (choice (const :value string :tag "A string") + (const :value symbol :tag "A symbol") + (const :value int :tag "An integer") + (const :value tnil :tag "t or nil") + (const :value stringtnil :tag "A string, t, or nil")))) :group 'diary) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 85a154a8e07..c8b66675970 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -355,10 +355,10 @@ More specifically the value can be: This also applies to the \"archive-contents\" file that lists the contents of the archive." - :type '(choice (const nil :tag "Never") - (const allow-unsigned :tag "Allow unsigned") - (const t :tag "Check always") - (const all :tag "Check all signatures")) + :type '(choice (const :value nil :tag "Never") + (const :value allow-unsigned :tag "Allow unsigned") + (const :value t :tag "Check always") + (const :value all :tag "Check all signatures")) :risky t :version "27.1") diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index ff486b2d4ea..d0e1848e0eb 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -391,7 +391,7 @@ the accepted connection." (defcustom erc-dcc-get-default-directory nil "Default directory for incoming DCC file transfers. If this is nil, then the current value of `default-directory' is used." - :type '(choice (const nil :tag "Default directory") directory)) + :type '(choice (const :value nil :tag "Default directory") directory)) ;;;###autoload (defun erc-cmd-DCC (cmd &rest args) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 2a56a12dbba..4b68a54ce81 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -1091,9 +1091,9 @@ positive (negative), move point forward (backwards) this many parts. When nil, redisplay article." :version "23.1" ;; No Gnus :group 'gnus-article-mime - :type '(choice (const nil :tag "Redisplay article.") - (const 1 :tag "Next part.") - (const 0 :tag "Current part.") + :type '(choice (const :value nil :tag "Redisplay article") + (const :value 1 :tag "Next part") + (const :value 0 :tag "Current part") integer)) ;;; diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el index f8714a95d40..ddd939794dd 100644 --- a/lisp/gnus/gnus-cus.el +++ b/lisp/gnus/gnus-cus.el @@ -273,7 +273,7 @@ DOC is a documentation string for the parameter.") gnus-agent-cat-predicate) (agent-score (choice :tag "Score File" :value nil - (const file :tag "Use group's score files") + (const :value file :tag "Use group's score files") (repeat (list (string :format "%v" :tag "File name")))) "Which score files to use when using score to select articles to fetch. diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index f60c11f985d..2119e68509e 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -2263,12 +2263,12 @@ a string, be sure to use a valid format, see RFC 2616." :version "22.1" :group 'gnus-message :type '(choice (list (set :inline t - (const gnus :tag "Gnus version") - (const emacs :tag "Emacs version") + (const :value gnus :tag "Gnus version") + (const :value emacs :tag "Emacs version") (choice :tag "system" - (const type :tag "system type") - (const config :tag "system configuration")) - (const codename :tag "Emacs codename"))) + (const :value type :tag "system type") + (const :value config :tag "system configuration")) + (const :value codename :tag "Emacs codename"))) (string))) ;; Convert old (< 2005-01-10) symbol type values: diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index adb61aa09db..b2b21b88ef8 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -388,7 +388,7 @@ If nil, display all header fields except those matched by ;;;###autoload (defcustom rmail-retry-ignored-headers (purecopy "^x-authentication-warning:\\|^x-detected-operating-system:\\|^x-spam[-a-z]*:\\|content-type:\\|content-transfer-encoding:\\|mime-version:\\|message-id:") "Headers that should be stripped when retrying a failed message." - :type '(choice regexp (const nil :tag "None")) + :type '(choice regexp (const :value nil :tag "None")) :group 'rmail-headers :version "23.2") ; added x-detected-operating-system, x-spam diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index c3e93c397a5..71fb0cd2e00 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1926,9 +1926,9 @@ With t, you get the latter as long as that would indent the continuation line deeper than the initial line." :version "25.1" :type '(choice - (const nil :tag "Never") - (const t :tag "Only if needed to make it deeper") - (const always :tag "Always")) + (const :value nil :tag "Never") + (const :value t :tag "Only if needed to make it deeper") + (const :value always :tag "Always")) :group 'sh-indentation) (defun sh-smie--continuation-start-indent () -- cgit v1.2.3 From 6a7bb1ddbc9837b2d2af60236be58723114855ac Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 6 Jul 2022 19:29:51 +0200 Subject: Make some additional defcustom types more restrictive * lisp/desktop.el (desktop-lazy-idle-delay): * lisp/files.el (dired-kept-versions) (kept-old-versions, kept-new-versions): * lisp/filesets.el (filesets-max-submenu-length) (filesets-max-entry-length, filesets-tree-max-level) (filesets-query-user-limit): * lisp/hi-lock.el (hi-lock-file-patterns-range) (hi-lock-highlight-range): * lisp/ido.el (ido-max-work-directory-list): * lisp/image/gravatar.el (gravatar-cache-ttl): * lisp/imenu.el (imenu-auto-rescan-maxout, imenu-max-items): * lisp/informat.el (Info-split-threshold): * lisp/mail/hashcash.el (hashcash-default-payment) (hashcash-default-accept-payment): * lisp/mail/mail-hist.el (mail-hist-history-size): * lisp/mail/smtpmail.el (smtpmail-retries): * lisp/msb.el (msb-display-most-recently-used): * lisp/nxml/rng-valid.el (rng-state-cache-distance) (rng-validate-chunk-size): * lisp/progmodes/gdb-mi.el (gdb-max-source-window-count): * lisp/recentf.el (recentf-arrange-by-rules-min-items): * lisp/simple.el (kill-ring-max, mark-ring-max) (global-mark-ring-max): * lisp/tab-line.el (tab-line-tab-name-truncated-max): * lisp/term.el (term-buffer-maximum-size, term-input-chunk-size): * lisp/thumbs.el (thumbs-max-image-number) (thumbs-thumbsdir-max-size, thumbs-relief, thumbs-margin) (thumbs-image-resizing-step): * lisp/type-break.el (type-break-interval) (type-break-good-rest-interval, type-break-query-interval) (type-break-warning-repeat): * lisp/vc/compare-w.el (compare-windows-sync-string-size): * lisp/woman.el (woman-fill-column): Use defcustom :type natnum. * lisp/emacs-lisp/backtrace.el (backtrace-line-length): * lisp/doc-view.el (doc-view-conversion-refresh-interval): Use defcustom :type natnum and allow the nil value. * lisp/gnus/spam-stat.el (spam-stat-process-directory-age): Use defcustom :type integer. --- lisp/desktop.el | 2 +- lisp/doc-view.el | 3 ++- lisp/emacs-lisp/backtrace.el | 3 ++- lisp/files.el | 10 +++++----- lisp/filesets.el | 8 ++++---- lisp/gnus/spam-stat.el | 2 +- lisp/hi-lock.el | 4 ++-- lisp/ido.el | 2 +- lisp/image/gravatar.el | 2 +- lisp/imenu.el | 4 ++-- lisp/informat.el | 2 +- lisp/mail/hashcash.el | 4 ++-- lisp/mail/mail-hist.el | 2 +- lisp/mail/smtpmail.el | 2 +- lisp/msb.el | 2 +- lisp/nxml/rng-valid.el | 4 ++-- lisp/progmodes/gdb-mi.el | 2 +- lisp/recentf.el | 2 +- lisp/simple.el | 6 +++--- lisp/tab-line.el | 2 +- lisp/term.el | 4 ++-- lisp/thumbs.el | 16 ++++++++-------- lisp/type-break.el | 8 ++++---- lisp/vc/compare-w.el | 5 ++--- lisp/woman.el | 2 +- 25 files changed, 52 insertions(+), 51 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/desktop.el b/lisp/desktop.el index 947f7cff5cb..850d2a86efa 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -481,7 +481,7 @@ If value is t, all buffers are restored immediately." (defcustom desktop-lazy-idle-delay 5 "Idle delay before starting to create buffers. See `desktop-restore-eager'." - :type 'integer + :type 'natnum :group 'desktop :version "22.1") diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 25c476b99ba..0f659fb8b37 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -378,7 +378,8 @@ After such a refresh newly converted pages will be available for viewing. If set to nil there won't be any refreshes and the pages won't be displayed before conversion of the whole document has finished." - :type 'integer) + :type '(choice natnum + (const :value nil :tag "No refreshes"))) (defcustom doc-view-continuous nil "In Continuous mode reaching the page edge advances to next/previous page. diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el index e305822af1f..4f98bf3f4f5 100644 --- a/lisp/emacs-lisp/backtrace.el +++ b/lisp/emacs-lisp/backtrace.el @@ -58,7 +58,8 @@ Backtrace mode will attempt to abbreviate printing of backtrace frames by setting `print-level' and `print-length' to make them shorter than this, but success is not guaranteed. If set to nil or zero, backtrace mode will not abbreviate the forms it prints." - :type 'integer + :type '(choice natnum + (const :value nil :tag "Don't abbreviate")) :group 'backtrace :version "27.1") diff --git a/lisp/files.el b/lisp/files.el index b2f035d4df8..f84fe7e085b 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -316,7 +316,7 @@ The value `never' means do not make them." (defcustom dired-kept-versions 2 "When cleaning directory, number of versions to keep." - :type 'integer + :type 'natnum :group 'backup :group 'dired) @@ -330,16 +330,16 @@ If nil, ask confirmation. Any other value prevents any trimming." (defcustom kept-old-versions 2 "Number of oldest versions to keep when a new numbered backup is made." - :type 'integer + :type 'natnum + :safe #'natnump :group 'backup) -(put 'kept-old-versions 'safe-local-variable 'integerp) (defcustom kept-new-versions 2 "Number of newest versions to keep when a new numbered backup is made. Includes the new backup. Must be greater than 0." - :type 'integer + :type 'natnum + :safe #'natnump :group 'backup) -(put 'kept-new-versions 'safe-local-variable 'integerp) (defcustom require-final-newline nil "Whether to add a newline automatically at the end of the file. diff --git a/lisp/filesets.el b/lisp/filesets.el index b97dda3cd61..b1829793f11 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -414,12 +414,12 @@ time to time or if the fileset cache causes troubles." Set this value to 0 to turn menu splitting off. BTW, parts of submenus will not be rewrapped if their length exceeds this value." :set #'filesets-set-default - :type 'integer) + :type 'natnum) (defcustom filesets-max-entry-length 50 "Truncate names of split submenus to this length." :set #'filesets-set-default - :type 'integer) + :type 'natnum) (defcustom filesets-browse-dir-function #'dired "A function or command used for browsing directories. @@ -518,7 +518,7 @@ i.e. how deep the menu should be. Try something like and it should become clear what this option is about. In any case, including directory trees to the menu can take a lot of memory." :set #'filesets-set-default - :type 'integer) + :type 'natnum) (defcustom filesets-commands '(("Isearch" @@ -1027,7 +1027,7 @@ defined in `filesets-ingroup-patterns'." (defcustom filesets-query-user-limit 15 "Query the user before opening a fileset with that many files." :set #'filesets-set-default - :type 'integer) + :type 'natnum) (defun filesets-filter-dir-names (lst &optional negative) diff --git a/lisp/gnus/spam-stat.el b/lisp/gnus/spam-stat.el index b0d258d67a5..084eb3d7745 100644 --- a/lisp/gnus/spam-stat.el +++ b/lisp/gnus/spam-stat.el @@ -189,7 +189,7 @@ When using `spam-stat-process-spam-directory' or been touched in this many days will be considered. Without this filter, re-training spam-stat with several thousand messages will start to take a very long time." - :type 'number) + :type 'integer) (defvar spam-stat-last-saved-at nil "Time stamp of last change of spam-stat-file on this run") diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index 8cddd644824..b56f26d5297 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -97,7 +97,7 @@ When a file is visited and hi-lock mode is on, patterns starting up to this limit are added to font-lock's patterns. See documentation of functions `hi-lock-mode' and `hi-lock-find-patterns'." - :type 'integer + :type 'natnum :group 'hi-lock) (defcustom hi-lock-highlight-range 2000000 @@ -107,7 +107,7 @@ such as the buffer created by `list-colors-display'. In those buffers hi-lock patterns will only be applied over a range of `hi-lock-highlight-range' characters. If font-lock is active then highlighting will be applied throughout the buffer." - :type 'integer + :type 'natnum :group 'hi-lock) (defcustom hi-lock-exclude-modes diff --git a/lisp/ido.el b/lisp/ido.el index b3365059d25..134081d6759 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -554,7 +554,7 @@ See `ido-last-directory-list' and `ido-save-directory-list-file'." "Maximum number of working directories to record. This is the list of directories where files have most recently been opened. See `ido-work-directory-list' and `ido-save-directory-list-file'." - :type 'integer) + :type 'natnum) (defcustom ido-work-directory-list-ignore-regexps nil "List of regexps matching directories which should not be recorded. diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el index 78a2df72c4c..8c49c1edf28 100644 --- a/lisp/image/gravatar.el +++ b/lisp/image/gravatar.el @@ -45,7 +45,7 @@ "Time to live in seconds for gravatar cache entries. If a requested gravatar has been cached for longer than this, it is retrieved anew. The default value is 30 days." - :type 'integer + :type 'natnum ;; Restricted :type to number of seconds. :version "27.1" :group 'gravatar) diff --git a/lisp/imenu.el b/lisp/imenu.el index 4393c6ed6cb..040e373fb42 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -87,7 +87,7 @@ This might not yet be honored by all index-building functions." (defcustom imenu-auto-rescan-maxout 600000 "Imenu auto-rescan is disabled in buffers larger than this size (in bytes). Also see `imenu-max-index-time'." - :type 'integer + :type 'natnum :version "26.2") (defcustom imenu-use-popup-menu 'on-mouse @@ -132,7 +132,7 @@ element should come before the second. The arguments are cons cells; (defcustom imenu-max-items 25 "Maximum number of elements in a mouse menu for Imenu." - :type 'integer) + :type 'natnum) (defcustom imenu-space-replacement "." "The replacement string for spaces in index names. diff --git a/lisp/informat.el b/lisp/informat.el index e7595fa541a..c126ab5b1a1 100644 --- a/lisp/informat.el +++ b/lisp/informat.el @@ -158,7 +158,7 @@ ;;;###autoload (defcustom Info-split-threshold 262144 "The number of characters by which `Info-split' splits an info file." - :type 'integer + :type 'natnum :version "23.1" :group 'texinfo) diff --git a/lisp/mail/hashcash.el b/lisp/mail/hashcash.el index b343a017e34..8d274d9cac4 100644 --- a/lisp/mail/hashcash.el +++ b/lisp/mail/hashcash.el @@ -57,7 +57,7 @@ "The default number of bits to pay to unknown users. If this is zero, no payment header will be generated. See `hashcash-payment-alist'." - :type 'integer + :type 'natnum :group 'hashcash) (defcustom hashcash-payment-alist '() @@ -77,7 +77,7 @@ present, is the string to be hashed; if not present ADDR will be used." (defcustom hashcash-default-accept-payment 20 "The default minimum number of bits to accept on incoming payments." - :type 'integer + :type 'natnum :group 'hashcash) (defcustom hashcash-accept-resources `((,user-mail-address nil)) diff --git a/lisp/mail/mail-hist.el b/lisp/mail/mail-hist.el index e02d4218dd2..a13f9de1740 100644 --- a/lisp/mail/mail-hist.el +++ b/lisp/mail/mail-hist.el @@ -80,7 +80,7 @@ previous/next input.") (defcustom mail-hist-history-size (or kill-ring-max 1729) "The maximum number of elements in a mail field's history. Oldest elements are dumped first." - :type 'integer) + :type 'natnum) ;;;###autoload (defcustom mail-hist-keep-history t diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 88e55e968c4..da786dec004 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -171,7 +171,7 @@ attempt." "The number of times smtpmail will retry sending when getting transient errors. These are errors with a code of 4xx from the SMTP server, which mean \"try again\"." - :type 'integer + :type 'natnum :version "27.1") (defcustom smtpmail-store-queue-variables nil diff --git a/lisp/msb.el b/lisp/msb.el index 6e1d03ac277..616799f067b 100644 --- a/lisp/msb.el +++ b/lisp/msb.el @@ -299,7 +299,7 @@ If the value is not a number, then the value 10 is used." (defcustom msb-display-most-recently-used 15 "How many buffers should be in the most-recently-used menu. No buffers at all if less than 1 or nil (or any non-number)." - :type 'integer + :type 'natnum :set #'msb-custom-set) (defcustom msb-most-recently-used-title "Most recently used (%d)" diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el index 56ff3b66c0f..b9c980222e2 100644 --- a/lisp/nxml/rng-valid.el +++ b/lisp/nxml/rng-valid.el @@ -110,14 +110,14 @@ (defcustom rng-state-cache-distance 2000 "Distance in characters between each parsing and validation state cache." - :type 'integer) + :type 'natnum) (defcustom rng-validate-chunk-size 8000 "Number of characters in a RELAX NG validation chunk. A validation chunk will be the smallest chunk that is at least this size and ends with a tag. After validating a chunk, validation will continue only if Emacs is still idle." - :type 'integer) + :type 'natnum) (defcustom rng-validate-delay 1.5 "Time in seconds that Emacs must be idle before starting a full validation. diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 03beb065699..21bb75ae0cf 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -684,7 +684,7 @@ Note that this variable only takes effect when variable Until there are such number of source windows on screen, GDB tries to open a new window when visiting a new source file; after that GDB starts to reuse existing source windows." - :type 'number + :type 'natnum :group 'gdb :version "28.1") diff --git a/lisp/recentf.el b/lisp/recentf.el index 4bc1ab5c219..b80ee3dd7d8 100644 --- a/lisp/recentf.el +++ b/lisp/recentf.el @@ -837,7 +837,7 @@ corresponding sub-menu items are displayed in the main recent files menu or in the `recentf-arrange-by-rule-others' sub-menu if defined." :group 'recentf-filters - :type 'number) + :type 'natnum) (defcustom recentf-arrange-by-rule-subfilter nil "Function called by a rule based filter to filter sub-menu elements. diff --git a/lisp/simple.el b/lisp/simple.el index 042384bbe72..e79487eba86 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5456,7 +5456,7 @@ ring directly.") (defcustom kill-ring-max 120 "Maximum length of kill ring before oldest elements are thrown away." - :type 'integer + :type 'natnum :group 'killing :version "29.1") @@ -7026,7 +7026,7 @@ is set to the buffer displayed in that window.") (defcustom mark-ring-max 16 "Maximum size of mark ring. Start discarding off end if gets this big." - :type 'integer + :type 'natnum :group 'editing-basics) (defvar global-mark-ring nil @@ -7035,7 +7035,7 @@ is set to the buffer displayed in that window.") (defcustom global-mark-ring-max 16 "Maximum size of global mark ring. \ Start discarding off end if gets this big." - :type 'integer + :type 'natnum :group 'editing-basics) (defun pop-to-mark-command () diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 80b0aabd776..3e3b4c95595 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -288,7 +288,7 @@ variable `tab-line-tab-name-function'." "Maximum length of the tab name from the current buffer. Effective when `tab-line-tab-name-function' is customized to `tab-line-tab-name-truncated-buffer'." - :type 'integer + :type 'natnum :group 'tab-line :version "27.1") diff --git a/lisp/term.el b/lisp/term.el index c129ed976d5..a28d8c5d761 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -915,7 +915,7 @@ Term buffers are truncated from the top to be no greater than this number. Notice that a setting of 0 means \"don't truncate anything\". This variable is buffer-local." :group 'term - :type 'integer + :type 'natnum :version "27.1") (defcustom term-bind-function-keys nil @@ -2473,7 +2473,7 @@ Checks if STRING contains a password prompt as defined by "Long inputs send to term processes are broken up into chunks of this size. If your process is choking on big inputs, try lowering the value." :group 'term - :type 'integer) + :type 'natnum) (defun term-send-string (proc str) "Send to PROC the contents of STR as input. diff --git a/lisp/thumbs.el b/lisp/thumbs.el index e622bcedc4e..158597d7c8c 100644 --- a/lisp/thumbs.el +++ b/lisp/thumbs.el @@ -73,16 +73,16 @@ (defcustom thumbs-per-line 4 "Number of thumbnails per line to show in directory." - :type 'integer) + :type 'natnum) (defcustom thumbs-max-image-number 16 - "Maximum number of images initially displayed in thumbs buffer." - :type 'integer) + "Maximum number of images initially displayed in thumbs buffer." + :type 'natnum) (defcustom thumbs-thumbsdir-max-size 50000000 "Maximum size for thumbnails directory. -When it reaches that size (in bytes), a warning is sent." - :type 'integer) +When it reaches that size (in bytes), a warning is displayed." + :type 'natnum) ;; Unfortunately Windows XP has a program called CONVERT.EXE in ;; C:/WINDOWS/SYSTEM32/ for partitioning NTFS systems. So Emacs @@ -106,12 +106,12 @@ This must be the ImageMagick \"convert\" utility." (defcustom thumbs-relief 5 "Size of button-like border around thumbnails." - :type 'integer) + :type 'natnum) (defcustom thumbs-margin 2 "Size of the margin around thumbnails. This is where you see the cursor." - :type 'integer) + :type 'natnum) (defcustom thumbs-thumbsdir-auto-clean t "If set, delete older file in the thumbnails directory. @@ -121,7 +121,7 @@ than `thumbs-thumbsdir-max-size'." (defcustom thumbs-image-resizing-step 10 "Step by which to resize image as a percentage." - :type 'integer) + :type 'natnum) (defcustom thumbs-temp-dir temporary-file-directory "Temporary directory to use. diff --git a/lisp/type-break.el b/lisp/type-break.el index 267facccc47..dca5a43b893 100644 --- a/lisp/type-break.el +++ b/lisp/type-break.el @@ -69,7 +69,7 @@ (defcustom type-break-interval (* 60 60) "Number of seconds between scheduled typing breaks." - :type 'integer + :type 'natnum :group 'type-break) (defcustom type-break-good-rest-interval (/ type-break-interval 6) @@ -82,7 +82,7 @@ rest from typing, then the next typing break is simply rescheduled for later. If a break is interrupted before this much time elapses, the user will be asked whether or not really to interrupt the break." :set-after '(type-break-interval) - :type 'integer + :type 'natnum :group 'type-break) (defcustom type-break-good-break-interval nil @@ -148,7 +148,7 @@ To avoid being queried at all, set `type-break-query-mode' to nil." "Number of seconds between queries to take a break, if put off. The user will continue to be prompted at this interval until he or she finally submits to taking a typing break." - :type 'integer + :type 'natnum :group 'type-break) (defcustom type-break-time-warning-intervals '(300 120 60 30) @@ -171,7 +171,7 @@ will occur." "Number of keystrokes for which warnings should be repeated. That is, for each of this many keystrokes the warning is redisplayed in the echo area to make sure it's really seen." - :type 'integer + :type 'natnum :group 'type-break) (defcustom type-break-time-stamp-format "[%H:%M] " diff --git a/lisp/vc/compare-w.el b/lisp/vc/compare-w.el index b56b4c0d83a..64d5d1081a3 100644 --- a/lisp/vc/compare-w.el +++ b/lisp/vc/compare-w.el @@ -1,7 +1,6 @@ ;;; compare-w.el --- compare text between windows for Emacs -*- lexical-binding: t; -*- -;; Copyright (C) 1986, 1989, 1993, 1997, 2001-2022 Free Software -;; Foundation, Inc. +;; Copyright (C) 1986-2022 Free Software Foundation, Inc. ;; Maintainer: emacs-devel@gnu.org ;; Keywords: convenience files vc @@ -99,7 +98,7 @@ may fail by finding the wrong match. The bigger number makes difference regions more coarse-grained. The default value 32 is good for the most cases." - :type 'integer + :type 'natnum :version "22.1") (defcustom compare-windows-recenter nil diff --git a/lisp/woman.el b/lisp/woman.el index fd5fee2005a..73e068a8221 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -843,7 +843,7 @@ Only useful when run on a graphic display such as X or MS-Windows." (defcustom woman-fill-column 65 "Right margin for formatted text -- default is 65." - :type 'integer + :type 'natnum :group 'woman-formatting) (defcustom woman-fill-frame nil -- cgit v1.2.3 From 3e7f6ff4b09760c92b1a6b1a193d08c52f37675a Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 6 Jul 2022 19:56:32 +0200 Subject: Prefer defcustom :safe to putting 'safe-local-variable' * lisp/emacs-lisp/lisp-mode.el (lisp-indent-offset) (lisp-body-indent, emacs-lisp-docstring-fill-column): * lisp/files.el (version-control): * lisp/progmodes/modula2.el (m2-indent): * lisp/progmodes/octave.el (octave-block-offset): * lisp/progmodes/sh-script.el (sh-basic-offset): * lisp/progmodes/tcl.el (tcl-indent-level) (tcl-continued-indent-level): * lisp/simple.el (fill-prefix): * lisp/textmodes/fill.el (colon-double-space): * lisp/textmodes/paragraphs.el (paragraph-start) (paragraph-separate, sentence-end-double-space) (sentence-end-without-period, sentence-end-without-space) (sentence-end, sentence-end-base, page-delimiter) (paragraph-ignore-fill-prefix): * lisp/textmodes/tex-mode.el (tex-fontify-script): * lisp/vc/add-log.el (add-log-dont-create-changelog-file): * lisp/vc/vc-hooks.el (vc-follow-symlinks): Prefer defcustom :safe to putting 'safe-local-variable'. --- lisp/emacs-lisp/lisp-mode.el | 12 +++++------- lisp/files.el | 6 ++---- lisp/progmodes/modula2.el | 5 ++--- lisp/progmodes/octave.el | 4 ++-- lisp/progmodes/sh-script.el | 2 +- lisp/progmodes/tcl.el | 8 ++++---- lisp/simple.el | 4 ++-- lisp/textmodes/fill.el | 4 ++-- lisp/textmodes/paragraphs.el | 30 +++++++++++++++--------------- lisp/textmodes/tex-mode.el | 2 +- lisp/vc/add-log.el | 3 +-- lisp/vc/vc-hooks.el | 4 ++-- 12 files changed, 39 insertions(+), 45 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index c559dd427cb..68528e199f8 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -838,9 +838,8 @@ or to switch back to an existing one." (defcustom lisp-indent-offset nil "If non-nil, indent second line of expressions that many more columns." :group 'lisp - :type '(choice (const nil) integer)) -(put 'lisp-indent-offset 'safe-local-variable - (lambda (x) (or (null x) (integerp x)))) + :type '(choice (const nil) integer) + :safe (lambda (x) (or (null x) (integerp x)))) (defcustom lisp-indent-function 'lisp-indent-function "A function to be called by `calculate-lisp-indent'. @@ -1252,8 +1251,8 @@ Lisp function does not specify a special indentation." (defcustom lisp-body-indent 2 "Number of columns to indent the second line of a `(def...)' form." :group 'lisp - :type 'integer) -(put 'lisp-body-indent 'safe-local-variable 'integerp) + :type 'integer + :safe #'integerp) (defun lisp-indent-specform (count state indent-point normal-indent) (let ((containing-form-start (elt state 1)) @@ -1414,9 +1413,8 @@ Any non-integer value means do not use a different value of `fill-column' when filling docstrings." :type '(choice (integer) (const :tag "Use the current `fill-column'" t)) + :safe (lambda (x) (or (eq x t) (integerp x))) :group 'lisp) -(put 'emacs-lisp-docstring-fill-column 'safe-local-variable - (lambda (x) (or (eq x t) (integerp x)))) (defun lisp-fill-paragraph (&optional justify) "Like \\[fill-paragraph], but handle Emacs Lisp comments and docstrings. diff --git a/lisp/files.el b/lisp/files.el index f84fe7e085b..992f9879437 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -304,16 +304,14 @@ When nil, make them for files that have some already. The value `never' means do not make them." :type '(choice (const :tag "Never" never) (const :tag "If existing" nil) - (other :tag "Always" t)) + (other :tag "Always" t)) + :safe #'version-control-safe-local-p :group 'backup) (defun version-control-safe-local-p (x) "Return whether X is safe as local value for `version-control'." (or (booleanp x) (equal x 'never))) -(put 'version-control 'safe-local-variable - #'version-control-safe-local-p) - (defcustom dired-kept-versions 2 "When cleaning directory, number of versions to keep." :type 'natnum diff --git a/lisp/progmodes/modula2.el b/lisp/progmodes/modula2.el index a8d644dba0e..e668570ba17 100644 --- a/lisp/progmodes/modula2.el +++ b/lisp/progmodes/modula2.el @@ -101,9 +101,8 @@ (defcustom m2-indent 5 "This variable gives the indentation in Modula-2 mode." - :type 'integer) -(put 'm2-indent 'safe-local-variable - (lambda (v) (or (null v) (integerp v)))) + :type 'integer + :safe (lambda (v) (or (null v) (integerp v)))) (defconst m2-smie-grammar ;; An official definition can be found as "M2R10.pdf". This grammar does diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 7b7c675873b..721dfa51ad3 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -197,8 +197,8 @@ newline or semicolon after an else or end keyword." (defcustom octave-block-offset 2 "Extra indentation applied to statements in Octave block structures." - :type 'integer) -(put 'octave-block-offset 'safe-local-variable 'integerp) + :type 'integer + :safe #'integerp) (defvar octave-block-comment-start (concat (make-string 2 octave-comment-char) " ") diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 71fb0cd2e00..be9f325d93d 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1156,8 +1156,8 @@ Can be set to a number, or to nil which means leave it as is." "The default indentation increment. This value is used for the `+' and `-' symbols in an indentation variable." :type 'integer + :safe #'integerp :group 'sh-indentation) -(put 'sh-basic-offset 'safe-local-variable 'integerp) (defcustom sh-indent-comment t "How a comment line is to be indented. diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el index 8c179879ce2..7dae14f9e02 100644 --- a/lisp/progmodes/tcl.el +++ b/lisp/progmodes/tcl.el @@ -120,13 +120,13 @@ (defcustom tcl-indent-level 4 "Indentation of Tcl statements with respect to containing block." - :type 'integer) -(put 'tcl-indent-level 'safe-local-variable #'integerp) + :type 'integer + :safe #'integerp) (defcustom tcl-continued-indent-level 4 "Indentation of continuation line relative to first line of command." - :type 'integer) -(put 'tcl-continued-indent-level 'safe-local-variable #'integerp) + :type 'integer + :safe #'integerp) (defcustom tcl-auto-newline nil "Non-nil means automatically newline before and after braces you insert." diff --git a/lisp/simple.el b/lisp/simple.el index e79487eba86..6313ce81ef9 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -8609,10 +8609,10 @@ constitute a word." (defcustom fill-prefix nil "String for filling to insert at front of new line, or nil for none." :type '(choice (const :tag "None" nil) - string) + string) + :safe #'string-or-null-p :group 'fill) (make-variable-buffer-local 'fill-prefix) -(put 'fill-prefix 'safe-local-variable 'string-or-null-p) (defcustom auto-fill-inhibit-regexp nil "Regexp to match lines that should not be auto-filled." diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 88a8395c88a..23ba1a24f1f 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -46,8 +46,8 @@ A value of nil means that any change in indentation starts a new paragraph." (defcustom colon-double-space nil "Non-nil means put two spaces after a colon when filling." - :type 'boolean) -(put 'colon-double-space 'safe-local-variable #'booleanp) + :type 'boolean + :safe #'booleanp) (defcustom fill-separate-heterogeneous-words-with-space nil "Non-nil means to use a space to separate words of a different kind. diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el index 98eb494823d..cd726ad4776 100644 --- a/lisp/textmodes/paragraphs.el +++ b/lisp/textmodes/paragraphs.el @@ -96,8 +96,8 @@ lines that start paragraphs from lines that separate them. If the variable `use-hard-newlines' is non-nil, then only lines following a hard newline are considered to match." - :type 'regexp) -(put 'paragraph-start 'safe-local-variable #'stringp) + :type 'regexp + :safe #'stringp) ;; paragraph-start requires a hard newline, but paragraph-separate does not: ;; It is assumed that paragraph-separate is distinctive enough to be believed @@ -113,8 +113,8 @@ This is matched against the text at the left margin, which is not necessarily the beginning of the line, so it should not use \"^\" as an anchor. This ensures that the paragraph functions will work equally within a region of text indented by a margin setting." - :type 'regexp) -(put 'paragraph-separate 'safe-local-variable #'stringp) + :type 'regexp + :safe #'stringp) (defcustom sentence-end-double-space t "Non-nil means a single space does not end a sentence. @@ -125,8 +125,8 @@ This value is used by the function `sentence-end' to construct the regexp describing the end of a sentence, when the value of the variable `sentence-end' is nil. See Info node `(elisp)Standard Regexps'." :type 'boolean + :safe #'booleanp :group 'fill) -(put 'sentence-end-double-space 'safe-local-variable #'booleanp) (defcustom sentence-end-without-period nil "Non-nil means a sentence will end without a period. @@ -137,8 +137,8 @@ This value is used by the function `sentence-end' to construct the regexp describing the end of a sentence, when the value of the variable `sentence-end' is nil. See Info node `(elisp)Standard Regexps'." :type 'boolean + :safe #'booleanp :group 'fill) -(put 'sentence-end-without-period 'safe-local-variable #'booleanp) (defcustom sentence-end-without-space "。.?!" @@ -147,8 +147,8 @@ regexp describing the end of a sentence, when the value of the variable This value is used by the function `sentence-end' to construct the regexp describing the end of a sentence, when the value of the variable `sentence-end' is nil. See Info node `(elisp)Standard Regexps'." - :type 'string) -(put 'sentence-end-without-space 'safe-local-variable #'stringp) + :type 'string + :safe #'stringp) (defcustom sentence-end nil "Regexp describing the end of a sentence. @@ -158,14 +158,14 @@ All paragraph boundaries also end sentences, regardless. The value nil means to use the default value defined by the function `sentence-end'. You should always use this function to obtain the value of this variable." - :type '(choice regexp (const :tag "Use default value" nil))) -(put 'sentence-end 'safe-local-variable #'string-or-null-p) + :type '(choice regexp (const :tag "Use default value" nil)) + :safe #'string-or-null-p) (defcustom sentence-end-base "[.?!…‽][]\"'”’)}»›]*" "Regexp matching the basic end of a sentence, not including following space." :type 'regexp + :safe #'stringp :version "25.1") -(put 'sentence-end-base 'safe-local-variable #'stringp) (defun sentence-end () "Return the regexp describing the end of a sentence. @@ -192,14 +192,14 @@ in between. See Info node `(elisp)Standard Regexps'." (defcustom page-delimiter "^\014" "Regexp describing line-beginnings that separate pages." - :type 'regexp) -(put 'page-delimiter 'safe-local-variable #'stringp) + :type 'regexp + :safe #'stringp) (defcustom paragraph-ignore-fill-prefix nil "Non-nil means the paragraph commands are not affected by `fill-prefix'. This is desirable in modes where blank lines are the paragraph delimiters." - :type 'boolean) -(put 'paragraph-ignore-fill-prefix 'safe-local-variable #'booleanp) + :type 'boolean + :safe #'booleanp) ;; Silence the compiler. (defun forward-paragraph (&optional arg) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index e90d214a127..d34133f8564 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -248,9 +248,9 @@ Normally set to either `plain-tex-mode' or `latex-mode'." (defcustom tex-fontify-script t "If non-nil, fontify subscript and superscript strings." :type 'boolean + :safe #'booleanp :group 'tex :version "23.1") -(put 'tex-fontify-script 'safe-local-variable #'booleanp) (defcustom tex-font-script-display '(-0.2 0.2) "How much to lower and raise subscript and superscript content. diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el index beaad2e835f..e02d84f1f56 100644 --- a/lisp/vc/add-log.el +++ b/lisp/vc/add-log.el @@ -789,10 +789,9 @@ Optional arg BUFFER-FILE overrides `buffer-file-name'." If a ChangeLog file does not already exist, a non-nil value means to put log entries in a suitably named buffer." :type 'boolean + :safe #'booleanp :version "27.1") -(put 'add-log-dont-create-changelog-file 'safe-local-variable #'booleanp) - (defun add-log--pseudo-changelog-buffer-name (changelog-file-name) "Compute a suitable name for a non-file visiting ChangeLog buffer. CHANGELOG-FILE-NAME is the file name of the actual ChangeLog file diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index cc08767ade3..46e40f29c02 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -141,9 +141,9 @@ confirmation whether it should follow the link. If nil, the link is visited and a warning displayed." :type '(choice (const :tag "Ask for confirmation" ask) (const :tag "Visit link and warn" nil) - (const :tag "Follow link" t)) + (const :tag "Follow link" t)) + :safe #'null :group 'vc) -(put 'vc-follow-symlinks 'safe-local-variable #'null) (defcustom vc-display-status t "If non-nil, display revision number and lock status in mode line. -- cgit v1.2.3 From ba63d8783bfd9a484106718346c7dbf6729c4c0f Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 7 Jul 2022 13:37:31 +0800 Subject: Fix `trace-function' default buffer * lisp/emacs-lisp/trace.el (trace--read-args): Don't use format-prompt; instead, use DEF arg to read-buffer. --- lisp/emacs-lisp/trace.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el index 165f5c7bfe2..7377ac94039 100644 --- a/lisp/emacs-lisp/trace.el +++ b/lisp/emacs-lisp/trace.el @@ -273,7 +273,7 @@ If `current-prefix-arg' is non-nil, also read a buffer and a \"context\" (if default (symbol-name default))))) (when current-prefix-arg (list - (read-buffer (format-prompt "Output to buffer" trace-buffer)) + (read-buffer "Output to buffer" trace-buffer) (let ((exp (let ((minibuffer-completing-symbol t)) (read-from-minibuffer "Context expression: " -- cgit v1.2.3 From 139eb1f845d1ec3e2a26aec5d7fafbcdcbaa5f07 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 7 Jul 2022 23:19:03 +0200 Subject: * lisp/emacs-lisp/ert.el (Commentary): Refer to the Info manual. --- lisp/emacs-lisp/ert.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 262d85f9b43..21bee4c6d8b 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1,6 +1,6 @@ ;;; ert.el --- Emacs Lisp Regression Testing -*- lexical-binding: t -*- -;; Copyright (C) 2007-2008, 2010-2022 Free Software Foundation, Inc. +;; Copyright (C) 2007-2022 Free Software Foundation, Inc. ;; Author: Christian Ohler ;; Keywords: lisp, tools @@ -46,12 +46,10 @@ ;; processing further, this is useful for checking the test ;; environment (like availability of features, external binaries, etc). ;; -;; See ERT's info manual as well as the docstrings for more details. -;; -;; To see some examples of tests written in ERT, see its self-tests in -;; ert-tests.el. Some of these are tricky due to the bootstrapping -;; problem of writing tests for a testing tool, others test simple -;; functions and are straightforward. +;; See ERT's Info manual `(ert) Top' as well as the docstrings for +;; more details. To see some examples of tests written in ERT, see +;; the test suite distributed with the Emacs source distribution (in +;; the "test" directory). ;;; Code: -- cgit v1.2.3 From 739e3dbe050468e1d9aa0a48bfc656ae20fd8f9d Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 3 Dec 2021 23:17:04 +0100 Subject: Remove many items obsolete since 24.1 * lisp/allout.el (allout-abbreviate-flattened-numbering) (allout-mode-deactivate-hook): * lisp/ansi-color.el (ansi-color-unfontify-region): * lisp/auth-source.el (auth-source-hide-passwords) (auth-source-user-or-password) (auth-source-forget-user-or-password): * lisp/cedet/data-debug.el (data-debug-map): * lisp/cedet/semantic/grammar.el (semantic-grammar-syntax-table) (semantic-grammar-map): * lisp/chistory.el (command-history-map): * lisp/comint.el (comint-dynamic-complete) (comint-dynamic-complete-as-filename) (comint-dynamic-simple-complete): * lisp/dired-x.el (read-filename-at-point) (dired-x-submit-report): * lisp/dos-fns.el (register-name-alist, make-register) (register-value, set-register-value, intdos, mode25, mode4350): * lisp/emacs-lisp/bytecomp.el (byte-compile-disable-print-circle): * lisp/emacs-lisp/chart.el (chart-map): * lisp/emacs-lisp/package.el (package-menu-view-commentary): * lisp/emacs-lock.el (toggle-emacs-lock, emacs-lock-from-exiting): * lisp/erc/erc.el (erc-complete-word): * lisp/eshell/em-cmpl.el (eshell-cmpl-suffix-list): * lisp/eshell/esh-util.el (eshell-for): * lisp/files.el (inhibit-first-line-modes-regexps) (inhibit-first-line-modes-suffixes): * lisp/gnus/gnus-msg.el (gnus-outgoing-message-group) (gnus-debug-files, gnus-debug-exclude-variables): * lisp/gnus/gnus-registry.el (gnus-registry-user-format-function-M): * lisp/gnus/gnus.el (gnus-local-domain, gnus-carpal): * lisp/gnus/nnimap.el (nnimap-split-rule): * lisp/iimage.el (turn-on-iimage-mode): * lisp/image.el (image-extension-data, image-library-alist): * lisp/mail/emacsbug.el (report-emacs-bug-pretest-address): * lisp/mail/mail-utils.el (rmail-dont-reply-to): * lisp/mail/mailalias.el (mail-complete-function) (mail-completion-at-point-function): * lisp/mail/rmail.el (rmail-dont-reply-to-names) (rmail-default-dont-reply-to-names): * lisp/mail/sendmail.el (mail-mailer-swallows-blank-line) (mail-sent-via): * lisp/menu-bar.el (menu-bar-kill-ring-save): * lisp/minibuffer.el (completion-annotate-function) (minibuffer-local-filename-must-match-map): * lisp/msb.el (msb-after-load-hooks): * lisp/obsolete/eieio-compat.el (eieio-defmethod) (eieio-defgeneric): * lisp/obsolete/info-edit.el (Info-edit-map): * lisp/obsolete/starttls.el (starttls-any-program-available): * lisp/progmodes/cfengine.el (cfengine-mode-abbrevs): * lisp/progmodes/cwarn.el (turn-on-cwarn-mode): * lisp/progmodes/make-mode.el (makefile-complete): * lisp/progmodes/meta-mode.el (meta-complete-symbol) (meta-mode-map): * lisp/progmodes/pascal.el (pascal-toggle-completions) (pascal-last-completions, pascal-show-completions): * lisp/progmodes/prolog.el (prolog-char-quote-workaround): * lisp/progmodes/which-func.el (which-func-mode): [FUNCTION] * lisp/simple.el (count-lines-region, minibuffer-completing-symbol): * lisp/speedbar.el (speedbar-syntax-table, speedbar-key-map): * lisp/strokes.el (strokes-report-bug): * lisp/subr.el (condition-case-no-debug): * lisp/term/ns-win.el (ns-alternatives-map) (ns-store-cut-buffer-internal): * lisp/term/w32-win.el (w32-default-color-map): * lisp/term/x-win.el (x-cut-buffer-or-selection-value): * lisp/textmodes/bibtex.el (bibtex-complete) (bibtex-entry-field-alist): * lisp/textmodes/reftex-index.el (reftex-index-map) (reftex-index-phrases-map): * lisp/textmodes/reftex-sel.el (reftex-select-label-map) (reftex-select-bib-map): * lisp/textmodes/reftex-toc.el (reftex-toc-map): * lisp/textmodes/rst.el (rst-block-face, rst-external-face) (rst-definition-face, rst-directive-face, rst-comment-face) (rst-emphasis1-face, rst-emphasis2-face, rst-literal-face) (rst-reference-face): * lisp/vc/vc-hooks.el (vc-toggle-read-only): * lisp/view.el (view-return-to-alist) (view-return-to-alist-update): Remove many functions and variables obsolete since 24.1. * lisp/textmodes/bibtex.el (bibtex-entry-alist): Don't use above removed variable 'bibtex-entry-field-alist'. * lisp/cedet/data-debug.el (data-debug-edebug-expr) (data-debug-eval-expression): * lisp/emacs-lisp/trace.el (trace--read-args): * lisp/files-x.el (read-file-local-variable-value): * lisp/simple.el (read--expression): Don't use above removed variable 'minibuffer-completing-symbol'. * lisp/textmodes/rst.el (rst-font-lock-keywords): Don't use above removed variables. * src/w32fns.c (Fw32_default_color_map): Delete obsolete function. (syms_of_w32fns): Delete defsubr for above defun. * src/keyboard.c (syms_of_keyboard) : Delete DEFVARs. : Delete DEFSYM. (syms_of_keyboard_for_pdumper): Adjust for above change. (command_loop_1): Don't run deferred-action-function hook. * lisp/subr.el (deferred-action-list, deferred-action-function): Delete obsoletion statements. * lisp/emacs-lisp/ert-x.el (ert-simulate-command): Don't run 'deferred-action-list' hook. * doc/lispref/hooks.texi (Standard Hooks): Delete 'deferred-action-function'. * lisp/emacs-lisp/lisp.el (field-complete): * lisp/eshell/em-cmpl.el (eshell-cmpl-initialize): * lisp/gnus/gnus-msg.el (gnus-inews-insert-gcc): * lisp/gnus/nnmail.el (nnmail-fancy-expiry-target): * lisp/mail/mail-utils.el (mail-dont-reply-to): * lisp/mail/sendmail.el (sendmail-send-it): * lisp/mail/smtpmail.el (smtpmail-send-it): * lisp/minibuffer.el (minibuffer-completion-help): * lisp/progmodes/python.el: Don't use above removed items. * lisp/emacs-lisp/eieio-core.el: * lisp/mail/mailalias.el (mail-complete-alist): Doc fixes; don't refer to above removed items. ; * etc/NEWS: List removed items. --- doc/lispref/hooks.texi | 1 - etc/NEWS | 47 +++++++++++++ lisp/allout.el | 8 --- lisp/ansi-color.el | 3 - lisp/auth-source.el | 85 ------------------------ lisp/cedet/data-debug.el | 16 ++--- lisp/cedet/semantic/grammar.el | 4 -- lisp/chistory.el | 2 - lisp/comint.el | 70 -------------------- lisp/dired-x.el | 7 -- lisp/dos-fns.el | 16 ----- lisp/emacs-lisp/bytecomp.el | 11 +--- lisp/emacs-lisp/chart.el | 1 - lisp/emacs-lisp/eieio-core.el | 4 +- lisp/emacs-lisp/ert-x.el | 3 - lisp/emacs-lisp/lisp.el | 9 +-- lisp/emacs-lisp/package.el | 3 - lisp/emacs-lisp/trace.el | 7 +- lisp/emacs-lock.el | 11 ---- lisp/erc/erc.el | 2 - lisp/eshell/em-cmpl.el | 11 ---- lisp/eshell/esh-util.el | 9 --- lisp/files-x.el | 3 +- lisp/files.el | 6 -- lisp/gnus/gnus-msg.el | 44 +------------ lisp/gnus/gnus-registry.el | 3 - lisp/gnus/gnus.el | 15 ----- lisp/gnus/nnimap.el | 3 - lisp/iimage.el | 3 - lisp/image.el | 9 --- lisp/mail/emacsbug.el | 3 - lisp/mail/mail-utils.el | 11 +--- lisp/mail/mailalias.el | 29 +-------- lisp/mail/rmail.el | 14 ---- lisp/mail/sendmail.el | 40 ------------ lisp/mail/smtpmail.el | 2 - lisp/menu-bar.el | 3 - lisp/minibuffer.el | 25 +------ lisp/msb.el | 3 - lisp/obsolete/eieio-compat.el | 15 ----- lisp/obsolete/info-edit.el | 1 - lisp/obsolete/starttls.el | 3 - lisp/progmodes/cfengine.el | 9 --- lisp/progmodes/cwarn.el | 3 - lisp/progmodes/make-mode.el | 1 - lisp/progmodes/meta-mode.el | 3 - lisp/progmodes/pascal.el | 15 ----- lisp/progmodes/prolog.el | 10 +-- lisp/progmodes/python.el | 1 - lisp/progmodes/which-func.el | 3 - lisp/simple.el | 33 ++++------ lisp/speedbar.el | 4 -- lisp/strokes.el | 2 - lisp/subr.el | 5 -- lisp/term/ns-win.el | 6 -- lisp/term/w32-win.el | 1 - lisp/term/x-win.el | 3 - lisp/textmodes/bibtex.el | 11 ---- lisp/textmodes/reftex-index.el | 4 -- lisp/textmodes/reftex-sel.el | 4 -- lisp/textmodes/reftex-toc.el | 1 - lisp/textmodes/rst.el | 145 ++++++++++------------------------------- lisp/vc/vc-hooks.el | 9 --- lisp/view.el | 46 ------------- src/keyboard.c | 18 ----- src/w32fns.c | 8 --- 66 files changed, 114 insertions(+), 796 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi index 107d036202e..59b7930732f 100644 --- a/doc/lispref/hooks.texi +++ b/doc/lispref/hooks.texi @@ -290,7 +290,6 @@ auto-fill-function command-error-function compose-chars-after-function composition-function-table -deferred-action-function input-method-function load-read-function load-source-file-function diff --git a/etc/NEWS b/etc/NEWS index 226af8d7d6a..1e6fb06bdcc 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2247,6 +2247,53 @@ Use 'exif-parse-file' and 'exif-field' instead. ** 'insert-directory' alternatives should not change the free disk space line. This change is now applied in 'dired-insert-directory'. +--- +** Some functions and variables obsolete since Emacs 24 have been removed: +'Info-edit-map', 'allout-abbreviate-flattened-numbering', +'allout-mode-deactivate-hook', 'ansi-color-unfontify-region', +'auth-source-forget-user-or-password', 'auth-source-hide-passwords', +'auth-source-user-or-password', 'bibtex-complete', +'bibtex-entry-field-alist', 'byte-compile-disable-print-circle', +'cfengine-mode-abbrevs', 'chart-map', 'comint-dynamic-complete', +'comint-dynamic-complete-as-filename', +'comint-dynamic-simple-complete', 'command-history-map', +'completion-annotate-function', 'condition-case-no-debug', +'count-lines-region', 'data-debug-map', 'deferred-action-list', +'deferred-action-function', 'dired-x-submit-report', +'eieio-defgeneric', 'eieio-defmethod', 'emacs-lock-from-exiting', +'erc-complete-word', 'eshell-cmpl-suffix-list', 'eshell-for', +'gnus-carpal', 'gnus-debug-exclude-variables', 'gnus-debug-files', +'gnus-local-domain', 'gnus-outgoing-message-group', +'gnus-registry-user-format-function-M', 'image-extension-data', +'image-library-alist', 'inhibit-first-line-modes-regexps', +'inhibit-first-line-modes-suffixes', 'intdos', +'mail-complete-function', 'mail-completion-at-point-function', +'mail-mailer-swallows-blank-line', 'mail-sent-via', 'make-register', +'makefile-complete', 'menu-bar-kill-ring-save', +'meta-complete-symbol', 'meta-mode-map', +'minibuffer-completing-symbol', +'minibuffer-local-filename-must-match-map', 'mode25', 'mode4350', +'msb-after-load-hooks', 'nnimap-split-rule', 'ns-alternatives-map', +'ns-store-cut-buffer-internal', 'package-menu-view-commentary', +'pascal-last-completions', 'pascal-show-completions', +'pascal-toggle-completions', 'prolog-char-quote-workaround', +'read-filename-at-point', 'reftex-index-map', +'reftex-index-phrases-map', 'reftex-select-bib-map', +'reftex-select-label-map', 'reftex-toc-map', 'register-name-alist', +'register-value', 'report-emacs-bug-pretest-address', +'rmail-default-dont-reply-to-names', 'rmail-dont-reply-to', +'rmail-dont-reply-to-names', 'rst-block-face', 'rst-comment-face', +'rst-definition-face', 'rst-directive-face', 'rst-emphasis1-face', +'rst-emphasis2-face', 'rst-external-face', 'rst-literal-face', +'rst-reference-face', 'semantic-grammar-map', +'semantic-grammar-syntax-table', 'set-register-value', +'speedbar-key-map', 'speedbar-syntax-table', +'starttls-any-program-available', 'strokes-report-bug', +'toggle-emacs-lock', 'turn-on-cwarn-mode', 'turn-on-iimage-mode', +'vc-toggle-read-only', 'view-return-to-alist', +'view-return-to-alist-update', 'w32-default-color-map' (function), +'which-func-mode' (function), 'x-cut-buffer-or-selection-value'. + --- ** Some functions and variables obsolete since Emacs 23 have been removed: 'find-emacs-lisp-shadows', 'newsticker-cache-filename', diff --git a/lisp/allout.el b/lisp/allout.el index de8ee85b391..e07bac4ef99 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -733,8 +733,6 @@ Set this var to the bullet you want to use for file cross-references." (put 'allout-presentation-padding 'safe-local-variable #'integerp) ;;;_ = allout-flattened-numbering-abbreviation -(define-obsolete-variable-alias 'allout-abbreviate-flattened-numbering - 'allout-flattened-numbering-abbreviation "24.1") (defcustom allout-flattened-numbering-abbreviation nil "If non-nil, `allout-flatten-exposed-to-buffer' abbreviates topic numbers to minimal amount with some context. Otherwise, entire @@ -1350,11 +1348,6 @@ their settings before `allout-mode' was started." ;;;_ = allout-mode-hook (defvar allout-mode-hook nil "Hook run when allout mode starts.") -;;;_ = allout-mode-deactivate-hook -(define-obsolete-variable-alias 'allout-mode-deactivate-hook - 'allout-mode-off-hook "24.1") -(defvar allout-mode-deactivate-hook nil - "Hook run when allout mode ends.") ;;;_ = allout-exposure-category (defvar allout-exposure-category nil "Symbol for use as allout invisible-text overlay category.") @@ -1779,7 +1772,6 @@ hooks, by which independent code can cooperate with allout without changes to the allout core. Here are key ones: `allout-mode-hook' -`allout-mode-deactivate-hook' (deprecated) `allout-mode-off-hook' `allout-exposure-change-functions' `allout-structure-added-functions' diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index d5db9ecfed0..6f1c270c239 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -456,9 +456,6 @@ variable, and is meant to be used in `compilation-filter-hook'." (_ (ansi-color-apply-on-region compilation-filter-start (point)))))) -(define-obsolete-function-alias 'ansi-color-unfontify-region - 'font-lock-default-unfontify-region "24.1") - ;; Working with strings (defvar-local ansi-color-context nil "Context saved between two calls to `ansi-color-apply'. diff --git a/lisp/auth-source.el b/lisp/auth-source.el index fc62e36dfc2..12da2c3d73d 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -164,8 +164,6 @@ Overrides `password-cache-expiry' through a let-binding." (defvar auth-source-creation-prompts nil "Default prompts for token values. Usually let-bound.") -(make-obsolete 'auth-source-hide-passwords nil "24.1") - (defcustom auth-source-save-behavior 'ask "If set, auth-source will respect it for save behavior." :version "23.2" ;; No Gnus @@ -2325,89 +2323,6 @@ See `auth-source-search' for details on SPEC." (push item all))) (nreverse all))) -;;; older API - -;; (auth-source-user-or-password '("login" "password") "imap.myhost.com" t "tzz") - -;; deprecate the old interface -(make-obsolete 'auth-source-user-or-password - 'auth-source-search "24.1") -(make-obsolete 'auth-source-forget-user-or-password - 'auth-source-forget "24.1") - -(defun auth-source-user-or-password - (mode host port &optional username create-missing delete-existing) - "Find MODE (string or list of strings) matching HOST and PORT. - -DEPRECATED in favor of `auth-source-search'! - -USERNAME is optional and will be used as \"login\" in a search -across the Secret Service API (see secrets.el) if the resulting -items don't have a username. This means that if you search for -username \"joe\" and it matches an item but the item doesn't have -a :user attribute, the username \"joe\" will be returned. - -A non-nil DELETE-EXISTING means deleting any matching password -entry in the respective sources. This is useful only when -CREATE-MISSING is non-nil as well; the intended use case is to -remove wrong password entries. - -If no matching entry is found, and CREATE-MISSING is non-nil, -the password will be retrieved interactively, and it will be -stored in the password database which matches best (see -`auth-sources'). - -MODE can be \"login\" or \"password\"." - (auth-source-do-debug - "auth-source-user-or-password: DEPRECATED get %s for %s (%s) + user=%s" - mode host port username) - - (let* ((listy (listp mode)) - (mode (if listy mode (list mode))) - ;; (cname (if username - ;; (format "%s %s:%s %s" mode host port username) - ;; (format "%s %s:%s" mode host port))) - (search (list :host host :port port)) - (search (if username (append search (list :user username)) search)) - (search (if create-missing - (append search (list :create t)) - search)) - (search (if delete-existing - (append search (list :delete t)) - search)) - ;; (found (if (not delete-existing) - ;; (gethash cname auth-source-cache) - ;; (remhash cname auth-source-cache) - ;; nil))) - (found nil)) - (if found - (progn - (auth-source-do-debug - "auth-source-user-or-password: DEPRECATED cached %s=%s for %s (%s) + %s" - mode - ;; don't show the password - (if (and (member "password" mode) t) - "SECRET" - found) - host port username) - found) ; return the found data - ;; else, if not found, search with a max of 1 - (let ((choice (nth 0 (apply #'auth-source-search - (append '(:max 1) search))))) - (when choice - (dolist (m mode) - (cond - ((equal "password" m) - (push (if (plist-get choice :secret) - (funcall (plist-get choice :secret)) - nil) found)) - ((equal "login" m) - (push (plist-get choice :user) found))))) - (setq found (nreverse found)) - (setq found (if listy found (car-safe found))))) - - found)) - (defun auth-source-user-and-password (host &optional user) (let* ((auth-info (car (if user diff --git a/lisp/cedet/data-debug.el b/lisp/cedet/data-debug.el index 0edc853edda..e7635c0aec5 100644 --- a/lisp/cedet/data-debug.el +++ b/lisp/cedet/data-debug.el @@ -854,7 +854,6 @@ If PARENT is non-nil, it is somehow related as a parent to thing." table) "Syntax table used in data-debug macro buffers.") -(define-obsolete-variable-alias 'data-debug-map 'data-debug-mode-map "24.1") (defvar data-debug-mode-map (let ((km (make-sparse-keymap))) (suppress-keymap km) @@ -1028,11 +1027,9 @@ Do nothing if already contracted." (defun data-debug-edebug-expr (expr) "Dump out the contents of some expression EXPR in edebug with ddebug." (interactive - (list (let ((minibuffer-completing-symbol t)) - (read-from-minibuffer "Eval: " - nil read-expression-map t - 'read-expression-history)) - )) + (list (read-from-minibuffer "Eval: " + nil read-expression-map t + 'read-expression-history))) (let ((v (eval expr t))) (if (not v) (message "Expression %s is nil." expr) @@ -1043,10 +1040,9 @@ Do nothing if already contracted." If the result is something simple, show it in the echo area. If the result is a list or vector, then use the data debugger to display it." (interactive - (list (let ((minibuffer-completing-symbol t)) - (read-from-minibuffer "Eval: " - nil read-expression-map t - 'read-expression-history)))) + (list (read-from-minibuffer "Eval: " + nil read-expression-map t + 'read-expression-history))) (let (result) (if (null eval-expression-debug-on-error) diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index 74d4a229fac..97456265ead 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -1123,8 +1123,6 @@ END is the limit of the search." ;;;; Define major mode ;;;; -(define-obsolete-variable-alias 'semantic-grammar-syntax-table - 'semantic-grammar-mode-syntax-table "24.1") (defvar semantic-grammar-mode-syntax-table (let ((table (make-syntax-table (standard-syntax-table)))) (modify-syntax-entry ?\: "." table) ;; COLON @@ -1197,8 +1195,6 @@ END is the limit of the search." semantic-grammar-mode-keywords-1 "Font Lock keywords used to highlight Semantic grammar buffers.") -(define-obsolete-variable-alias 'semantic-grammar-map - 'semantic-grammar-mode-map "24.1") (defvar semantic-grammar-mode-map (let ((km (make-sparse-keymap))) diff --git a/lisp/chistory.el b/lisp/chistory.el index 33b21422114..9dce60a19fe 100644 --- a/lisp/chistory.el +++ b/lisp/chistory.el @@ -119,8 +119,6 @@ The buffer is left in Command History mode." (error "No command history") (command-history-mode))))) -(define-obsolete-variable-alias 'command-history-map - 'command-history-mode-map "24.1") (defvar command-history-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map (make-composed-keymap lisp-mode-shared-map diff --git a/lisp/comint.el b/lisp/comint.el index 7e22aa78fce..d52623c00ae 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -3299,10 +3299,6 @@ Magic characters are those in `comint-file-name-quote-list'." (defun comint-completion-at-point () (run-hook-with-args-until-success 'comint-dynamic-complete-functions)) -(define-obsolete-function-alias - 'comint-dynamic-complete - 'completion-at-point "24.1") - (defun comint-dynamic-complete-filename () "Dynamically complete the filename at point. Completes if after a filename. @@ -3383,13 +3379,6 @@ See `completion-table-with-quoting' and `comint-unquote-function'.") (goto-char (match-end 0)) (insert filesuffix))))))))) -(defun comint-dynamic-complete-as-filename () - "Dynamically complete at point as a filename. -See `comint-dynamic-complete-filename'. Returns t if successful." - (declare (obsolete comint-filename-completion "24.1")) - (let ((data (comint--complete-file-name-data))) - (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data)))) - (defun comint-replace-by-expanded-filename () "Dynamically expand and complete the filename at point. Replace the filename with an expanded, canonicalized and @@ -3404,65 +3393,6 @@ filename absolute. For expansion see `expand-file-name' and (replace-match (expand-file-name filename) t t) (comint-dynamic-complete-filename)))) - -(defun comint-dynamic-simple-complete (stub candidates) - "Dynamically complete STUB from CANDIDATES list. -This function inserts completion characters at point by -completing STUB from the strings in CANDIDATES. If completion is -ambiguous, possibly show a completions listing in a separate -buffer. - -Return nil if no completion was inserted. -Return `sole' if completed with the only completion match. -Return `shortest' if completed with the shortest match. -Return `partial' if completed as far as possible. -Return `listed' if a completion listing was shown. - -See also `comint-dynamic-complete-filename'." - (declare (obsolete completion-in-region "24.1")) - (let* ((completion-ignore-case (memq system-type '(ms-dos windows-nt cygwin))) - (minibuffer-p (window-minibuffer-p)) - (suffix (cond ((not comint-completion-addsuffix) "") - ((not (consp comint-completion-addsuffix)) " ") - (t (cdr comint-completion-addsuffix)))) - (completions (all-completions stub candidates))) - (cond ((null completions) - (if minibuffer-p - (minibuffer-message "No completions of %s" stub) - (message "No completions of %s" stub)) - nil) - ((= 1 (length completions)) ; Gotcha! - (let ((completion (car completions))) - (if (string-equal completion stub) - (unless minibuffer-p - (message "Sole completion")) - (insert (substring completion (length stub))) - (unless minibuffer-p - (message "Completed"))) - (insert suffix) - 'sole)) - (t ; There's no unique completion. - (let ((completion (try-completion stub candidates))) - ;; Insert the longest substring. - (insert (substring completion (length stub))) - (cond ((and comint-completion-recexact comint-completion-addsuffix - (string-equal stub completion) - (member completion completions)) - ;; It's not unique, but user wants shortest match. - (insert suffix) - (unless minibuffer-p - (message "Completed shortest")) - 'shortest) - ((or comint-completion-autolist - (string-equal stub completion)) - ;; It's not unique, list possible completions. - (comint-dynamic-list-completions completions stub) - 'listed) - (t - (unless minibuffer-p - (message "Partially completed")) - 'partial))))))) - (defun comint-dynamic-list-filename-completions () "Display a list of possible completions for the filename at point." (interactive) diff --git a/lisp/dired-x.el b/lisp/dired-x.el index db5a93b60c3..1e1bf9efd68 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -1531,13 +1531,6 @@ If `current-prefix-arg' is non-nil, uses name at point as guess." nil (file-name-nondirectory guess))) (read-file-name prompt default-directory))) -(define-obsolete-function-alias 'read-filename-at-point - 'dired-x-read-filename-at-point "24.1") ; is this even needed? - - -;;; Epilog - -(define-obsolete-function-alias 'dired-x-submit-report 'report-emacs-bug "24.1") (define-obsolete-function-alias 'dired-man #'dired-do-man "29.1") (define-obsolete-function-alias 'dired-info #'dired-do-info "29.1") diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el index ea54eea6036..edbe9e494f1 100644 --- a/lisp/dos-fns.el +++ b/lisp/dos-fns.el @@ -231,9 +231,6 @@ returned unaltered." (add-hook 'before-init-hook 'dos-reevaluate-defcustoms) -(define-obsolete-variable-alias - 'register-name-alist 'dos-register-name-alist "24.1") - (defvar dos-register-name-alist '((ax . 0) (bx . 1) (cx . 2) (dx . 3) (si . 4) (di . 5) (cflag . 6) (flags . 7) @@ -243,8 +240,6 @@ returned unaltered." (defun dos-make-register () (make-vector 8 0)) -(define-obsolete-function-alias 'make-register 'dos-make-register "24.1") - (defun dos-register-value (regs name) (let ((where (cdr (assoc name dos-register-name-alist)))) (cond ((consp where) @@ -256,8 +251,6 @@ returned unaltered." (aref regs where)) (t nil)))) -(define-obsolete-function-alias 'register-value 'dos-register-value "24.1") - (defun dos-set-register-value (regs name value) (and (numberp value) (>= value 0) @@ -274,9 +267,6 @@ returned unaltered." (aset regs where (logand value 65535)))))) regs) -(define-obsolete-function-alias - 'set-register-value 'dos-set-register-value "24.1") - (defsubst dos-intdos (regs) "Issue the DOS Int 21h with registers REGS. @@ -284,8 +274,6 @@ REGS should be a vector produced by `dos-make-register' and `dos-set-register-value', which see." (int86 33 regs)) -(define-obsolete-function-alias 'intdos 'dos-intdos "24.1") - ;; Backward compatibility for obsolescent functions which ;; set screen size. @@ -294,8 +282,6 @@ and `dos-set-register-value', which see." (interactive) (set-frame-size (selected-frame) 80 25)) -(define-obsolete-function-alias 'mode25 'dos-mode25 "24.1") - (defun dos-mode4350 () "Change the number of rows to 43 or 50. Emacs always tries to set the screen height to 50 rows first. @@ -307,8 +293,6 @@ that your video hardware might not support 50-line mode." nil ; the original built-in function returned nil (set-frame-size (selected-frame) 80 43))) -(define-obsolete-function-alias 'mode4350 'dos-mode4350 "24.1") - (provide 'dos-fns) ;;; dos-fns.el ends here diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 5ef517d7e32..8df4133b6b0 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -244,11 +244,6 @@ the functions you loaded will not be able to run.") (make-obsolete-variable 'byte-compile-dynamic "not worthwhile any more." "27.1") ;;;###autoload(put 'byte-compile-dynamic 'safe-local-variable 'booleanp) -(defvar byte-compile-disable-print-circle nil - "If non-nil, disable `print-circle' on printing a byte-compiled code.") -(make-obsolete-variable 'byte-compile-disable-print-circle nil "24.1") -;;;###autoload(put 'byte-compile-disable-print-circle 'safe-local-variable 'booleanp) - (defcustom byte-compile-dynamic-docstrings t "If non-nil, compile doc strings for lazy access. We bury the doc strings of functions and variables inside comments in @@ -2423,8 +2418,7 @@ Call from the source buffer." (print-level nil) (print-quoted t) (print-gensym t) - (print-circle ; Handle circular data structures. - (not byte-compile-disable-print-circle))) + (print-circle t)) ; Handle circular data structures. (if (and (memq (car-safe form) '(defvar defvaralias defconst autoload custom-declare-variable)) (stringp (nth 3 form))) @@ -2482,8 +2476,7 @@ list that represents a doc string reference. (print-level nil) (print-quoted t) (print-gensym t) - (print-circle ; Handle circular data structures. - (not byte-compile-disable-print-circle))) + (print-circle t)) ; Handle circular data structures. (if preface (progn ;; FIXME: We don't handle uninterned names correctly. diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index 29fbcce7734..716b236d3ab 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -63,7 +63,6 @@ (eval-when-compile (require 'cl-generic)) ;;; Code: -(define-obsolete-variable-alias 'chart-map 'chart-mode-map "24.1") (defvar chart-mode-map (make-sparse-keymap) "Keymap used in chart mode.") (defvar-local chart-local-object nil diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index d9864e6965d..25f2dd40980 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -24,8 +24,8 @@ ;;; Commentary: ;; ;; The "core" part of EIEIO is the implementation for the object -;; system (such as eieio-defclass, or eieio-defmethod) but not the -;; base classes for the object system, which are defined in EIEIO. +;; system (such as eieio-defclass-internal, or cl-defmethod) but not +;; the base classes for the object system, which are defined in EIEIO. ;; ;; See the commentary for eieio.el for more about EIEIO itself. diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index de18adff5b8..ae72a47c2fc 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -158,9 +158,6 @@ test for `called-interactively' in the command will fail." (run-hooks 'pre-command-hook) (setq return-value (apply (car command) (cdr command))) (run-hooks 'post-command-hook) - (and (boundp 'deferred-action-list) - deferred-action-list - (run-hooks 'deferred-action-function)) (setq real-last-command (car command) last-command this-command) (when (boundp 'last-repeatable-command) diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 641ce0d5c02..4b85414943a 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -943,14 +943,7 @@ character." (defun field-complete (table &optional predicate) (declare (obsolete completion-in-region "24.4")) (let ((minibuffer-completion-table table) - (minibuffer-completion-predicate predicate) - ;; This made sense for lisp-complete-symbol, but for - ;; field-complete, this is out of place. --Stef - ;; (completion-annotate-function - ;; (unless (eq predicate 'fboundp) - ;; (lambda (str) - ;; (if (fboundp (intern-soft str)) " ")))) - ) + (minibuffer-completion-predicate predicate)) (call-interactively 'minibuffer-complete))) (defun lisp-complete-symbol (&optional _predicate) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index c8b66675970..8d0d5d57a22 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -3520,9 +3520,6 @@ The full list of keys can be viewed with \\[describe-mode]." (message (mapconcat #'package--prettify-quick-help-key package--quick-help-keys "\n"))) -(define-obsolete-function-alias - 'package-menu-view-commentary 'package-menu-describe-package "24.1") - (defun package-menu-get-status () "Return status text of package at point in Package Menu." (package--ensure-package-menu-mode) diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el index 7377ac94039..c2f6c162269 100644 --- a/lisp/emacs-lisp/trace.el +++ b/lisp/emacs-lisp/trace.el @@ -275,10 +275,9 @@ If `current-prefix-arg' is non-nil, also read a buffer and a \"context\" (list (read-buffer "Output to buffer" trace-buffer) (let ((exp - (let ((minibuffer-completing-symbol t)) - (read-from-minibuffer "Context expression: " - nil read-expression-map t - 'read-expression-history)))) + (read-from-minibuffer "Context expression: " + nil read-expression-map t + 'read-expression-history))) (lambda () (let ((print-circle t) (print-escape-newlines t)) diff --git a/lisp/emacs-lock.el b/lisp/emacs-lock.el index 3d2eda99a9c..1818e22a923 100644 --- a/lisp/emacs-lock.el +++ b/lisp/emacs-lock.el @@ -88,9 +88,6 @@ The functions get one argument, the first locked buffer found." :group 'emacs-lock :version "24.3") -(define-obsolete-variable-alias 'emacs-lock-from-exiting - 'emacs-lock-mode "24.1") - (defvar-local emacs-lock-mode nil "If non-nil, the current buffer is locked. It can be one of the following values: @@ -247,14 +244,6 @@ some major modes from being locked under some circumstances." ;; continue standard unloading nil)) -;;; Compatibility - -(defun toggle-emacs-lock () - "Toggle `emacs-lock-from-exiting' for the current buffer." - (declare (obsolete emacs-lock-mode "24.1")) - (interactive) - (call-interactively 'emacs-lock-mode)) - (provide 'emacs-lock) ;;; emacs-lock.el ends here diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 239d8ebdcb6..0a16831fba3 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -4566,8 +4566,6 @@ This places `point' just after the prompt, or at the beginning of the line." (defun erc-complete-word-at-point () (run-hook-with-args-until-success 'erc-complete-functions)) -(define-obsolete-function-alias 'erc-complete-word #'completion-at-point "24.1") - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; IRC SERVER INPUT HANDLING diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index f4c1302629b..822cc941491 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el @@ -158,14 +158,6 @@ to writing a completion function." (eshell-cmpl--custom-variable-docstring 'pcomplete-autolist) :type (get 'pcomplete-autolist 'custom-type)) -(defcustom eshell-cmpl-suffix-list (list ?/ ?:) - (eshell-cmpl--custom-variable-docstring 'pcomplete-suffix-list) - :type (get 'pcomplete-suffix-list 'custom-type) - :group 'pcomplete) -;; Only labeled obsolete in 26.1, but all it does it set -;; pcomplete-suffix-list, which is itself obsolete since 24.1. -(make-obsolete-variable 'eshell-cmpl-suffix-list nil "24.1") - (defcustom eshell-cmpl-recexact nil (eshell-cmpl--custom-variable-docstring 'pcomplete-recexact) :type (get 'pcomplete-recexact 'custom-type)) @@ -262,9 +254,6 @@ to writing a completion function." eshell-cmpl-ignore-case) (setq-local pcomplete-autolist eshell-cmpl-autolist) - (if (boundp 'pcomplete-suffix-list) - (setq-local pcomplete-suffix-list - eshell-cmpl-suffix-list)) (setq-local pcomplete-recexact eshell-cmpl-recexact) (setq-local pcomplete-man-function diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 6b864983995..5144e305121 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el @@ -301,15 +301,6 @@ Prepend remote identification of `default-directory', if any." (setq text (replace-match " " t t text))) text)) -(defmacro eshell-for (for-var for-list &rest forms) - "Iterate through a list." - (declare (obsolete dolist "24.1") (indent 2)) - `(let ((list-iter ,for-list)) - (while list-iter - (let ((,for-var (car list-iter))) - ,@forms) - (setq list-iter (cdr list-iter))))) - (define-obsolete-function-alias 'eshell-flatten-list #'flatten-tree "27.1") (defun eshell-stringify (object) diff --git a/lisp/files-x.el b/lisp/files-x.el index 8224a574507..da1e44e2504 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -81,8 +81,7 @@ Intended to be used in the `interactive' spec of (let ((default (format "%S" (cond ((eq variable 'unibyte) t) ((boundp variable) - (symbol-value variable))))) - (minibuffer-completing-symbol t)) + (symbol-value variable)))))) (read-from-minibuffer (format "Add %s with value: " variable) nil read-expression-map t 'set-variable-value-history diff --git a/lisp/files.el b/lisp/files.el index 992f9879437..2ea9d1e4673 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3161,9 +3161,6 @@ major mode MODE. See also `auto-mode-alist'.") -(define-obsolete-variable-alias 'inhibit-first-line-modes-regexps - 'inhibit-file-local-variables-regexps "24.1") - ;; TODO really this should be a list of modes (eg tar-mode), not regexps, ;; because we are duplicating info from auto-mode-alist. ;; TODO many elements of this list are also in auto-coding-alist. @@ -3184,9 +3181,6 @@ member files with their own local variable sections, which are not appropriate for the containing file. The function `inhibit-local-variables-p' uses this.") -(define-obsolete-variable-alias 'inhibit-first-line-modes-suffixes - 'inhibit-local-variables-suffixes "24.1") - (defvar inhibit-local-variables-suffixes nil "List of regexps matching suffixes to remove from file names. The function `inhibit-local-variables-p' uses this: when checking diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 17a87134be0..3fc5ce2408a 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -52,24 +52,6 @@ method to use when posting." (const current) (sexp :tag "Methods" ,gnus-select-method))) -(defcustom gnus-outgoing-message-group nil - "All outgoing messages will be put in this group. -If you want to store all your outgoing mail and articles in the group -\"nnml:archive\", you set this variable to that value. This variable -can also be a list of group names. - -If you want to have greater control over what group to put each -message in, you can set this variable to a function that checks the -current newsgroup name and then returns a suitable group name (or list -of names)." - :group 'gnus-message - :type '(choice (const nil) - (function) - (string :tag "Group") - (repeat :tag "List of groups" (string :tag "Group")))) - -(make-obsolete-variable 'gnus-outgoing-message-group 'gnus-message-archive-group "24.1") - (defcustom gnus-mailing-list-groups nil "If non-nil a regexp matching groups that are really mailing lists. This is useful when you're reading a mailing list that has been @@ -215,30 +197,6 @@ use this option with care." :parameter-document "\ List of charsets that are permitted to be unencoded.") -(defcustom gnus-debug-files - '("gnus.el" "gnus-sum.el" "gnus-group.el" - "gnus-art.el" "gnus-start.el" "gnus-async.el" - "gnus-msg.el" "gnus-score.el" "gnus-win.el" "gnus-topic.el" - "gnus-agent.el" "gnus-cache.el" "gnus-srvr.el" - "mm-util.el" "mm-decode.el" "nnmail.el" "message.el") - "Files whose variables will be reported in `gnus-bug'." - :version "22.1" - :group 'gnus-message - :type '(repeat file)) - -(make-obsolete-variable 'gnus-debug-files "it is no longer used." "24.1") - -(defcustom gnus-debug-exclude-variables - '(mm-mime-mule-charset-alist - nnmail-split-fancy message-minibuffer-local-map) - "Variables that should not be reported in `gnus-bug'." - :version "22.1" - :group 'gnus-message - :type '(repeat variable)) - -(make-obsolete-variable - 'gnus-debug-exclude-variables "it is no longer used." "24.1") - (defcustom gnus-discouraged-post-methods '(nndraft nnml nnimap nnmaildir nnmh nnfolder nndir) "A list of back ends that are not used in \"real\" newsgroups. @@ -1665,7 +1623,7 @@ this is a reply." (defun gnus-inews-insert-gcc (&optional group) "Insert the Gcc to say where the article is to be archived." (let* ((group (or group gnus-newsgroup-name)) - (var (or gnus-outgoing-message-group gnus-message-archive-group)) + (var gnus-message-archive-group) (gcc-self-val (and group (not (gnus-virtual-group-p group)) (gnus-group-find-parameter group 'gcc-self t))) diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 8cefb09b66a..ceeb1848542 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -1004,9 +1004,6 @@ Uses `gnus-registry-marks' to find what shortcuts to install." nil (cons "Registry Marks" gnus-registry-misc-menus))))) -(define-obsolete-function-alias 'gnus-registry-user-format-function-M - #'gnus-registry-article-marks-to-chars "24.1") - ;; use like this: ;; (defalias 'gnus-user-format-function-M #'gnus-registry-article-marks-to-chars) (defun gnus-registry-article-marks-to-chars (headers) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 2119e68509e..7eea08f1744 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -1130,16 +1130,6 @@ you could set this variable: :group 'gnus-server :type '(repeat gnus-select-method)) -(defcustom gnus-local-domain nil - "Local domain name without a host name. -The DOMAINNAME environment variable is used instead if it is defined. -If the function `system-name' returns the full Internet name, there is -no need to set this variable." - :group 'gnus-message - :type '(choice (const :tag "default" nil) - string)) -(make-obsolete-variable 'gnus-local-domain nil "24.1") - ;; Customization variables (defcustom gnus-refer-article-method 'current @@ -2316,11 +2306,6 @@ automatically cache the article in the agent cache." (defvar gnus-server-method-cache nil) (defvar gnus-extended-servers nil) -;; The carpal mode has been removed, but define the variable for -;; backwards compatibility. -(defvar gnus-carpal nil) -(make-obsolete-variable 'gnus-carpal nil "24.1") - (defvar gnus-agent-fetching nil "Whether Gnus agent is in fetching mode.") diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index c629cb85d96..746109f26fa 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -95,9 +95,6 @@ Uses the same syntax as `nnmail-split-methods'.") (defvoo nnimap-unsplittable-articles '(%Deleted %Seen) "Articles with the flags in the list will not be considered when splitting.") -(make-obsolete-variable 'nnimap-split-rule "see `nnimap-split-methods'." - "24.1") - (defvoo nnimap-authenticator nil "How nnimap authenticate itself to the server. Possible choices are nil (use default methods), `anonymous', diff --git a/lisp/iimage.el b/lisp/iimage.el index 8a765d5e5d5..baeb4bb6a7b 100644 --- a/lisp/iimage.el +++ b/lisp/iimage.el @@ -87,9 +87,6 @@ Examples of image filename patterns to match: (iimage-mode-buffer t) (recenter-top-bottom arg)) -;;;###autoload -(define-obsolete-function-alias 'turn-on-iimage-mode 'iimage-mode "24.1") - (defun turn-off-iimage-mode () "Unconditionally turn off iimage mode." (interactive) diff --git a/lisp/image.el b/lisp/image.el index e90cccaa096..bdaaec608ef 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -446,15 +446,6 @@ type if we can't otherwise guess it." (error "Invalid image type `%s'" type)) type) - -(if (fboundp 'image-metadata) ; eg not --without-x - (define-obsolete-function-alias 'image-extension-data - 'image-metadata "24.1")) - -(define-obsolete-variable-alias - 'image-library-alist - 'dynamic-library-alist "24.1") - ;;;###autoload (defun image-type-available-p (type) "Return t if image type TYPE is available. diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index 9d2e20ae04b..d743802eade 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -42,9 +42,6 @@ :group 'maint :group 'mail) -(define-obsolete-variable-alias 'report-emacs-bug-pretest-address - 'report-emacs-bug-address "24.1") - (defcustom report-emacs-bug-no-confirmation nil "If non-nil, suppress the confirmations asked for the sake of novice users." :type 'boolean) diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el index 952970d07c0..9ea2cc92e94 100644 --- a/lisp/mail/mail-utils.el +++ b/lisp/mail/mail-utils.el @@ -239,12 +239,8 @@ comma-separated list, and return the pruned list." ;; Or just set the default directly in the defcustom. (if (null mail-dont-reply-to-names) (setq mail-dont-reply-to-names - ;; `rmail-default-dont-reply-to-names' is obsolete. - (let ((a (bound-and-true-p rmail-default-dont-reply-to-names)) - (b (if (> (length user-mail-address) 0) - (concat "\\`" (regexp-quote user-mail-address) "\\'")))) - (cond ((and a b) (concat a "\\|" b)) - ((or a b)))))) + (if (> (length user-mail-address) 0) + (concat "\\`" (regexp-quote user-mail-address) "\\'")))) ;; Split up DESTINATIONS and match each element separately. (let ((start-pos 0) (cur-pos 0) (case-fold-search t)) @@ -281,9 +277,6 @@ comma-separated list, and return the pruned list." (substring destinations (match-end 0)) destinations)) -;; Legacy name -(define-obsolete-function-alias 'rmail-dont-reply-to #'mail-dont-reply-to "24.1") - ;;;###autoload (defun mail-fetch-field (field-name &optional last all list delete) diff --git a/lisp/mail/mailalias.el b/lisp/mail/mailalias.el index ba7cf58d383..c97786190c3 100644 --- a/lisp/mail/mailalias.el +++ b/lisp/mail/mailalias.el @@ -72,8 +72,7 @@ When t this still needs to be initialized.") ) "Alist of header field and expression to return alist for completion. The expression may reference the variable `pattern' -which will hold the string being completed. -If not on matching header, `mail-complete-function' gets called instead." +which will hold the string being completed." :type 'alist :group 'mailalias) (put 'mail-complete-alist 'risky-local-variable t) @@ -90,13 +89,6 @@ If `angles', they look like: :type '(choice (const angles) (const parens) (const nil)) :group 'mailalias) -(defcustom mail-complete-function 'ispell-complete-word - "Function to call when completing outside `mail-complete-alist'-header." - :type '(choice function (const nil)) - :group 'mailalias) -(make-obsolete-variable 'mail-complete-function - 'completion-at-point-functions "24.1") - (defcustom mail-directory-function nil "Function to get completions from directory service or nil for none. See `mail-directory-requery'." @@ -433,25 +425,6 @@ For use on `completion-at-point-functions'." (let ((pattern prefix)) (eval list-exp)))))) (list beg end table))))) -;;;###autoload -(defun mail-complete (arg) - "Perform completion on header field or word preceding point. -Completable headers are according to `mail-complete-alist'. If none matches -current header, calls `mail-complete-function' and passes prefix ARG if any." - (declare (obsolete mail-completion-at-point-function "24.1")) - (interactive "P") - ;; Read the defaults first, if we have not done so. - (sendmail-sync-aliases) - (if (eq mail-aliases t) - (progn - (setq mail-aliases nil) - (if (file-exists-p mail-personal-alias-file) - (build-mail-aliases)))) - (let ((data (mail-completion-at-point-function))) - (if data - (apply #'completion-in-region data) - (funcall mail-complete-function arg)))) - (defun mail-completion-expand (table) "Build new completion table that expands aliases. Completes like TABLE except that if the completion is a valid alias, diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index b2b21b88ef8..467375dbe1f 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -314,20 +314,6 @@ Setting this variable has an effect only before reading a mail." :group 'rmail-retrieve :version "21.1") -;;;###autoload -(define-obsolete-variable-alias 'rmail-dont-reply-to-names - 'mail-dont-reply-to-names "24.1") - -;; Prior to 24.1, this used to contain "\\`info-". -;;;###autoload -(defvar rmail-default-dont-reply-to-names nil - "Regexp specifying part of the default value of `mail-dont-reply-to-names'. -This is used when the user does not set `mail-dont-reply-to-names' -explicitly.") -;;;###autoload -(make-obsolete-variable 'rmail-default-dont-reply-to-names - 'mail-dont-reply-to-names "24.1") - ;;;###autoload (defcustom rmail-ignored-headers (purecopy diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index c55cdc8412a..6afadca6bb3 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -430,20 +430,6 @@ support Delivery Status Notification." (const :tag "Success" success))) :version "22.1") -;; Note: could use /usr/ucb/mail instead of sendmail; -;; options -t, and -v if not interactive. -(defvar mail-mailer-swallows-blank-line nil - "Set this non-nil if the system's mailer runs the header and body together. -The actual value should be an expression to evaluate that returns -non-nil if the problem will actually occur. -\(As far as we know, this is not an issue on any system still supported -by Emacs.)") - -(put 'mail-mailer-swallows-blank-line 'risky-local-variable t) ; gets evalled -(make-obsolete-variable 'mail-mailer-swallows-blank-line - "no need to set this on any modern system." - "24.1" 'set) - (defvar mail-mode-syntax-table ;; define-derived-mode will make it inherit from text-mode-syntax-table. (let ((st (make-syntax-table))) @@ -1309,8 +1295,6 @@ external program defined by `sendmail-program'." ;; Insert an extra newline if we need it to work around ;; Sun's bug that swallows newlines. (goto-char (1+ delimline)) - (if (eval mail-mailer-swallows-blank-line) - (newline)) ;; Find and handle any Fcc fields. (goto-char (point-min)) (if (re-search-forward "^Fcc:" delimline t) @@ -1495,28 +1479,6 @@ just append to the file, in Babyl format if necessary." (with-current-buffer buffer (set-visited-file-modtime))))))))) -(defun mail-sent-via () - "Make a Sent-via header line from each To or Cc header line." - (declare (obsolete "nobody can remember what it is for." "24.1")) - (interactive) - (save-excursion - ;; put a marker at the end of the header - (let ((end (copy-marker (mail-header-end))) - (case-fold-search t)) - (goto-char (point-min)) - ;; search for the To: lines and make Sent-via: lines from them - ;; search for the next To: line - (while (re-search-forward "^\\(to\\|cc\\):" end t) - ;; Grab this line plus all its continuations, sans the `to:'. - (let ((to-line - (buffer-substring (point) - (progn - (if (re-search-forward "^[^ \t\n]" end t) - (backward-char 1) - (goto-char end)) - (point))))) - ;; Insert a copy, with altered header field name. - (insert-before-markers "Sent-via:" to-line)))))) (defun mail-to () "Move point to end of To field, creating it if necessary." @@ -1839,8 +1801,6 @@ If the current line has `mail-yank-prefix', insert it on the new line." (or (bolp) (newline)) (goto-char start)))) -(define-obsolete-function-alias 'mail-attach-file #'mail-insert-file "24.1") - (declare-function mml-attach-file "mml" (file &optional type description disposition)) diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index da786dec004..8cba2b14e14 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -342,8 +342,6 @@ for `smtpmail-try-auth-method'.") ;; Insert an extra newline if we need it to work around ;; Sun's bug that swallows newlines. (goto-char (1+ delimline)) - (if (eval mail-mailer-swallows-blank-line t) - (newline)) ;; Find and handle any Fcc fields. (goto-char (point-min)) (if (re-search-forward "^Fcc:" delimline t) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index a134654a020..12a0b4d328f 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -584,9 +584,6 @@ menu)) -(define-obsolete-function-alias - 'menu-bar-kill-ring-save 'kill-ring-save "24.1") - ;; These are alternative definitions for the cut, paste and copy ;; menu items. Use them if your system expects these to use the clipboard. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index e029dfe4147..9d2abbd1180 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2225,25 +2225,6 @@ These include: `exact' - text is a valid completion but may be further completed.") -(defvar completion-annotate-function - nil - ;; Note: there's a lot of scope as for when to add annotations and - ;; what annotations to add. E.g. completing-help.el allowed adding - ;; the first line of docstrings to M-x completion. But there's - ;; a tension, since such annotations, while useful at times, can - ;; actually drown the useful information. - ;; So completion-annotate-function should be used parsimoniously, or - ;; else only used upon a user's request (e.g. we could add a command - ;; to completion-list-mode to add annotations to the current - ;; completions). - "Function to add annotations in the *Completions* buffer. -The function takes a completion and should either return nil, or a string that -will be displayed next to the completion. The function can access the -completion table and predicates via `minibuffer-completion-table' and related -variables.") -(make-obsolete-variable 'completion-annotate-function - 'completion-extra-properties "24.1") - (defun completion--done (string &optional finished message) (let* ((exit-fun (plist-get completion-extra-properties :exit-function)) (pre-msg (and exit-fun (current-message)))) @@ -2314,8 +2295,7 @@ variables.") minibuffer-completion-predicate)) (ann-fun (or (completion-metadata-get all-md 'annotation-function) (plist-get completion-extra-properties - :annotation-function) - completion-annotate-function)) + :annotation-function))) (aff-fun (or (completion-metadata-get all-md 'affixation-function) (plist-get completion-extra-properties :affixation-function))) @@ -2790,9 +2770,6 @@ Gets combined either with `minibuffer-local-completion-map' or with `minibuffer-local-must-match-map'." "SPC" nil) -(defvar minibuffer-local-filename-must-match-map (make-sparse-keymap)) -(make-obsolete-variable 'minibuffer-local-filename-must-match-map nil "24.1") - (defvar-keymap minibuffer-local-ns-map :doc "Local keymap for the minibuffer when spaces are not allowed." :parent minibuffer-local-map diff --git a/lisp/msb.el b/lisp/msb.el index 616799f067b..19f0afed738 100644 --- a/lisp/msb.el +++ b/lisp/msb.el @@ -353,9 +353,6 @@ This is instead of the groups in `msb-menu-cond'." :type 'boolean :set #'msb-custom-set) -(define-obsolete-variable-alias 'msb-after-load-hooks - 'msb-after-load-hook "24.1") - (defcustom msb-after-load-hook nil "Hook run after the msb package has been loaded." :type 'hook diff --git a/lisp/obsolete/eieio-compat.el b/lisp/obsolete/eieio-compat.el index b31bde4efba..2ac75293fcc 100644 --- a/lisp/obsolete/eieio-compat.el +++ b/lisp/obsolete/eieio-compat.el @@ -248,21 +248,6 @@ Summary: (message "next-method-p called outside of a primary or around method") nil) -;;;###autoload -(defun eieio-defmethod (method args) - "Obsolete work part of an old version of the `defmethod' macro." - (declare (obsolete cl-defmethod "24.1")) - (eval `(defmethod ,method ,@args)) - method) - -;;;###autoload -(defun eieio-defgeneric (method doc-string) - "Obsolete work part of an old version of the `defgeneric' macro." - (declare (obsolete cl-defgeneric "24.1")) - (eval `(defgeneric ,method (x) ,@(if doc-string `(,doc-string)))) - ;; Return the method - 'method) - ;;;###autoload (defun eieio-defclass (cname superclasses slots options) (declare (obsolete eieio-defclass-internal "25.1")) diff --git a/lisp/obsolete/info-edit.el b/lisp/obsolete/info-edit.el index 6c1be1078ff..6c4c10ca6c2 100644 --- a/lisp/obsolete/info-edit.el +++ b/lisp/obsolete/info-edit.el @@ -33,7 +33,6 @@ (make-obsolete-variable 'Info-edit-mode-hook "editing Info nodes by hand is not recommended." "24.4") -(define-obsolete-variable-alias 'Info-edit-map 'Info-edit-mode-map "24.1") (defvar Info-edit-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map text-mode-map) (define-key map "\C-c\C-c" #'Info-cease-edit) diff --git a/lisp/obsolete/starttls.el b/lisp/obsolete/starttls.el index 6f0685d3dda..2f1f0e9773c 100644 --- a/lisp/obsolete/starttls.el +++ b/lisp/obsolete/starttls.el @@ -287,9 +287,6 @@ GnuTLS requires a port number." starttls-gnutls-program starttls-program)))) -(define-obsolete-function-alias 'starttls-any-program-available - #'starttls-available-p "24.1") - (provide 'starttls) ;;; starttls.el ends here diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el index 00348ac0bb9..32031d19462 100644 --- a/lisp/progmodes/cfengine.el +++ b/lisp/progmodes/cfengine.el @@ -793,14 +793,6 @@ bundle agent rcfiles (cdr (assq 'functions cfengine3-fallback-syntax))) 'symbols)) -(defcustom cfengine-mode-abbrevs nil - "Abbrevs for CFEngine2 mode." - :type '(repeat (list (string :tag "Name") - (string :tag "Expansion") - (choice :tag "Hook" (const nil) function)))) - -(make-obsolete-variable 'cfengine-mode-abbrevs 'edit-abbrevs "24.1") - ;; Taken from the doc for pre-release 2.1. (eval-and-compile (defconst cfengine2-actions @@ -1409,7 +1401,6 @@ to the action header." (setq-local outline-regexp "[ \t]*\\(\\sw\\|\\s_\\)+:+") (setq-local outline-level #'cfengine2-outline-level) (setq-local fill-paragraph-function #'cfengine-fill-paragraph) - (define-abbrev-table 'cfengine2-mode-abbrev-table cfengine-mode-abbrevs) (setq font-lock-defaults '(cfengine2-font-lock-keywords nil nil nil beginning-of-line)) ;; Fixme: set the args of functions in evaluated classes to string diff --git a/lisp/progmodes/cwarn.el b/lisp/progmodes/cwarn.el index 971e3f6174d..03469b9f55b 100644 --- a/lisp/progmodes/cwarn.el +++ b/lisp/progmodes/cwarn.el @@ -180,9 +180,6 @@ C++ modes are included." (cwarn-font-lock-keywords cwarn-mode) (font-lock-flush)) -;;;###autoload -(define-obsolete-function-alias 'turn-on-cwarn-mode 'cwarn-mode "24.1") - ;;}}} ;;{{{ Help functions diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 91307f6c09f..bd01786e08c 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -1170,7 +1170,6 @@ and adds all qualifying names to the list of known targets." (goto-char (match-end 0)) (insert suffix)))))))) -(define-obsolete-function-alias 'makefile-complete 'completion-at-point "24.1") ;; Backslashification. Stolen from cc-mode.el. diff --git a/lisp/progmodes/meta-mode.el b/lisp/progmodes/meta-mode.el index 34288e0e4fb..f0fd23f3bc3 100644 --- a/lisp/progmodes/meta-mode.el +++ b/lisp/progmodes/meta-mode.el @@ -438,8 +438,6 @@ If the list was changed, sort the list and remove duplicates first." (insert close))))))) (nth 1 entry)))) -(define-obsolete-function-alias 'meta-complete-symbol - 'completion-at-point "24.1") ;;; Indentation. @@ -803,7 +801,6 @@ The environment marked is the one that contains point or follows point." st) "Syntax table used in Metafont or MetaPost mode.") -(define-obsolete-variable-alias 'meta-mode-map 'meta-common-mode-map "24.1") (defvar meta-common-mode-map (let ((map (make-sparse-keymap))) ;; Comment Paragraphs: diff --git a/lisp/progmodes/pascal.el b/lisp/progmodes/pascal.el index 351ea6e3a99..8d3194e6a47 100644 --- a/lisp/progmodes/pascal.el +++ b/lisp/progmodes/pascal.el @@ -239,14 +239,6 @@ will do all lineups." (const :tag "Declarations" declaration) (const :tag "Case statements" case))) -(defvar pascal-toggle-completions nil - "If non-nil, `pascal-complete-word' tries all possible completions. -Repeated use of \\[pascal-complete-word] then shows all -completions in turn, instead of displaying a list of all possible -completions.") -(make-obsolete-variable 'pascal-toggle-completions - 'completion-cycle-threshold "24.1") - (defcustom pascal-type-keywords '("array" "file" "packed" "char" "integer" "real" "string" "record") "Keywords for types used when completing a word in a declaration or parmlist. @@ -1297,13 +1289,6 @@ indent of the current line in parameterlist." (when (> e b) (list b e #'pascal-completion)))) -(define-obsolete-function-alias 'pascal-complete-word - 'completion-at-point "24.1") - -(define-obsolete-function-alias 'pascal-show-completions - 'completion-help-at-point "24.1") - - (defun pascal-get-default-symbol () "Return symbol around current point as a string." (save-excursion diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 9598209f5e5..5aba95d4c79 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -742,14 +742,6 @@ Relevant only when `prolog-imenu-flag' is non-nil." :group 'prolog-other :type 'boolean) -(defcustom prolog-char-quote-workaround nil - "If non-nil, declare 0 as a quote character to handle 0'. -This is really kludgy, and unneeded (i.e. obsolete) in Emacs>=24." - :version "24.1" - :group 'prolog-other - :type 'boolean) -(make-obsolete-variable 'prolog-char-quote-workaround nil "24.1") - ;;------------------------------------------------------------------- ;; Internal variables @@ -1303,7 +1295,7 @@ To find out what version of Prolog mode you are running, enter (t t))) ;; This statement was missing in Emacs 24.1, 24.2, 24.3. -(define-obsolete-function-alias 'switch-to-prolog 'run-prolog "24.1") +(define-obsolete-function-alias 'switch-to-prolog 'run-prolog "24.1") ; "24.4" ; for grep ;;;###autoload (defun run-prolog (arg) "Run an inferior Prolog process, input and output via buffer *prolog*. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index f1191b8faab..1c99937c4b9 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -248,7 +248,6 @@ (eval-when-compile (require 'subr-x)) ;For `string-empty-p'. ;; Avoid compiler warnings -(defvar view-return-to-alist) (defvar compilation-error-regexp-alist) (defvar outline-heading-end-regexp) diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 3c8d4f43dbc..2e8e8d23192 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -234,9 +234,6 @@ It creates the Imenu index for the buffer, if necessary." (setq which-func-mode nil) (error "Error in which-func-update: %S" info)))))) -;;;###autoload -(define-obsolete-function-alias 'which-func-mode 'which-function-mode "24.1") - (defvar which-func-update-timer nil) (unless (or (assq 'which-func-mode mode-line-misc-info) diff --git a/lisp/simple.el b/lisp/simple.el index 66640916a25..1d251dbf5e6 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1732,8 +1732,6 @@ from Lisp." words (if (= words 1) "" "s") chars (if (= chars 1) "" "s")))) -(define-obsolete-function-alias 'count-lines-region 'count-words-region "24.1") - (defun what-line () "Print the current buffer line number and narrowed line number of point." (interactive) @@ -1951,10 +1949,6 @@ Such arguments are used as in `read-from-minibuffer'.)" ;; Used for interactive spec `X'. (eval (read--expression prompt initial-contents))) -(defvar minibuffer-completing-symbol nil - "Non-nil means completing a Lisp symbol in the minibuffer.") -(make-obsolete-variable 'minibuffer-completing-symbol nil "24.1" 'get) - (defvar minibuffer-default nil "The current default value or list of default values in the minibuffer. The functions `read-from-minibuffer' and `completing-read' bind @@ -2015,20 +2009,19 @@ display the result of expression evaluation." PROMPT and optional argument INITIAL-CONTENTS do the same as in function `read-from-minibuffer'." - (let ((minibuffer-completing-symbol t)) - (minibuffer-with-setup-hook - (lambda () - ;; FIXME: instead of just applying the syntax table, maybe - ;; use a special major mode tailored to reading Lisp - ;; expressions from the minibuffer? (`emacs-lisp-mode' - ;; doesn't preserve the necessary keybindings.) - (set-syntax-table emacs-lisp-mode-syntax-table) - (add-hook 'completion-at-point-functions - #'elisp-completion-at-point nil t) - (run-hooks 'eval-expression-minibuffer-setup-hook)) - (read-from-minibuffer prompt initial-contents - read-expression-map t - 'read-expression-history)))) + (minibuffer-with-setup-hook + (lambda () + ;; FIXME: instead of just applying the syntax table, maybe + ;; use a special major mode tailored to reading Lisp + ;; expressions from the minibuffer? (`emacs-lisp-mode' + ;; doesn't preserve the necessary keybindings.) + (set-syntax-table emacs-lisp-mode-syntax-table) + (add-hook 'completion-at-point-functions + #'elisp-completion-at-point nil t) + (run-hooks 'eval-expression-minibuffer-setup-hook)) + (read-from-minibuffer prompt initial-contents + read-expression-map t + 'read-expression-history))) (defun read--expression-try-read () "Try to read an Emacs Lisp expression in the minibuffer. diff --git a/lisp/speedbar.el b/lisp/speedbar.el index da85d548637..9184d6c5254 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -703,8 +703,6 @@ If you want to change this while speedbar is active, either use (defvar speedbar-update-flag-disable nil "Permanently disable changing of the update flag.") -(define-obsolete-variable-alias - 'speedbar-syntax-table 'speedbar-mode-syntax-table "24.1") (defvar speedbar-mode-syntax-table (let ((st (make-syntax-table))) ;; Turn off paren matching around here. @@ -719,8 +717,6 @@ If you want to change this while speedbar is active, either use st) "Syntax-table used on the speedbar.") - -(define-obsolete-variable-alias 'speedbar-key-map 'speedbar-mode-map "24.1") (defvar speedbar-mode-map (let ((map (make-keymap))) (suppress-keymap map t) diff --git a/lisp/strokes.el b/lisp/strokes.el index 376cbc0cfee..d7a95393166 100644 --- a/lisp/strokes.el +++ b/lisp/strokes.el @@ -1031,8 +1031,6 @@ o Strokes are a bit computer-dependent in that they depend somewhat on (help-mode) (help-print-return-message))) -(define-obsolete-function-alias 'strokes-report-bug #'report-emacs-bug "24.1") - (defun strokes-window-configuration-changed-p () "Non-nil if the `strokes-window-configuration' frame properties changed. This is based on the last time `strokes-window-configuration' was updated." diff --git a/lisp/subr.el b/lisp/subr.el index 6bf12fd7577..f8b386e5631 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1856,8 +1856,6 @@ be a list of the form returned by `event-start' and `event-end'." ;;;; Obsolescence declarations for variables, and aliases. (make-obsolete-variable 'redisplay-end-trigger-functions 'jit-lock-register "23.1") -(make-obsolete-variable 'deferred-action-list 'post-command-hook "24.1") -(make-obsolete-variable 'deferred-action-function 'post-command-hook "24.1") (make-obsolete-variable 'redisplay-dont-pause nil "24.5") (make-obsolete 'window-redisplay-end-trigger nil "23.1") (make-obsolete 'set-window-redisplay-end-trigger nil "23.1") @@ -4707,9 +4705,6 @@ even if this catches the signal." ,@(cdr handler))) handlers))) -(define-obsolete-function-alias 'condition-case-no-debug - 'condition-case-unless-debug "24.1") - (defmacro with-demoted-errors (format &rest body) "Run BODY and demote any errors to simple messages. FORMAT is a string passed to `message' to format any error message. diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index 84c5b087b9a..e26191b33b4 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -97,8 +97,6 @@ The properties returned may include `top', `left', `height', and `width'." ;;;; Keyboard mapping. -(define-obsolete-variable-alias 'ns-alternatives-map 'x-alternatives-map "24.1") - ;; Here are some Nextstep-like bindings for command key sequences. (define-key global-map [?\s-,] 'customize) (define-key global-map [?\s-'] 'next-window-any-frame) @@ -682,10 +680,6 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") ;;;; Pasteboard support. -(define-obsolete-function-alias 'ns-store-cut-buffer-internal - 'gui-set-selection "24.1") - - (defun ns-copy-including-secondary () (interactive) (call-interactively 'kill-ring-save) diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 7eaa6047763..993f1d43208 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el @@ -81,7 +81,6 @@ (&optional frame exclude-proportional)) (defvar w32-color-map) ;; defined in w32fns.c -(make-obsolete 'w32-default-color-map nil "24.1") (declare-function w32-send-sys-command "w32fns.c") (declare-function set-message-beep "w32fns.c") diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 7c88c85ceff..3a0bd65f29c 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1171,9 +1171,6 @@ as returned by `x-server-vendor'." ;;;; Selections -(define-obsolete-function-alias 'x-cut-buffer-or-selection-value - 'x-selection-value "24.1") - ;; Arrange for the kill and yank functions to set and check the clipboard. (defun x-clipboard-yank () diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 544e0da8276..6763da046ff 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -316,8 +316,6 @@ If parsing fails, try to set this variable to nil." (option (choice :tag "Alternative" :value nil (const nil) integer))))))) -(define-obsolete-variable-alias 'bibtex-entry-field-alist - 'bibtex-BibTeX-entry-alist "24.1") (defcustom bibtex-BibTeX-entry-alist '(("Article" "Article in Journal" (("author") @@ -3673,14 +3671,6 @@ if that value is non-nil. (if (not (consp (nth 1 (car entry-alist)))) ;; new format entry-alist - ;; Convert old format of `bibtex-entry-field-alist' - (unless (get var 'entry-list-format) - (put var 'entry-list-format "pre-24") - (message "Old format of `%s' (pre GNU Emacs 24). -Please convert to the new format." - (if (eq (indirect-variable 'bibtex-entry-field-alist) var) - 'bibtex-entry-field-alist var)) - (sit-for 3)) (let (lst) (dolist (entry entry-alist) (let ((fl (nth 1 entry)) req xref opt) @@ -5318,7 +5308,6 @@ entries from minibuffer." (goto-char (point-max)) (message "Buffer is now parsable. Please save it."))) -(define-obsolete-function-alias 'bibtex-complete #'completion-at-point "24.1") (defun bibtex-completion-at-point-function () (let ((pnt (point)) (case-fold-search t) diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el index aeae389da64..b517cc16634 100644 --- a/lisp/textmodes/reftex-index.el +++ b/lisp/textmodes/reftex-index.el @@ -269,8 +269,6 @@ will prompt for other arguments." (and newtag (cdr cell) (not (member newtag (cdr cell))) (push newtag (cdr cell))))) -(define-obsolete-variable-alias - 'reftex-index-map 'reftex-index-mode-map "24.1") (defvar reftex-index-mode-map (let ((map (make-sparse-keymap))) ;; Index map @@ -1198,8 +1196,6 @@ This gets refreshed in every phrases command.") '((reftex-index-phrases-font-lock-keywords) nil t nil beginning-of-line) "Font lock defaults for `reftex-index-phrases-mode'.") -(define-obsolete-variable-alias - 'reftex-index-phrases-map 'reftex-index-phrases-mode-map "24.1") (defvar reftex-index-phrases-mode-map (let ((map (make-sparse-keymap))) ;; Keybindings and Menu for phrases buffer diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el index d77411483f7..5942801a8a9 100644 --- a/lisp/textmodes/reftex-sel.el +++ b/lisp/textmodes/reftex-sel.el @@ -59,8 +59,6 @@ (define-key map [follow-link] 'mouse-face) map)) -(define-obsolete-variable-alias - 'reftex-select-label-map 'reftex-select-label-mode-map "24.1") (defvar reftex-select-label-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map reftex-select-shared-map) @@ -109,8 +107,6 @@ During a selection process, these are the local bindings. ;; We do not set a local map - reftex-select-item does this. ) -(define-obsolete-variable-alias - 'reftex-select-bib-map 'reftex-select-bib-mode-map "24.1") (defvar reftex-select-bib-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map reftex-select-shared-map) diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index 89c734a0d76..5599eaee024 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el @@ -28,7 +28,6 @@ (require 'reftex) ;;; -(define-obsolete-variable-alias 'reftex-toc-map 'reftex-toc-mode-map "24.1") (defvar reftex-toc-mode-map (let ((map (make-sparse-keymap))) diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index 964baed03c7..f6bbda02e6a 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el @@ -3584,125 +3584,46 @@ Region is from BEG to END. With WITH-EMPTY prefix empty lines too." :version "24.1" :group 'rst-faces) -(defcustom rst-block-face 'rst-block - "All syntax marking up a special block." - :version "24.1" - :group 'rst-faces - :type '(face)) -(make-obsolete-variable 'rst-block-face - "customize the face `rst-block' instead." - "24.1") - (defface rst-external '((t :inherit font-lock-type-face)) "Face used for field names and interpreted text." :version "24.1" :group 'rst-faces) -(defcustom rst-external-face 'rst-external - "Field names and interpreted text." - :version "24.1" - :group 'rst-faces - :type '(face)) -(make-obsolete-variable 'rst-external-face - "customize the face `rst-external' instead." - "24.1") - (defface rst-definition '((t :inherit font-lock-function-name-face)) "Face used for all other defining constructs." :version "24.1" :group 'rst-faces) -(defcustom rst-definition-face 'rst-definition - "All other defining constructs." - :version "24.1" - :group 'rst-faces - :type '(face)) -(make-obsolete-variable 'rst-definition-face - "customize the face `rst-definition' instead." - "24.1") - (defface rst-directive '((t :inherit font-lock-builtin-face)) "Face used for directives and roles." :version "24.1" :group 'rst-faces) -(defcustom rst-directive-face 'rst-directive - "Directives and roles." - :group 'rst-faces - :type '(face)) -(make-obsolete-variable 'rst-directive-face - "customize the face `rst-directive' instead." - "24.1") - (defface rst-comment '((t :inherit font-lock-comment-face)) "Face used for comments." :version "24.1" :group 'rst-faces) -(defcustom rst-comment-face 'rst-comment - "Comments." - :version "24.1" - :group 'rst-faces - :type '(face)) -(make-obsolete-variable 'rst-comment-face - "customize the face `rst-comment' instead." - "24.1") - (defface rst-emphasis1 '((t :inherit italic)) "Face used for simple emphasis." :version "24.1" :group 'rst-faces) -(defcustom rst-emphasis1-face 'rst-emphasis1 - "Simple emphasis." - :version "24.1" - :group 'rst-faces - :type '(face)) -(make-obsolete-variable 'rst-emphasis1-face - "customize the face `rst-emphasis1' instead." - "24.1") - (defface rst-emphasis2 '((t :inherit bold)) "Face used for double emphasis." :version "24.1" :group 'rst-faces) -(defcustom rst-emphasis2-face 'rst-emphasis2 - "Double emphasis." - :group 'rst-faces - :type '(face)) -(make-obsolete-variable 'rst-emphasis2-face - "customize the face `rst-emphasis2' instead." - "24.1") - (defface rst-literal '((t :inherit font-lock-string-face)) "Face used for literal text." :version "24.1" :group 'rst-faces) -(defcustom rst-literal-face 'rst-literal - "Literal text." - :version "24.1" - :group 'rst-faces - :type '(face)) -(make-obsolete-variable 'rst-literal-face - "customize the face `rst-literal' instead." - "24.1") - (defface rst-reference '((t :inherit font-lock-variable-name-face)) "Face used for references to a definition." :version "24.1" :group 'rst-faces) -(defcustom rst-reference-face 'rst-reference - "References to a definition." - :version "24.1" - :group 'rst-faces - :type '(face)) -(make-obsolete-variable 'rst-reference-face - "customize the face `rst-reference' instead." - "24.1") - (defface rst-transition '((t :inherit font-lock-keyword-face)) "Face used for a transition." :package-version '(rst . "1.3.0") @@ -3794,23 +3715,23 @@ of your own." ;; `Bullet Lists`_ ;; FIXME: A bullet directly after a field name is not recognized. (,(rst-re 'lin-beg '(:grp bul-sta)) - 1 rst-block-face) + 1 'rst-block) ;; `Enumerated Lists`_ (,(rst-re 'lin-beg '(:grp enmany-sta)) - 1 rst-block-face) + 1 'rst-block) ;; `Definition Lists`_ ;; FIXME: missing. ;; `Field Lists`_ (,(rst-re 'lin-beg '(:grp fld-tag) 'bli-sfx) - 1 rst-external-face) + 1 'rst-external) ;; `Option Lists`_ (,(rst-re 'lin-beg '(:grp opt-tag (:shy optsep-tag opt-tag) "*") '(:alt "$" (:seq hws-prt "\\{2\\}"))) - 1 rst-block-face) + 1 'rst-block) ;; `Line Blocks`_ ;; Only for lines containing no more bar - to distinguish from tables. (,(rst-re 'lin-beg '(:grp "|" bli-sfx) "[^|\n]*$") - 1 rst-block-face) + 1 'rst-block) ;; `Tables`_ ;; FIXME: missing @@ -3818,22 +3739,22 @@ of your own." ;; All the `Explicit Markup Blocks`_ ;; `Footnotes`_ / `Citations`_ (,(rst-re 'lin-beg 'fnc-sta-2) - (1 rst-definition-face) - (2 rst-definition-face)) + (1 'rst-definition) + (2 'rst-definition)) ;; `Directives`_ / `Substitution Definitions`_ (,(rst-re 'lin-beg 'dir-sta-3) - (1 rst-directive-face) - (2 rst-definition-face) - (3 rst-directive-face)) + (1 'rst-directive) + (2 'rst-definition) + (3 'rst-directive)) ;; `Hyperlink Targets`_ (,(rst-re 'lin-beg '(:grp exm-sta "_" (:alt (:seq "`" ilcbkqdef-tag "`") (:seq (:alt "[^:\\\n]" "\\\\.") "+")) ":") 'bli-sfx) - 1 rst-definition-face) + 1 'rst-definition) (,(rst-re 'lin-beg '(:grp "__") 'bli-sfx) - 1 rst-definition-face) + 1 'rst-definition) ;; All `Inline Markup`_ ;; Most of them may be multiline though this is uninteresting. @@ -3841,16 +3762,16 @@ of your own." ;; FIXME: Condition 5 preventing fontification of e.g. "*" not implemented ;; `Strong Emphasis`_. (,(rst-re 'ilm-pfx '(:grp "\\*\\*" ilcast-tag "\\*\\*") 'ilm-sfx) - 1 rst-emphasis2-face) + 1 'rst-emphasis2) ;; `Emphasis`_ (,(rst-re 'ilm-pfx '(:grp "\\*" ilcast-tag "\\*") 'ilm-sfx) - 1 rst-emphasis1-face) + 1 'rst-emphasis1) ;; `Inline Literals`_ (,(rst-re 'ilm-pfx '(:grp "``" ilcbkq-tag "``") 'ilm-sfx) - 1 rst-literal-face) + 1 'rst-literal) ;; `Inline Internal Targets`_ (,(rst-re 'ilm-pfx '(:grp "_`" ilcbkq-tag "`") 'ilm-sfx) - 1 rst-definition-face) + 1 'rst-definition) ;; `Hyperlink References`_ ;; FIXME: `Embedded URIs and Aliases`_ not considered. ;; FIXME: Directly adjacent marked up words are not fontified correctly @@ -3858,28 +3779,28 @@ of your own." (,(rst-re 'ilm-pfx '(:grp (:alt (:seq "`" ilcbkq-tag "`") (:seq "\\sw" (:alt "\\sw" "-") "+\\sw")) "__?") 'ilm-sfx) - 1 rst-reference-face) + 1 'rst-reference) ;; `Interpreted Text`_ (,(rst-re 'ilm-pfx '(:grp (:shy ":" sym-tag ":") "?") '(:grp "`" ilcbkq-tag "`") '(:grp (:shy ":" sym-tag ":") "?") 'ilm-sfx) - (1 rst-directive-face) - (2 rst-external-face) - (3 rst-directive-face)) + (1 'rst-directive) + (2 'rst-external) + (3 'rst-directive)) ;; `Footnote References`_ / `Citation References`_ (,(rst-re 'ilm-pfx '(:grp fnc-tag "_") 'ilm-sfx) - 1 rst-reference-face) + 1 'rst-reference) ;; `Substitution References`_ ;; FIXME: References substitutions like |this|_ or |this|__ are not ;; fontified correctly. (,(rst-re 'ilm-pfx '(:grp sub-tag) 'ilm-sfx) - 1 rst-reference-face) + 1 'rst-reference) ;; `Standalone Hyperlinks`_ ;; FIXME: This takes it easy by using a whitespace as delimiter. (,(rst-re 'ilm-pfx '(:grp uri-tag ":\\S +") 'ilm-sfx) - 1 rst-definition-face) + 1 'rst-definition) (,(rst-re 'ilm-pfx '(:grp sym-tag "@" sym-tag ) 'ilm-sfx) - 1 rst-definition-face) + 1 'rst-definition) ;; Do all block fontification as late as possible so 'append works. @@ -3906,18 +3827,18 @@ of your own." ;; `Comments`_ ;; This is multiline. (,(rst-re 'lin-beg 'cmt-sta-1) - (1 rst-comment-face) + (1 'rst-comment) (rst-font-lock-find-unindented-line-match (rst-font-lock-find-unindented-line-limit (match-end 1)) nil - (0 rst-comment-face append))) + (0 'rst-comment append))) (,(rst-re 'lin-beg '(:grp exm-tag) '(:grp hws-tag) "$") - (1 rst-comment-face) - (2 rst-comment-face) + (1'rst-comment) + (2'rst-comment) (rst-font-lock-find-unindented-line-match (rst-font-lock-find-unindented-line-limit 'next) nil - (0 rst-comment-face append))) + (0 'rst-comment append))) ;; FIXME: This is not rendered as comment:: ;; .. .. list-table:: @@ -3941,11 +3862,11 @@ of your own." ;; `Indented Literal Blocks`_ ;; This is multiline. (,(rst-re 'lin-beg 'lit-sta-2) - (2 rst-block-face) + (2 'rst-block) (rst-font-lock-find-unindented-line-match (rst-font-lock-find-unindented-line-limit t) nil - (0 rst-literal-face append))) + (0 'rst-literal append))) ;; FIXME: `Quoted Literal Blocks`_ missing. ;; This is multiline. @@ -3972,8 +3893,8 @@ of your own." ;; ;; Indentation is not required for doctest blocks. (,(rst-re 'lin-beg '(:grp (:alt ">>>" ell-tag)) '(:grp ".+")) - (1 rst-block-face) - (2 rst-literal-face))) + (1 'rst-block) + (2 'rst-literal))) "Keywords to highlight in rst mode.") (defvar font-lock-beg) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 46e40f29c02..80508570f32 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -556,15 +556,6 @@ this function." templates)))) -;; toggle-read-only is obsolete since 24.3, but since vc-t-r-o was made -;; obsolete earlier, it is ok for the latter to be an alias to the former, -;; since the latter will be removed first. We can't just make it -;; an alias for read-only-mode, since that is not 100% the same. -(defalias 'vc-toggle-read-only 'toggle-read-only) -(make-obsolete 'vc-toggle-read-only - "use `read-only-mode' instead (or `toggle-read-only' in older versions of Emacs)." - "24.1") - (defun vc-default-make-version-backups-p (_backend _file) "Return non-nil if unmodified versions should be backed up locally. The default is to switch off this feature." diff --git a/lisp/view.el b/lisp/view.el index 17bc46d4c46..287112f2d44 100644 --- a/lisp/view.el +++ b/lisp/view.el @@ -112,18 +112,6 @@ If nil that means use half the window size.") (defvar-local view-last-regexp nil) ; Global is better??? -(defvar-local view-return-to-alist nil - "What to do with used windows and where to go when finished viewing buffer. -This is local in each buffer being viewed. -It is added to by `view-mode-enter' when starting to view a buffer and -subtracted from by `view-mode-exit' when finished viewing the buffer. - -See RETURN-TO-ALIST argument of function `view-mode-exit' for the format of -`view-return-to-alist'.") -(make-obsolete-variable - 'view-return-to-alist "this variable is no longer used." "24.1") -(put 'view-return-to-alist 'permanent-local t) - (defvar-local view-exit-action nil "If non-nil, a function called when finished viewing. The function should take one argument (a buffer). @@ -476,40 +464,6 @@ Entry to view-mode runs the normal hook `view-mode-hook'." (if buffer-read-only (setq buffer-read-only view-old-buffer-read-only))) -;;;###autoload -(defun view-return-to-alist-update (buffer &optional item) - "Update `view-return-to-alist' of buffer BUFFER. -Remove from `view-return-to-alist' all entries referencing dead -windows. Optional argument ITEM non-nil means add ITEM to -`view-return-to-alist' after purging. For a description of items -that can be added see the RETURN-TO-ALIST argument of the -function `view-mode-exit'. If `view-return-to-alist' contains an -entry for the selected window, purge that entry from -`view-return-to-alist' before adding ITEM." - (declare (obsolete "this function has no effect." "24.1")) - (with-current-buffer buffer - (when view-return-to-alist - (let* ((list view-return-to-alist) - entry entry-window last) - (while list - (setq entry (car list)) - (setq entry-window (car entry)) - (if (and (windowp entry-window) - (or (and item (eq entry-window (selected-window))) - (not (window-live-p entry-window)))) - ;; Remove that entry. - (if last - (setcdr last (cdr list)) - (setq view-return-to-alist - (cdr view-return-to-alist))) - ;; Leave entry alone. - (setq last entry)) - (setq list (cdr list))))) - ;; Add ITEM. - (when item - (setq view-return-to-alist - (cons item view-return-to-alist))))) - ;;;###autoload (defun view-mode-enter (&optional quit-restore exit-action) "Enter View mode and set up exit from view mode depending on optional arguments. diff --git a/src/keyboard.c b/src/keyboard.c index 84a7a0a38a5..a520e533979 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1305,9 +1305,6 @@ command_loop_1 (void) /* If there are warnings waiting, process them. */ if (!NILP (Vdelayed_warnings_list)) safe_run_hooks (Qdelayed_warnings_hook); - - if (!NILP (Vdeferred_action_list)) - safe_run_hooks (Qdeferred_action_function); } /* Do this after running Vpost_command_hook, for consistency. */ @@ -1537,8 +1534,6 @@ command_loop_1 (void) if (!NILP (Vdelayed_warnings_list)) safe_run_hooks (Qdelayed_warnings_hook); - safe_run_hooks (Qdeferred_action_function); - kset_last_command (current_kboard, Vthis_command); kset_real_last_command (current_kboard, Vreal_this_command); if (!CONSP (last_command_event)) @@ -12089,7 +12084,6 @@ syms_of_keyboard (void) DEFSYM (Qundo_auto__undoably_changed_buffers, "undo-auto--undoably-changed-buffers"); - DEFSYM (Qdeferred_action_function, "deferred-action-function"); DEFSYM (Qdelayed_warnings_hook, "delayed-warnings-hook"); DEFSYM (Qfunction_key, "function-key"); @@ -12807,17 +12801,6 @@ This keymap works like `input-decode-map', but comes after `function-key-map'. Another difference is that it is global rather than terminal-local. */); Vkey_translation_map = Fmake_sparse_keymap (Qnil); - DEFVAR_LISP ("deferred-action-list", Vdeferred_action_list, - doc: /* List of deferred actions to be performed at a later time. -The precise format isn't relevant here; we just check whether it is nil. */); - Vdeferred_action_list = Qnil; - - DEFVAR_LISP ("deferred-action-function", Vdeferred_action_function, - doc: /* Function to call to handle deferred actions, after each command. -This function is called with no arguments after each command -whenever `deferred-action-list' is non-nil. */); - Vdeferred_action_function = Qnil; - DEFVAR_LISP ("delayed-warnings-list", Vdelayed_warnings_list, doc: /* List of warnings to be displayed after this command. Each element must be a list (TYPE MESSAGE [LEVEL [BUFFER-NAME]]), @@ -13072,7 +13055,6 @@ syms_of_keyboard_for_pdumper (void) PDUMPER_RESET (num_input_keys, 0); PDUMPER_RESET (num_nonmacro_input_events, 0); PDUMPER_RESET_LV (Vlast_event_frame, Qnil); - PDUMPER_RESET_LV (Vdeferred_action_list, Qnil); PDUMPER_RESET_LV (Vdelayed_warnings_list, Qnil); /* Create the initial keyboard. Qt means 'unset'. */ diff --git a/src/w32fns.c b/src/w32fns.c index 468073c9170..51540e1880c 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -797,13 +797,6 @@ w32_default_color_map (void) return (cmap); } -DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map, - 0, 0, 0, doc: /* Return the default color map. */) - (void) -{ - return w32_default_color_map (); -} - static Lisp_Object w32_color_map_lookup (const char *colorname) { @@ -10879,7 +10872,6 @@ keys when IME input is received. */); /* W32 specific functions */ defsubr (&Sw32_define_rgb_color); - defsubr (&Sw32_default_color_map); defsubr (&Sw32_display_monitor_attributes_list); defsubr (&Sw32_send_sys_command); defsubr (&Sw32_shell_execute); -- cgit v1.2.3 From ecb2eccad56518992426500dd8119024ea8288a8 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 9 Jul 2022 10:54:01 +0200 Subject: Improve ert-test-erts-file documentation * lisp/emacs-lisp/ert.el (ert-test-erts-file): Improve docstring. * doc/misc/ert.texi (erts files): Fix typo. --- doc/misc/ert.texi | 2 +- lisp/emacs-lisp/ert.el | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 4dccd8edcf0..1b7f38daadf 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -822,7 +822,7 @@ that's pretty difficult to read and write, especially when the text in question is multi-line. So ert provides a function called @code{ert-test-erts-file} that takes -two parameters: The name of a specially-formatted @dfn{erts} file, and +two parameters: the name of a specially-formatted @dfn{erts} file, and (optionally) a function that performs the transform. @findex erts-mode diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 21bee4c6d8b..49b54c2d00f 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -2880,8 +2880,14 @@ To be used in the ERT results buffer." nil) (defun ert-test-erts-file (file &optional transform) - "Parse FILE as a file containing before/after parts. -TRANSFORM will be called to get from before to after." + "Parse FILE as a file containing before/after parts (an erts file). + +This function puts the \"before\" section of an .erts file into a +temporary buffer, calls the TRANSFORM function, and then compares +the result with the \"after\" section. + +See Info node `(ert) erts files' for more information on how to +write erts files." (with-temp-buffer (insert-file-contents file) (let ((gen-specs (list (cons 'dummy t) -- cgit v1.2.3 From 5f8922b9e26f8c0bf68bd72ff6804616a7134792 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Sat, 9 Jul 2022 11:15:17 +0200 Subject: ; * lisp/emacs-lisp/cconv.el (cconv--var-classification): Optimise. --- lisp/emacs-lisp/cconv.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index eca1123899c..7f95fa94fa1 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -267,8 +267,7 @@ Returns a form where all lambdas don't have any free variables." (define-inline cconv--var-classification (binder form) (inline-quote - (alist-get (cons ,binder ,form) cconv-var-classification - nil nil #'equal))) + (cdr (assoc (cons ,binder ,form) cconv-var-classification)))) (defun cconv--convert-funcbody (funargs funcbody env parentform) "Run `cconv-convert' on FUNCBODY, the forms of a lambda expression. -- cgit v1.2.3 From 4bab499ed0d40d4e5ca68e5a17bcf5341125f734 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 10 Jul 2022 18:13:50 +0200 Subject: Fix Tramp test environment on hydra.nixos.org * lisp/emacs-lisp/ert-x.el (tramp-remote-path): Declare. Adapt `tramp-remote-path' on hydra. (Bug#56424) * test/lisp/dnd-tests.el (dnd-tests-begin-drag-files): Remove instrumentation. * test/lisp/filenotify-tests.el: * test/lisp/shadowfile-tests.el: * test/lisp/net/tramp-tests.el: Do not adapt `tramp-remote-path'. --- lisp/emacs-lisp/ert-x.el | 8 ++++++-- test/lisp/dnd-tests.el | 6 ------ test/lisp/filenotify-tests.el | 4 ---- test/lisp/net/tramp-tests.el | 11 ++++++----- test/lisp/shadowfile-tests.el | 4 ---- 5 files changed, 12 insertions(+), 21 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index ae72a47c2fc..21a967cb4c9 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -488,9 +488,13 @@ The same keyword arguments are supported as in (string-match "Apple \\(LLVM\\|[Cc]lang\\)\\|Xcode\\.app" (shell-command-to-string "gcc --version"))) - -(defvar tramp-methods) (defvar tramp-default-host-alist) +(defvar tramp-methods) +(defvar tramp-remote-path) + +;; This should happen on hydra only. +(when (getenv "EMACS_HYDRA_CI") + (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) ;; If this defconst is used in a test file, `tramp' shall be loaded ;; prior `ert-x'. There is no default value on w32 systems, which diff --git a/test/lisp/dnd-tests.el b/test/lisp/dnd-tests.el index 7ce3677eaa0..88f6e694577 100644 --- a/test/lisp/dnd-tests.el +++ b/test/lisp/dnd-tests.el @@ -274,7 +274,6 @@ This function only tries to handle strings." (skip-unless (and (dnd-tests-remote-accessible-p) ;; TODO: make these tests work under X. (not (eq window-system 'x)))) - (let ((tramp-verbose (if (getenv "EMACS_HYDRA_CI") 10 3))) (let ((normal-temp-file (expand-file-name (make-temp-name "dnd-test") temporary-file-directory)) (normal-temp-file-1 (expand-file-name (make-temp-name "dnd-test") @@ -384,14 +383,9 @@ This function only tries to handle strings." ;; And when all remote files are inaccessible. (should-error (dnd-begin-drag-files (list nonexistent-remote-file nonexistent-remote-file-1)))) - (when (getenv "EMACS_HYDRA_CI") - (dolist (buf (tramp-list-tramp-buffers)) - (message ";; %s\n%s" buf (tramp-get-buffer-string buf)) - (kill-buffer buf))) (delete-file normal-temp-file) (delete-file normal-temp-file-1) (delete-file remote-temp-file)))) - ) (ert-deftest dnd-tests-get-local-file-uri () (should (equal (dnd-get-local-file-uri "file://localhost/path/to/foo") diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index ad0138b2e7b..4ed1786a8ef 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -178,10 +178,6 @@ Return nil when any other file notification watch is still active." tramp-allow-unsafe-temporary-files (or tramp-allow-unsafe-temporary-files noninteractive)) -;; This should happen on hydra only. -(when (getenv "EMACS_HYDRA_CI") - (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) - (defun file-notify--test-add-watch (file flags callback) "Like `file-notify-add-watch', but also passing FILE to CALLBACK." (file-notify-add-watch file flags diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index a53fc7ec7ac..8b6d10033f1 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -128,6 +128,7 @@ A resource file is in the resource directory as per `(expand-file-name ,file (ert-resource-directory))))) ;; `ert-remote-temporary-file-directory' was introduced in Emacs 29.1. +;; Adapting `tramp-remote-path' happens also there. (unless (boundp 'ert-remote-temporary-file-directory) (eval-and-compile ;; There is no default value on w32 systems, which could work out @@ -152,7 +153,11 @@ A resource file is in the resource directory as per (unless (and (null noninteractive) (file-directory-p "~/")) (setenv "HOME" temporary-file-directory)) (format "/mock::%s" temporary-file-directory))) - "Temporary directory for remote file tests."))) + "Temporary directory for remote file tests.") + + ;; This should happen on hydra only. + (when (getenv "EMACS_HYDRA_CI") + (add-to-list 'tramp-remote-path 'tramp-own-remote-path)))) ;; Beautify batch mode. (when noninteractive @@ -178,10 +183,6 @@ A resource file is in the resource directory as per tramp-persistency-file-name nil tramp-verbose 0) -;; This should happen on hydra only. -(when (getenv "EMACS_HYDRA_CI") - (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) - (defvar tramp--test-enabled-checked nil "Cached result of `tramp--test-enabled'. If the function did run, the value is a cons cell, the `cdr' diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el index e822bc9eb66..0916f7ce688 100644 --- a/test/lisp/shadowfile-tests.el +++ b/test/lisp/shadowfile-tests.el @@ -55,10 +55,6 @@ ert-remote-temporary-file-directory (ignore-errors (file-truename ert-remote-temporary-file-directory))) -;; This should happen on hydra only. -(when (getenv "EMACS_HYDRA_CI") - (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) - (defconst shadow-test-info-file (expand-file-name "shadows_test" temporary-file-directory) "File to keep shadow information in during tests.") -- cgit v1.2.3 From 27c3a8b27707e401dfa28e833fcf12731d89669e Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 10 Jul 2022 18:57:19 +0200 Subject: Remove some ineffectual calls to purecopy * lisp/dired.el (dired-chown-program, dired-trivial-filenames): * lisp/emacs-lisp/shortdoc.el (shortdoc--display-function): * lisp/help-fns.el (help-fns--mention-shortdoc-groups): * lisp/mail/mail-extr.el (mail-extr-full-name-prefixes) (mail-extr-all-letters-but-separators, mail-extr-all-letters) (mail-extr-first-letters, mail-extr-last-letters) (mail-extr-bad-dot-pattern, mail-extr-full-name-suffix-pattern) (mail-extr-alternative-address-pattern) (mail-extr-trailing-comment-start-pattern) (mail-extr-name-pattern, mail-extr-telephone-extension-pattern) (mail-extr-ham-call-sign-pattern, mail-extr-normal-name-pattern) (mail-extr-two-name-pattern) (mail-extr-listserv-list-name-pattern) (mail-extr-stupid-vms-date-stamp-pattern) (mail-extr-hz-embedded-gb-encoded-chinese-pattern) (mail-extr-x400-encoded-address-pattern) (mail-extr-x400-encoded-address-field-pattern-format) (mail-extr-x400-encoded-address-surname-pattern) (mail-extr-x400-encoded-address-given-name-pattern) (mail-extr-x400-encoded-address-full-name-pattern): Remove ineffectual calls to purecopy. --- lisp/dired.el | 10 ++-- lisp/emacs-lisp/shortdoc.el | 6 +-- lisp/help-fns.el | 2 +- lisp/mail/mail-extr.el | 113 ++++++++++++++++++++------------------------ 4 files changed, 59 insertions(+), 72 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/dired.el b/lisp/dired.el index b9ab2a9b1e6..43563d969f1 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -103,10 +103,10 @@ If `dired-maybe-use-globstar' is non-nil, then `dired-insert-directory' checks this alist to enable globstar in the shell subprocess.") (defcustom dired-chown-program - (purecopy (cond ((executable-find "chown") "chown") - ((file-executable-p "/usr/sbin/chown") "/usr/sbin/chown") - ((file-executable-p "/etc/chown") "/etc/chown") - (t "chown"))) + (cond ((executable-find "chown") "chown") + ((file-executable-p "/usr/sbin/chown") "/usr/sbin/chown") + ((file-executable-p "/etc/chown") "/etc/chown") + (t "chown")) "Name of chown command (usually `chown')." :group 'dired :type 'file) @@ -161,7 +161,7 @@ always set this variable to t." :type 'boolean :group 'dired-mark) -(defcustom dired-trivial-filenames (purecopy "\\`\\.\\.?\\'\\|\\`\\.?#") +(defcustom dired-trivial-filenames "\\`\\.\\.?\\'\\|\\`\\.?#" "Regexp of files to skip when finding first file of a directory. A value of nil means move to the subdir line. A value of t means move to first file." diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index 68293931c3c..a2d954cadbb 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -1367,15 +1367,15 @@ If SAME-WINDOW, don't pop to a new window." 'action (lambda (_) (describe-function function)) 'follow-link t - 'help-echo (purecopy "mouse-1, RET: describe function")) + 'help-echo "mouse-1, RET: describe function") (insert-text-button (symbol-name function) 'face 'button 'action (lambda (_) (info-lookup-symbol function 'emacs-lisp-mode)) 'follow-link t - 'help-echo (purecopy "mouse-1, RET: show \ -function's documentation in the Info manual"))) + 'help-echo "mouse-1, RET: show \ +function's documentation in the Info manual")) (setq arglist-start (point)) (insert ")\n") ;; Doc string. diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 17354783ca0..fbd40158701 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -868,7 +868,7 @@ the C sources, too." (shortdoc-display-group group object help-window-keep-selected)) 'follow-link t - 'help-echo (purecopy "mouse-1, RET: show documentation group"))) + 'help-echo "mouse-1, RET: show documentation group")) groups) (insert (if (= (length groups) 1) " group.\n" diff --git a/lisp/mail/mail-extr.el b/lisp/mail/mail-extr.el index c87ea2b46e6..25ce4ea9025 100644 --- a/lisp/mail/mail-extr.el +++ b/lisp/mail/mail-extr.el @@ -1,7 +1,6 @@ ;;; mail-extr.el --- extract full name and address from email header -*- lexical-binding: t; -*- -;; Copyright (C) 1991-1994, 1997, 2001-2022 Free Software Foundation, -;; Inc. +;; Copyright (C) 1991-2022 Free Software Foundation, Inc. ;; Author: Joe Wells ;; Maintainer: emacs-devel@gnu.org @@ -240,8 +239,7 @@ we will act as though we couldn't find a full name in the address." ;; Matches a leading title that is not part of the name (does not ;; contribute to uniquely identifying the person). (defcustom mail-extr-full-name-prefixes - (purecopy - "\\(Prof\\|D[Rr]\\|Mrs?\\|Rev\\|Rabbi\\|SysOp\\|LCDR\\)\\.?[ \t\n]") + "\\(Prof\\|D[Rr]\\|Mrs?\\|Rev\\|Rabbi\\|SysOp\\|LCDR\\)\\.?[ \t\n]" "Matches prefixes to the full name that identify a person's position. These are stripped from the full name because they do not contribute to uniquely identifying the person." @@ -279,45 +277,42 @@ by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"." ;; Yes, there are weird people with digits in their names. ;; You will also notice the consideration for the ;; Swedish/Finnish/Norwegian character set. -(defconst mail-extr-all-letters-but-separators - (purecopy "][[:alnum:]{|}'~`")) +(defconst mail-extr-all-letters-but-separators "][[:alnum:]{|}'~`") ;; Any character that can occur in a name in an RFC 822 (or later) ;; address including the separator (hyphen and possibly period) for ;; multipart names. ;; #### should . be in here? (defconst mail-extr-all-letters - (purecopy (concat mail-extr-all-letters-but-separators "-"))) + (concat mail-extr-all-letters-but-separators "-")) ;; Any character that can start a name. ;; Keep this set as minimal as possible. -(defconst mail-extr-first-letters (purecopy "[:alpha:]")) +(defconst mail-extr-first-letters "[:alpha:]") ;; Any character that can end a name. ;; Keep this set as minimal as possible. -(defconst mail-extr-last-letters (purecopy "[:alpha:]`'.")) +(defconst mail-extr-last-letters "[:alpha:]`'.") (defconst mail-extr-leading-garbage "\\W+") ;; (defconst mail-extr-non-begin-name-chars -;; (purecopy (concat "^" mail-extr-first-letters))) +;; (concat "^" mail-extr-first-letters)) ;; (defconst mail-extr-non-end-name-chars -;; (purecopy (concat "^" mail-extr-last-letters))) +;; (concat "^" mail-extr-last-letters)) ;; Matches periods used instead of spaces. Must not match the period ;; following an initial. (defconst mail-extr-bad-dot-pattern - (purecopy - (format "\\([%s][%s]\\)\\.+\\([%s]\\)" - mail-extr-all-letters - mail-extr-last-letters - mail-extr-first-letters))) + (format "\\([%s][%s]\\)\\.+\\([%s]\\)" + mail-extr-all-letters + mail-extr-last-letters + mail-extr-first-letters)) ;; Matches an embedded or leading nickname that should be removed. ;; (defconst mail-extr-nickname-pattern -;; (purecopy -;; (format "\\([ .]\\|\\`\\)[\"'`[(]\\([ .%s]+\\)[]\"')] " -;; mail-extr-all-letters))) +;; (format "\\([ .]\\|\\`\\)[\"'`[(]\\([ .%s]+\\)[]\"')] " +;; mail-extr-all-letters)) ;; Matches the occurrence of a generational name suffix, and the last ;; character of the preceding name. This is important because we want to @@ -325,59 +320,56 @@ by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"." ;; *** Perhaps this should be a user-customizable variable. However, the ;; *** regular expression is fairly tricky to alter, so maybe not. (defconst mail-extr-full-name-suffix-pattern - (purecopy - (format - "\\(,? ?\\([JjSs][Rr]\\.?\\|V?I+V?\\)\\)\\([^%s]\\([^%s]\\|\\'\\)\\|\\'\\)" - mail-extr-all-letters mail-extr-all-letters))) + (format + "\\(,? ?\\([JjSs][Rr]\\.?\\|V?I+V?\\)\\)\\([^%s]\\([^%s]\\|\\'\\)\\|\\'\\)" + mail-extr-all-letters mail-extr-all-letters)) -(defconst mail-extr-roman-numeral-pattern (purecopy "V?I+V?\\b")) +(defconst mail-extr-roman-numeral-pattern "V?I+V?\\b") ;; Matches a trailing uppercase (with other characters possible) acronym. ;; Must not match a trailing uppercase last name or trailing initial (defconst mail-extr-weird-acronym-pattern - (purecopy "\\([A-Z]+[-_/]\\|[A-Z][A-Z][A-Z]?\\b\\)")) + "\\([A-Z]+[-_/]\\|[A-Z][A-Z][A-Z]?\\b\\)") ;; Matches a mixed-case or lowercase name (not an initial). ;; #### Match Latin1 lower case letters here too? ;; (defconst mail-extr-mixed-case-name-pattern -;; (purecopy -;; (format -;; "\\b\\([a-z][%s]*[%s]\\|[%s][%s]*[a-z][%s]*[%s]\\|[%s][%s]*[a-z]\\)" -;; mail-extr-all-letters mail-extr-last-letters -;; mail-extr-first-letters mail-extr-all-letters mail-extr-all-letters -;; mail-extr-last-letters mail-extr-first-letters mail-extr-all-letters))) +;; (format +;; "\\b\\([a-z][%s]*[%s]\\|[%s][%s]*[a-z][%s]*[%s]\\|[%s][%s]*[a-z]\\)" +;; mail-extr-all-letters mail-extr-last-letters +;; mail-extr-first-letters mail-extr-all-letters mail-extr-all-letters +;; mail-extr-last-letters mail-extr-first-letters mail-extr-all-letters)) ;; Matches a trailing alternative address. ;; #### Match Latin1 letters here too? ;; #### Match _ before @ here too? (defconst mail-extr-alternative-address-pattern - (purecopy "\\(aka *\\)?[a-zA-Z.]+[!@][a-zA-Z.]")) + "\\(aka *\\)?[a-zA-Z.]+[!@][a-zA-Z.]") ;; Matches a variety of trailing comments not including comma-delimited ;; comments. (defconst mail-extr-trailing-comment-start-pattern - (purecopy " [-{]\\|--\\|[+@#>, Mark Feit @@ -386,7 +378,7 @@ by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"." ;; KE9TV KF0NV N1API N3FU N3GZE N3IGS N4KCC N7IKQ N9HHU W4YHF W6ANK WA2SUH ;; WB7VZI N2NJZ NR3G KJ4KK AB4UM AL7NI KH6OH WN3KBT N4TMI W1A N0NZO (defconst mail-extr-ham-call-sign-pattern - (purecopy "\\b\\(DX[0-9]+\\|[AKNW][A-Z]?[0-9][A-Z][A-Z]?[A-Z]?\\)")) + "\\b\\(DX[0-9]+\\|[AKNW][A-Z]?[0-9][A-Z][A-Z]?[A-Z]?\\)") ;; Possible trailing suffixes: "\\(/\\(KT\\|A[AEG]\\|[R0-9]\\)\\)?" ;; /KT == Temporary Technician (has CSC but not "real" license) @@ -400,31 +392,29 @@ by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"." ;; Matches normal single-part name (defconst mail-extr-normal-name-pattern - (purecopy (format "\\b[%s][%s]+[%s]" - mail-extr-first-letters - mail-extr-all-letters-but-separators - mail-extr-last-letters))) + (format "\\b[%s][%s]+[%s]" + mail-extr-first-letters + mail-extr-all-letters-but-separators + mail-extr-last-letters)) ;; Matches a single word name. ;; (defconst mail-extr-one-name-pattern -;; (purecopy (concat "\\`" mail-extr-normal-name-pattern "\\'"))) +;; (concat "\\`" mail-extr-normal-name-pattern "\\'")) ;; Matches normal two names with missing middle initial ;; The first name is not allowed to have a hyphen because this can cause ;; false matches where the "middle initial" is actually the first letter ;; of the second part of the first name. (defconst mail-extr-two-name-pattern - (purecopy - (concat "\\`\\(" mail-extr-normal-name-pattern - "\\|" mail-extr-initial-pattern - "\\) +\\(" mail-extr-name-pattern "\\)\\(,\\|\\'\\)"))) + (concat "\\`\\(" mail-extr-normal-name-pattern + "\\|" mail-extr-initial-pattern + "\\) +\\(" mail-extr-name-pattern "\\)\\(,\\|\\'\\)")) (defconst mail-extr-listserv-list-name-pattern - (purecopy "Multiple recipients of list \\([-A-Z]+\\)")) + "Multiple recipients of list \\([-A-Z]+\\)") (defconst mail-extr-stupid-vms-date-stamp-pattern - (purecopy - "[0-9][0-9]-[JFMASOND][aepuco][nbrylgptvc]-[0-9][0-9][0-9][0-9] [0-9]+ *")) + "[0-9][0-9]-[JFMASOND][aepuco][nbrylgptvc]-[0-9][0-9][0-9][0-9] [0-9]+ *") ;;; HZ -- GB (PRC Chinese character encoding) in ASCII embedding protocol ;; @@ -443,25 +433,23 @@ by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"." ;; mode from GB back to ASCII. (Note that the escape-from-GB code '~}' ;; ($7E7D) is outside the defined GB range.) (defconst mail-extr-hz-embedded-gb-encoded-chinese-pattern - (purecopy "~{\\([^~].\\|~[^}]\\)+~}")) + "~{\\([^~].\\|~[^}]\\)+~}") ;; The leading optional lowercase letters are for a bastardized version of ;; the encoding, as is the optional nature of the final slash. (defconst mail-extr-x400-encoded-address-pattern - (purecopy "[a-z]?[a-z]?\\(/[A-Za-z]+\\(\\.[A-Za-z]+\\)?=[^/]+\\)+/?\\'")) + "[a-z]?[a-z]?\\(/[A-Za-z]+\\(\\.[A-Za-z]+\\)?=[^/]+\\)+/?\\'") (defconst mail-extr-x400-encoded-address-field-pattern-format - (purecopy "/%s=\\([^/]+\\)\\(/\\|\\'\\)")) + "/%s=\\([^/]+\\)\\(/\\|\\'\\)") (defconst mail-extr-x400-encoded-address-surname-pattern ;; S stands for Surname (family name). - (purecopy - (format mail-extr-x400-encoded-address-field-pattern-format "[Ss]"))) + (format mail-extr-x400-encoded-address-field-pattern-format "[Ss]")) (defconst mail-extr-x400-encoded-address-given-name-pattern ;; G stands for Given name. - (purecopy - (format mail-extr-x400-encoded-address-field-pattern-format "[Gg]"))) + (format mail-extr-x400-encoded-address-field-pattern-format "[Gg]")) (defconst mail-extr-x400-encoded-address-full-name-pattern ;; PN stands for Personal Name. When used it represents the combination @@ -469,8 +457,7 @@ by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"." ;; "The one system I used having this field asked it with the prompt ;; `Personal Name'. But they mapped it into G and S on outgoing real ;; X.400 addresses. As they mapped G and S into PN on incoming..." - (purecopy - (format mail-extr-x400-encoded-address-field-pattern-format "[Pp][Nn]"))) + (format mail-extr-x400-encoded-address-field-pattern-format "[Pp][Nn]")) -- cgit v1.2.3 From c6f676154581ce6a4a59b5c12e1e3b6ee685fe19 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 10 Jul 2022 20:07:37 +0200 Subject: ; * lisp/emacs-lisp/ert-x.el (tramp-remote-path): Fix last change. --- lisp/emacs-lisp/ert-x.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index 21a967cb4c9..4436d0a4b16 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -493,7 +493,7 @@ The same keyword arguments are supported as in (defvar tramp-remote-path) ;; This should happen on hydra only. -(when (getenv "EMACS_HYDRA_CI") +(when (and (featurep 'tramp) (getenv "EMACS_HYDRA_CI")) (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) ;; If this defconst is used in a test file, `tramp' shall be loaded -- cgit v1.2.3 From 693929bf48be866763edd5bc2b6e2745bec134cf Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 26 Dec 2021 21:59:16 +0100 Subject: Make crm-default-separator obsolete as per FIXME * lisp/emacs-lisp/crm.el (crm-default-separator): Make into obsolete variable alias for crm-separator. (crm-separator): Update docstring for above change. --- lisp/emacs-lisp/crm.el | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el index 9d9c91e510e..9c49e095783 100644 --- a/lisp/emacs-lisp/crm.el +++ b/lisp/emacs-lisp/crm.el @@ -77,15 +77,9 @@ ;;; Code: -;; FIXME I don't see that this needs to exist as a separate variable. -;; crm-separator should suffice. -(defconst crm-default-separator "[ \t]*,[ \t]*" - "Default value of `crm-separator'.") - -(defvar crm-separator crm-default-separator +(defvar crm-separator "[ \t]*,[ \t]*" "Separator regexp used for separating strings in `completing-read-multiple'. -It should be a regexp that does not match the list of completion candidates. -The default value is `crm-default-separator'.") +It should be a regexp that does not match the list of completion candidates.") (defvar-keymap crm-local-completion-map :doc "Local keymap for minibuffer multiple input with completion. @@ -300,6 +294,8 @@ with empty strings removed." ;(completing-read my-prompt my-table nil t) ;(completing-read my-prompt my-table nil "match") +(define-obsolete-variable-alias 'crm-default-separator 'crm-separator "29.1") + (provide 'crm) ;;; crm.el ends here -- cgit v1.2.3 From 8ab9102950e9476c0d0d1cbecfd7c1dd22141a5f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 11 Jul 2022 12:15:04 +0200 Subject: Fix `M-x lisp-fill-paragraph' * lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): Fix filling when called directly with `M-x lisp-fill-paragraph' instead of via `M-q' (bug#56476). --- lisp/emacs-lisp/lisp-mode.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 68528e199f8..c906ee6e31d 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1466,7 +1466,10 @@ and initial semicolons." emacs-lisp-docstring-fill-column fill-column))) (let ((ppss (syntax-ppss)) - (start (point))) + (start (point)) + ;; Avoid recursion if we're being called directly with + ;; `M-x lisp-fill-paragraph' in an `emacs-lisp-mode' buffer. + (fill-paragraph-function t)) (save-excursion (save-restriction ;; If we're not inside a string, then do very basic -- cgit v1.2.3 From bebf39f292f1963ab980497248a18d8035708d1a Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 11 Jul 2022 12:18:04 +0200 Subject: Autoload named-let * lisp/emacs-lisp/subr-x.el (named-let): Autoload `named-let' for easier use (bug#56473). --- lisp/emacs-lisp/subr-x.el | 1 + 1 file changed, 1 insertion(+) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 5159e8784a5..5037ae47e83 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -290,6 +290,7 @@ it makes no sense to convert it to a string using (set-buffer source-buffer) (replace-buffer-contents tmp-buffer max-secs max-costs))))))))) +;;;###autoload (defmacro named-let (name bindings &rest body) "Looping construct taken from Scheme. Like `let', bind variables in BINDINGS and then evaluate BODY, -- cgit v1.2.3 From ade7a212a882540178d9504e7e0bd3be3bf1fd41 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 11 Jul 2022 12:41:50 +0200 Subject: * lisp/emacs-lisp/package.el (define-package): Make obsolete. --- lisp/emacs-lisp/package.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 8d0d5d57a22..00beee811ba 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -720,8 +720,7 @@ REQUIREMENTS is a list of dependencies on other packages. where OTHER-VERSION is a string. EXTRA-PROPERTIES is currently unused." - (declare (indent defun)) - ;; FIXME: Placeholder! Should we keep it? + (declare (obsolete nil "29.1") (indent defun)) (error "Don't call me!")) -- cgit v1.2.3 From 2f823ffd28d064fc8c1a3947e74c512b577863c6 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 11 Jul 2022 13:34:35 +0200 Subject: Fix crm.el compilation warning * lisp/emacs-lisp/crm.el (crm-default-separator): Move to avoid compilation warning. --- lisp/emacs-lisp/crm.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el index 9c49e095783..6d4b29b552c 100644 --- a/lisp/emacs-lisp/crm.el +++ b/lisp/emacs-lisp/crm.el @@ -77,6 +77,8 @@ ;;; Code: +(define-obsolete-variable-alias 'crm-default-separator 'crm-separator "29.1") + (defvar crm-separator "[ \t]*,[ \t]*" "Separator regexp used for separating strings in `completing-read-multiple'. It should be a regexp that does not match the list of completion candidates.") @@ -294,8 +296,6 @@ with empty strings removed." ;(completing-read my-prompt my-table nil t) ;(completing-read my-prompt my-table nil "match") -(define-obsolete-variable-alias 'crm-default-separator 'crm-separator "29.1") - (provide 'crm) ;;; crm.el ends here -- cgit v1.2.3 From 5990da629074b09212d7dea31811d0429e3e2fb8 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Mon, 11 Jul 2022 13:43:34 +0200 Subject: Simplify str_to_multibyte and related code * src/character.h (str_to_multibyte): * src/character.c (str_to_multibyte): Remove `nbytes` argument; return it instead. Copy forwards. * src/fns.c (concat_to_string, Fstring_make_multibyte): Use str_to_multibyte. (string_make_multibyte): Remove. (string_to_multibyte): * src/print.c (print_string): Adapt calls. --- lisp/emacs-lisp/byte-opt.el | 2 -- src/character.c | 22 ++++++++++---------- src/character.h | 4 ++-- src/fns.c | 50 +++++++++++++-------------------------------- src/print.c | 2 +- 5 files changed, 28 insertions(+), 52 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 352ac40663c..b7147a7f50f 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1288,8 +1288,6 @@ See Info node `(elisp) Integer Basics'." form)) ;; Fixme: delete-char -> delete-region (byte-coded) -;; optimize string-as-unibyte, string-as-multibyte, string-make-unibyte, -;; string-make-multibyte for constant args. (put 'set 'byte-optimizer #'byte-optimize-set) (defun byte-optimize-set (form) diff --git a/src/character.c b/src/character.c index 841e46c0917..968daccafa7 100644 --- a/src/character.c +++ b/src/character.c @@ -666,26 +666,26 @@ count_size_as_multibyte (const unsigned char *str, ptrdiff_t len) } -/* Convert unibyte text at SRC of NCHARS bytes to a multibyte text - at DST of NBYTES bytes, that contains the same single-byte characters. */ -void +/* Convert unibyte text at SRC of NCHARS chars to a multibyte text + at DST, that contains the same single-byte characters. + Return the number of bytes written at DST. */ +ptrdiff_t str_to_multibyte (unsigned char *dst, const unsigned char *src, - ptrdiff_t nchars, ptrdiff_t nbytes) + ptrdiff_t nchars) { - const unsigned char *s = src + nchars; - unsigned char *d = dst + nbytes; + unsigned char *d = dst; for (ptrdiff_t i = 0; i < nchars; i++) { - unsigned char c = *--s; + unsigned char c = src[i]; if (c <= 0x7f) - *--d = c; + *d++ = c; else { - *--d = 0x80 + (c & 0x3f); - *--d = 0xc0 + ((c >> 6) & 1); + *d++ = 0xc0 + ((c >> 6) & 1); + *d++ = 0x80 + (c & 0x3f); } } - eassert (d == dst && s == src); + return d - dst; } /* Arrange multibyte text at STR of LEN bytes as a unibyte text. It diff --git a/src/character.h b/src/character.h index 36e2b06ee1b..6d0f035c2bb 100644 --- a/src/character.h +++ b/src/character.h @@ -567,8 +567,8 @@ extern int translate_char (Lisp_Object, int c); extern ptrdiff_t count_size_as_multibyte (const unsigned char *, ptrdiff_t); extern ptrdiff_t str_as_multibyte (unsigned char *, ptrdiff_t, ptrdiff_t, ptrdiff_t *); -extern void str_to_multibyte (unsigned char *dst, const unsigned char *src, - ptrdiff_t nchars, ptrdiff_t nbytes); +extern ptrdiff_t str_to_multibyte (unsigned char *dst, const unsigned char *src, + ptrdiff_t nchars); extern ptrdiff_t str_as_unibyte (unsigned char *, ptrdiff_t); extern ptrdiff_t strwidth (const char *, ptrdiff_t); extern ptrdiff_t c_string_width (const unsigned char *, ptrdiff_t, int, diff --git a/src/fns.c b/src/fns.c index 7d8f957ef98..eb83471649e 100644 --- a/src/fns.c +++ b/src/fns.c @@ -856,9 +856,8 @@ concat_to_string (ptrdiff_t nargs, Lisp_Object *args) else { /* Copy a single-byte string to a multibyte string. */ - toindex_byte += copy_text (SDATA (arg), - SDATA (result) + toindex_byte, - nchars, 0, 1); + toindex_byte += str_to_multibyte (SDATA (result) + toindex_byte, + SDATA (arg), nchars); } toindex += nchars; } @@ -1205,37 +1204,6 @@ string_byte_to_char (Lisp_Object string, ptrdiff_t byte_index) return i; } -/* Convert STRING to a multibyte string. */ - -static Lisp_Object -string_make_multibyte (Lisp_Object string) -{ - unsigned char *buf; - ptrdiff_t nbytes; - Lisp_Object ret; - USE_SAFE_ALLOCA; - - if (STRING_MULTIBYTE (string)) - return string; - - nbytes = count_size_as_multibyte (SDATA (string), - SCHARS (string)); - /* If all the chars are ASCII, they won't need any more bytes - once converted. In that case, we can return STRING itself. */ - if (nbytes == SBYTES (string)) - return string; - - buf = SAFE_ALLOCA (nbytes); - copy_text (SDATA (string), buf, SBYTES (string), - 0, 1); - - ret = make_multibyte_string ((char *) buf, SCHARS (string), nbytes); - SAFE_FREE (); - - return ret; -} - - /* Convert STRING (if unibyte) to a multibyte string without changing the number of characters. Characters 0x80..0xff are interpreted as raw bytes. */ @@ -1254,7 +1222,7 @@ string_to_multibyte (Lisp_Object string) return make_multibyte_string (SSDATA (string), nbytes, nbytes); Lisp_Object ret = make_uninit_multibyte_string (nchars, nbytes); - str_to_multibyte (SDATA (ret), SDATA (string), nchars, nbytes); + str_to_multibyte (SDATA (ret), SDATA (string), nchars); return ret; } @@ -1299,7 +1267,17 @@ string the same way whether it is unibyte or multibyte.) */) { CHECK_STRING (string); - return string_make_multibyte (string); + if (STRING_MULTIBYTE (string)) + return string; + + ptrdiff_t nchars = SCHARS (string); + ptrdiff_t nbytes = count_size_as_multibyte (SDATA (string), nchars); + if (nbytes == nchars) + return string; + + Lisp_Object ret = make_uninit_multibyte_string (nchars, nbytes); + str_to_multibyte (SDATA (ret), SDATA (string), nchars); + return ret; } DEFUN ("string-make-unibyte", Fstring_make_unibyte, Sstring_make_unibyte, diff --git a/src/print.c b/src/print.c index 9a31e386f5e..b5a621f80aa 100644 --- a/src/print.c +++ b/src/print.c @@ -467,7 +467,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun) if (chars < bytes) { newstr = make_uninit_multibyte_string (chars, bytes); - str_to_multibyte (SDATA (newstr), SDATA (string), chars, bytes); + str_to_multibyte (SDATA (newstr), SDATA (string), chars); string = newstr; } } -- cgit v1.2.3 From 4c41cef353cc68bbe432dc32fe9edffbea71dc6b Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 11 Jul 2022 14:29:33 +0200 Subject: Move EIEIO autoloads to the common loaddefs.el * lisp/emacs-lisp/eieio-core.el: * lisp/emacs-lisp/eieio-custom.el: * lisp/emacs-lisp/eieio-opt.el: * lisp/obsolete/eieio-compat.el: Remove generated-autoload-file setting and don't require eieio-loaddefs.el. --- lisp/emacs-lisp/eieio-core.el | 1 - lisp/emacs-lisp/eieio-custom.el | 4 ---- lisp/emacs-lisp/eieio-opt.el | 4 ---- lisp/obsolete/eieio-compat.el | 5 ----- 4 files changed, 14 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index 25f2dd40980..5e7b5cbfb2f 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -32,7 +32,6 @@ ;;; Code: (require 'cl-lib) -(require 'eieio-loaddefs nil t) ;;; ;; A few functions that are better in the official EIEIO src, but diff --git a/lisp/emacs-lisp/eieio-custom.el b/lisp/emacs-lisp/eieio-custom.el index 4b8b4275f1a..0bec3bb0d59 100644 --- a/lisp/emacs-lisp/eieio-custom.el +++ b/lisp/emacs-lisp/eieio-custom.el @@ -467,8 +467,4 @@ Return the symbol for the group, or nil." (provide 'eieio-custom) -;; Local variables: -;; generated-autoload-file: "eieio-loaddefs.el" -;; End: - ;;; eieio-custom.el ends here diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el index 72108f807f9..5f67263f177 100644 --- a/lisp/emacs-lisp/eieio-opt.el +++ b/lisp/emacs-lisp/eieio-opt.el @@ -348,8 +348,4 @@ INDENT is the current indentation level." (provide 'eieio-opt) -;; Local variables: -;; generated-autoload-file: "eieio-loaddefs.el" -;; End: - ;;; eieio-opt.el ends here diff --git a/lisp/obsolete/eieio-compat.el b/lisp/obsolete/eieio-compat.el index 2ac75293fcc..ead9352695c 100644 --- a/lisp/obsolete/eieio-compat.el +++ b/lisp/obsolete/eieio-compat.el @@ -253,11 +253,6 @@ Summary: (declare (obsolete eieio-defclass-internal "25.1")) (eval `(defclass ,cname ,superclasses ,slots ,@options))) - -;; Local Variables: -;; generated-autoload-file: "eieio-loaddefs.el" -;; End: - (provide 'eieio-compat) ;;; eieio-compat.el ends here -- cgit v1.2.3 From 04610218939e377b4fe2992e1f5571e34ccd7e1a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 11 Jul 2022 16:48:24 +0300 Subject: ; * lisp/emacs-lisp/comp.el (native-comp-speed): Explain the -1 value. --- lisp/emacs-lisp/comp.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index a363bed3642..7d09d2425b2 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -45,7 +45,9 @@ (defcustom native-comp-speed 2 "Optimization level for native compilation, a number between -1 and 3. - -1 functions are kept in bytecode form and no native compilation is performed. + -1 functions are kept in bytecode form and no native compilation is performed + (but *.eln files are still produced, and include the compiled code in + bytecode form). 0 native compilation is performed with no optimizations. 1 light optimizations. 2 max optimization level fully adherent to the language semantic. -- cgit v1.2.3 From ba0871bef1e7d321f1124a6ad20e9be158a976dd Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 13 Jul 2022 13:00:31 +0200 Subject: ; Fix typos: prefer American spelling --- ChangeLog.2 | 6 +- ChangeLog.3 | 440 +++++++++++++++--------------- admin/notes/spelling | 2 +- doc/lispref/searching.texi | 4 +- doc/lispref/text.texi | 2 +- doc/lispref/variables.texi | 4 +- doc/misc/gnus.texi | 2 +- doc/misc/modus-themes.org | 6 +- doc/misc/org.org | 4 +- doc/misc/tramp.texi | 4 +- etc/NEWS | 8 +- etc/ORG-NEWS | 20 +- etc/themes/modus-themes.el | 2 +- lisp/ChangeLog.17 | 2 +- lisp/ChangeLog.9 | 2 +- lisp/elec-pair.el | 2 +- lisp/emacs-lisp/byte-opt.el | 22 +- lisp/emacs-lisp/eldoc.el | 2 +- lisp/faces.el | 2 +- lisp/gnus/ChangeLog.3 | 2 +- lisp/icomplete.el | 2 +- lisp/net/shr.el | 2 +- lisp/net/tramp.el | 2 +- lisp/org/ChangeLog.1 | 4 +- lisp/progmodes/bug-reference.el | 2 +- lisp/progmodes/flymake.el | 4 +- lisp/progmodes/gdb-mi.el | 2 +- lisp/ses.el | 2 +- lisp/so-long.el | 8 +- lisp/windmove.el | 2 +- src/xfaces.c | 2 +- test/ChangeLog.1 | 2 +- test/lisp/calc/calc-tests.el | 2 +- test/lisp/emacs-lisp/bytecomp-tests.el | 8 +- test/lisp/so-long-tests/spelling-tests.el | 2 +- 35 files changed, 292 insertions(+), 292 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/ChangeLog.2 b/ChangeLog.2 index cf19abaa138..5a73d53b8bf 100644 --- a/ChangeLog.2 +++ b/ChangeLog.2 @@ -4040,7 +4040,7 @@ * lisp/progmodes/xref.el (xref--query-replace-1): Say 'All results processed' at the end if the user hadn't - cancelled the process (bug#23284). + canceled the process (bug#23284). 2016-05-07 Eli Zaretskii @@ -12542,7 +12542,7 @@ * lisp/erc/erc-backend.el (erc-server-setup-periodical-ping): Checks for existing timers in the alist before adding new ones. If a - timer already exists, it is cancelled and + timer already exists, it is canceled and overwritten. (bug#19292). 2015-12-27 Jens Lechtenboerger @@ -22108,7 +22108,7 @@ * src/gfilenotify.c (dir_monitor_callback): Cancel the monitor if the file or directory to be watched is deleted. (Fgfile_add_watch): Make watch_object a triple. - (Fgfile_rm_watch): Check, whether watch is cancelled already. + (Fgfile_rm_watch): Check, whether watch is canceled already. (Fgfile_valid_p): New defun. (syms_of_gfilenotify): Declare Sgfile_valid_p. diff --git a/ChangeLog.3 b/ChangeLog.3 index d0ff14117be..9de03321494 100644 --- a/ChangeLog.3 +++ b/ChangeLog.3 @@ -740,7 +740,7 @@ This is a partial backport from master: it only includes the changes below. * lib/mini-gmp.c (gmp_assert_nocarry): Avoid many Clang - unused-variable warnings when building with optimisation. + unused-variable warnings when building with optimization. * lib/verify.h (_GL_HAVE__STATIC_ASSERT): Modify condition for using _Static_assert to cope with older Apple builds of Clang exposing misleading compiler version numbers. See discussion starting at @@ -1381,10 +1381,10 @@ 2022-03-06 Lars Ingebrigtsen - Restore documented Emacs 27.2 behaviour of browse-url-of-dired-file + Restore documented Emacs 27.2 behavior of browse-url-of-dired-file * lisp/net/browse-url.el (browse-url-of-dired-file): Restore the - documented behaviour -- open a web browser instead of passing to + documented behavior -- open a web browser instead of passing to the various handlers. 2022-03-06 Kyle Meyer @@ -2244,7 +2244,7 @@ This fixes bug #52796. * lisp/progmodes/cc-engine.el (c-update-brace-stack): Handle a "*" like a - semicolon, cancelling the expectation of a brace. + semicolon, canceling the expectation of a brace. * lisp/progmodes/cc-langs.el (c-brace-stack-thing-key): Add a "*" into the sets of significant characters. @@ -2818,7 +2818,7 @@ 2021-12-01 Alan Mackenzie - CC Mode: Recognise "struct foo {" as introducing a type declaration + CC Mode: Recognize "struct foo {" as introducing a type declaration This fixes bug #52157. @@ -2904,7 +2904,7 @@ 2021-11-29 Andreas Schwab - Avoid undefined behaviour when copying part of structure + Avoid undefined behavior when copying part of structure * src/dispnew.c (copy_row_except_pointers): Don't use address of subobject as starting point. @@ -6061,14 +6061,14 @@ Fix previous `newline' patch * lisp/simple.el (newline): Signal an error earlier to avoid - peculiar behaviour after getting a backtrace (bug#50900). + peculiar behavior after getting a backtrace (bug#50900). 2021-09-30 Lars Ingebrigtsen Make `newline' check the argument earlier * lisp/simple.el (newline): Signal an error earlier to avoid - peculiar behaviour after getting a backtrace (bug#50900). + peculiar behavior after getting a backtrace (bug#50900). 2021-09-30 akater @@ -6249,7 +6249,7 @@ etc/themes/modus-vivendi-theme.el: Bump file version. * etc/themes/modus-themes.el (modus-themes-operandi-colors) - (modus-themes-vivendi-colors): Recalibrate some colour values and add + (modus-themes-vivendi-colors): Recalibrate some color values and add a few new ones. (modus-themes-slanted-constructs): Remove obsolete user option. Superseded by the alias 'modus-themes-italic-constructs'. @@ -7105,11 +7105,11 @@ Fix byte-compiler crash for legal dynamic-binding code - This should really be taken care of by a syntax normalisation step in + This should really be taken care of by a syntax normalization step in the frontend, but there is no such step for non-lexbind code yet. * lisp/emacs-lisp/byte-opt.el (byte-optimize-letX): Tolerate bindingsa - without initialising expressions. + without initializing expressions. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test cases. @@ -8168,7 +8168,7 @@ This reverts commit 7e395a59b025c7f4be49294ad806addf5b1a25c9. - The behaviour change isn't good for the majority of tar files. + The behavior change isn't good for the majority of tar files. 2021-09-21 Lars Ingebrigtsen @@ -8180,10 +8180,10 @@ 2021-09-21 Lars Ingebrigtsen - Restore some of the previous behaviour in whitespace-display-window + Restore some of the previous behavior in whitespace-display-window * lisp/whitespace.el (whitespace-display-window): Emulate previous - behaviour (bug#50716). Code from martin rudalics . + behavior (bug#50716). Code from martin rudalics . 2021-09-21 Lars Ingebrigtsen @@ -8400,7 +8400,7 @@ Add docstring for 'electric-pair-p-s-i-f' and minor refactor - Extract the "open newline between pairs behaviour" into its own + Extract the "open newline between pairs behavior" into its own function, electric-pair-open-newline-between-pairs-psif. * lisp/elec-pair.el (electric-pair-post-self-insert-function): Add @@ -8640,7 +8640,7 @@ 2021-09-20 Philip Kaludercic - Fix dolist-with-progress-reporter behaviour + Fix dolist-with-progress-reporter behavior * lisp/subr.el (dolist-with-progress-reporter): Use the length of list argument as maximal value the reporter with reach. @@ -8725,17 +8725,17 @@ 2021-09-19 Mattias Engdegård - Initialise unread buffer + Initialize unread buffer The reader has an extra 1-char unread buffer that was incorrectly - initialised to 0, which means that the first character read would + initialized to 0, which means that the first character read would always be NUL. As this is often the code that looks for the lexical-binding cookie, the first loaded source module would be treated as dynamically bound. During bootstrapping this is loadup.el and so its local variables got dumped into the global environment. - * src/lread.c (unread_char): Initialise to empty. - (Fload): Initialise here too just in case. + * src/lread.c (unread_char): Initialize to empty. + (Fload): Initialize here too just in case. 2021-09-19 Stefan Kangas @@ -10710,11 +10710,11 @@ Replace uses of a variable aliasing another variable with that aliased variable, to allow for variable removal when possible. This also - enables opportunities for other optimisations. Example: + enables opportunities for other optimizations. Example: (let ((y x)) (f y)) => (f x) - The optimisation is only performed if both aliased and aliasing + The optimization is only performed if both aliased and aliasing variables are lexically bound. Shadowing bindings are α-renamed when necessary for correctness. Example: @@ -10724,7 +10724,7 @@ * lisp/emacs-lisp/byte-opt.el (byte-optimize--aliased-vars): New. (byte-optimize-form-code-walker): Cancel aliasing upon mutation. (byte-optimize--rename-var-body, byte-optimize--rename-var): New. - (byte-optimize-let-form): Add the optimisation. + (byte-optimize-let-form): Add the optimization. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add relevant test cases. @@ -11458,31 +11458,31 @@ 2021-09-06 Mattias Engdegård - Normalise nested `progn` forms in byte-code optimiser + Normalize nested `progn` forms in byte-code optimizer * lisp/emacs-lisp/byte-opt.el (byte-optimize-body): Flatten body. This simplifies the source tree and reduces the number of different - cases that other optimisations need to take into account. + cases that other optimizations need to take into account. 2021-09-06 Mattias Engdegård - More robust optimisation of `ignore` + More robust optimization of `ignore` - Treat `ignore` as any other function during source-level optimisation, - to avoid having its warning-suppression effects cancelled by repeated + Treat `ignore` as any other function during source-level optimization, + to avoid having its warning-suppression effects canceled by repeated passes. Instead, define a custom code generation function. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't treat `ignore' specially here. (side-effect-free-fns): Don't mark `ignore` as side-effect-free - or error-free (although it is), since that would allow the optimiser + or error-free (although it is), since that would allow the optimizer to elide calls. * lisp/emacs-lisp/bytecomp.el (ignore, byte-compile-ignore): Define and register a code-gen function. 2021-09-06 Mattias Engdegård - Optimise `member` and `assoc` (etc) with constant empty list + Optimize `member` and `assoc` (etc) with constant empty list * lisp/emacs-lisp/byte-opt.el (byte-optimize-assq): New. @@ -12720,7 +12720,7 @@ This reverts commit c8e3347ec01a9ed6dc8d88c2dbbb3a08497e8eb2. - Jim Porter's paperwork isn't finalised yet. + Jim Porter's paperwork isn't finalized yet. 2021-08-26 Lars Ingebrigtsen @@ -15567,11 +15567,11 @@ The current method of propagating constants through setq was unsound because it relied on each setq form only being traversed at most once - during optimisation, which isn't necessarily true in general; it could + during optimization, which isn't necessarily true in general; it could be made to miscompile code in rare cases. Since it was only used in limited circumstances, disabling this - optimisation doesn't cost us much. + optimization doesn't cost us much. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't update the known value when traversing `setq`. @@ -15809,7 +15809,7 @@ 2021-08-03 Phil Sainty - Make `global-so-long-mode' handle unrecognised file types + Make `global-so-long-mode' handle unrecognized file types * lisp/so-long.el (so-long-target-modes): Add `fundamental-mode' @@ -16299,16 +16299,16 @@ Ensure in cconv that let-bindings have the normal form (VAR EXPR) where VAR is a valid variable name, so that we don't need to keep - re-checking this all the time in the optimiser. + re-checking this all the time in the optimizer. * lisp/emacs-lisp/byte-opt.el (byte-optimize-enable-variable-constprop) (byte-optimize-warn-eliminated-variable): Remove; these were mainly used for debugging. * lisp/emacs-lisp/byte-opt.el (byte-optimize-let-form): - Assume normalised let-bindings (with lexical-binding). + Assume normalized let-bindings (with lexical-binding). Stop using the variables removed above. - * lisp/emacs-lisp/cconv.el (cconv-convert): Ensure normalised + * lisp/emacs-lisp/cconv.el (cconv-convert): Ensure normalized let-bindings. Malformed bindings are dropped after warning. remove byte-optimize-warn-eliminated-variable @@ -16400,7 +16400,7 @@ 2021-07-30 Mattias Engdegård - Optimise let and let* whose body is constant or the last variable + Optimize let and let* whose body is constant or the last variable Simplify (let ((X1 E1) ... (Xn En)) Xn) => (progn E1 ... En) @@ -16409,9 +16409,9 @@ => (let* ((X1 E1) ... (Xn-1 En-1)) En) and similarly the case where the body is a constant, extending a - previous optimisation that only applied to the constant nil. + previous optimization that only applied to the constant nil. This reduces the number of bound variables, shortens the code, and - enables further optimisations. + enables further optimizations. * lisp/emacs-lisp/byte-opt.el (byte-optimize-letX): Rewrite using `pcase` and add the aforementioned transformations. @@ -16420,7 +16420,7 @@ 2021-07-30 Mattias Engdegård - Move warnings about bad let-bindings from source optimiser to cconv + Move warnings about bad let-bindings from source optimizer to cconv * lisp/emacs-lisp/byte-opt.el (byte-optimize-let-form): Move warnings... * lisp/emacs-lisp/cconv.el (cconv-convert): ...here, which is an @@ -16428,7 +16428,7 @@ 2021-07-30 Mattias Engdegård - Optimise prog1 better + Optimize prog1 better Rewrite (prog1 CONST FORMS...) => (progn FORMS... CONST) where CONST is a compile-time constant, because putting the value last @@ -16440,23 +16440,23 @@ 2021-07-30 Mattias Engdegård - Elide lexical variables in for-effect context in source optimiser + Elide lexical variables in for-effect context in source optimizer * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Remove for-effect uses of lexical variables. We previously relied on - this being done by the lapcode peephole optimiser but at source level - it enables more optimisation opportunities. + this being done by the lapcode peephole optimizer but at source level + it enables more optimization opportunities. Keywords are elided for the same reason. 2021-07-30 Mattias Engdegård - Single source optimiser entry point + Single source optimizer entry point - Make the optimiser aware of lexical arguments. Otherwise we cannot + Make the optimizer aware of lexical arguments. Otherwise we cannot know for sure whether a variable is lexical or dynamic during traversal. - * lisp/emacs-lisp/byte-opt.el (byte-optimize-one-form): New optimiser + * lisp/emacs-lisp/byte-opt.el (byte-optimize-one-form): New optimizer entry point, replacing the recursive byte-optimize-form. * lisp/emacs-lisp/bytecomp.el (byte-optimize-one-form): Autoload. (byte-compile-keep-pending, byte-compile-top-level): @@ -17377,7 +17377,7 @@ `term-char-mode' doc string clarification - * lisp/term.el (term-char-mode): Document behaviour (bug#49186). + * lisp/term.el (term-char-mode): Document behavior (bug#49186). 2021-07-22 Dmitry Gutov @@ -17614,14 +17614,14 @@ 2021-07-21 Mattias Engdegård - Fix mistake in `quote` optimiser + Fix mistake in `quote` optimizer Found by Pip Cet. * lisp/emacs-lisp/byte-opt.el (byte-optimize-quote): Fix mistake that - made this optimiser ineffective at removing quoting of nil, t, and + made this optimizer ineffective at removing quoting of nil, t, and keywords. The only obvious consequence is that we no longer need... - (byte-optimize-form): ...a 'nil => nil normalising step here; remove. + (byte-optimize-form): ...a 'nil => nil normalizing step here; remove. (byte-optimize-form-code-walker): Make the compiler warn about (quote). 2021-07-20 Juri Linkov @@ -17650,7 +17650,7 @@ Strength-reduce (eq X nil) to (not X) - * lisp/emacs-lisp/byte-opt.el (byte-optimize-eq): New optimisation, + * lisp/emacs-lisp/byte-opt.el (byte-optimize-eq): New optimization, which results in better test and branch code generation where it applies. @@ -18263,7 +18263,7 @@ (Full support for packages or face groups): Include new items. - (Notes on individual packages): Add notes on Avy hints, the colour of + (Notes on individual packages): Add notes on Avy hints, the color of days in 'M-x calendar', and underlines in 'compilation-mode' buffers. (What is the best setup for legibility?): Remove single word. @@ -19806,7 +19806,7 @@ * etc/emacs-mail.desktop: * etc/emacsclient.desktop: Automatically try to reuse an existing frame, open a new frame, or start a new Emacs - daemon. Add actions for specific behaviours (bug#49195). + daemon. Add actions for specific behaviors (bug#49195). 2021-06-30 Peter Oliver @@ -21873,7 +21873,7 @@ 2021-06-03 Mattias Engdegård - Optimise (cons X nil) to (list X) + Optimize (cons X nil) to (list X) * lisp/emacs-lisp/byte-opt.el (byte-optimize-cons): New function. @@ -22136,7 +22136,7 @@ When used with Fido, completions scroll like a typical dropdown widget. - If the dropdown behaviour is desired for Icomplete (instead of + If the dropdown behavior is desired for Icomplete (instead of rotation), icomplete-scroll can be adjusted separately by the user. * etc/NEWS (icomplete-vertical-mode): Reword. @@ -22784,7 +22784,7 @@ Don't propagate lexical variables into inlined functions - Functions compiled when inlined (thus from inside the optimiser) + Functions compiled when inlined (thus from inside the optimizer) mustn't retain the lexical environment of the caller or there will be tears. See discussion at https://lists.gnu.org/archive/html/emacs-devel/2021-05/msg01227.html . @@ -23028,7 +23028,7 @@ 2021-05-25 Miha Rihtaršič - Try to not prioritise reading from lower file descriptors + Try to not prioritize reading from lower file descriptors * src/process.c (wait_reading_process_output): When looping through fds, continue from where we left off. @@ -25525,7 +25525,7 @@ 2021-05-04 Lars Ingebrigtsen - Fix inconsistent behaviour in find-file-noselect when using nowarn + Fix inconsistent behavior in find-file-noselect when using nowarn * lisp/files.el (after-find-file): Behave the same in when warning/not warning (bug#47850). This fixes this test case: @@ -25595,7 +25595,7 @@ 2021-05-03 Alan Third martin rudalics - Fix incorrect resizing behaviour on macOS (bug#48157, bug#48162) + Fix incorrect resizing behavior on macOS (bug#48157, bug#48162) * src/nsterm.m ([EmacsView viewDidResize:]): The drawing buffer can be resized independently of Emacs's idea of the frame size. @@ -28650,10 +28650,10 @@ 2021-04-09 Mattias Engdegård - Fix condition-case optimiser bug + Fix condition-case optimizer bug * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't - perform incorrect optimisations when a condition-case variable shadows + perform incorrect optimizations when a condition-case variable shadows another lexical variable. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): New test case. @@ -28762,7 +28762,7 @@ Self-TCO in `condition-case` error handlers - * lisp/emacs-lisp/cl-macs.el (cl--self-tco): Recognise + * lisp/emacs-lisp/cl-macs.el (cl--self-tco): Recognize `condition-case` handlers as being in the tail position. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--labels): Extend test. @@ -29248,7 +29248,7 @@ 2021-04-05 Stefan Kangas - Remove local uniquify functions in favour of seq-uniq + Remove local uniquify functions in favor of seq-uniq * lisp/emacs-lisp/seq.el (seq-uniq): Add autoload cookie. * lisp/pcomplete.el: (pcomplete-uniquify-list): Use seq-uniq. @@ -29274,7 +29274,7 @@ Obsolete local list functions in shadowfile.el - * lisp/shadowfile.el (shadow-union): Make obsolete in favour of + * lisp/shadowfile.el (shadow-union): Make obsolete in favor of cl-union. Update callers. (shadow-find): Make into obsolete function alias for seq-find. Update callers. @@ -31577,7 +31577,7 @@ 2021-03-18 Mattias Engdegård - Optimise tail calls in `and` and `or` forms in `cl-labels` functions + Optimize tail calls in `and` and `or` forms in `cl-labels` functions * lisp/emacs-lisp/cl-macs.el (cl--self-tco): Handle `and` and `or`. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--labels): @@ -31695,7 +31695,7 @@ 2021-03-18 Lars Ingebrigtsen - Recognise "Verify password" as a password prompt + Recognize "Verify password" as a password prompt * lisp/comint.el (comint-password-prompt-regexp): Also react to "Verify password" (output by "zip -e") (bug#47209). @@ -35655,7 +35655,7 @@ * lisp/emacs-lisp/rx.el (rx): Add (pred stringp) to avoid type errors, and replace the `pred` clause for the actual match with something that - works with pcase-let(*) without being optimised away. + works with pcase-let(*) without being optimized away. * test/lisp/emacs-lisp/rx-tests.el (rx-pcase): Add test cases. 2021-02-26 Stefan Kangas @@ -37602,7 +37602,7 @@ test/lisp/calendar/icalendar-resources/import-rrule-yearly.diary-iso: * test/lisp/calendar/icalendar-tests.el (icalendar-convert-anniversary-to-ical): - Match new diary-anniversary/yearly-rrule behaviour. + Match new diary-anniversary/yearly-rrule behavior. * lisp/calendar/icalendar.el (icalendar--datestring-to-isodate): Add year-shift option. (icalendar--convert-anniversary-to-ical): Shift @@ -38022,7 +38022,7 @@ * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Keep `minor-modes' updated. * src/buffer.c (bset_minor_modes, Fmake_indirect_buffer) - (reset_buffer, init_buffer_once): Initialise `minor-modes'. + (reset_buffer, init_buffer_once): Initialize `minor-modes'. (syms_of_buffer): Add `minor-modes' as a new permanently-local variable. @@ -38399,10 +38399,10 @@ 2021-02-12 Mattias Engdegård - Avoid traversing dead `if` branches in bytecode optimiser + Avoid traversing dead `if` branches in bytecode optimizer There is no point in traversing conditional branches that are - statically known never to be executed. This saves some optimisation + statically known never to be executed. This saves some optimization effort, but more importantly prevents variable assignments and references in those branches from blocking effective constant propagation. @@ -38412,9 +38412,9 @@ assignments. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form): - Rewrite the (tail) recursion into an explicit loop. Normalise a + Rewrite the (tail) recursion into an explicit loop. Normalize a return value of (quote nil) to nil, for easier subsequent - optimisations. + optimizations. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't traverse dead `if` branches. Use unconditional traversion context when possible. @@ -38974,7 +38974,7 @@ Make texinfmt-version variable obsolete * lisp/textmodes/texinfmt.el (texinfmt-version): Make variable and - command obsolete in favour of 'emacs-version'. + command obsolete in favor of 'emacs-version'. (texinfo-format-region, texinfo-format-buffer-1): Use 'emacs-version' instead of above obsolete variable. @@ -39645,7 +39645,7 @@ (let ((x (+ 2 3))) (f x)) => (f 5) This reduces code size, eliminates stack operations, and enables - further optimisations. The implementation is conservative, and is + further optimizations. The implementation is conservative, and is strongly curtailed by the presence of variable mutation, conditions and loops. @@ -40828,7 +40828,7 @@ 2021-01-31 Alan Mackenzie - Minimise the time Vminibuffer_list is in an inconsistent state (src/minibuf.c) + Minimize the time Vminibuffer_list is in an inconsistent state (src/minibuf.c) src/minibuf.c (get_minibuffer): Move the XSETCAR which writes the new minibuffer into Vminibuffer_list to immediately after the MB's creation, so @@ -43203,7 +43203,7 @@ * lisp/emacs-lisp/checkdoc.el (checkdoc-ispell-init): Always send the Lisp words to the process (bug#6221). This allows an existing - ispell process to be correctly initialised. + ispell process to be correctly initialized. 2021-01-20 Juri Linkov @@ -43500,7 +43500,7 @@ Parse square root sign in embedded Calc mode - * lisp/calc/calc-lang.el (math-read-big-rec): Recognise √ since it may + * lisp/calc/calc-lang.el (math-read-big-rec): Recognize √ since it may be used in Big mode. 2021-01-19 Mattias Engdegård @@ -45070,7 +45070,7 @@ * lisp/textmodes/paragraphs.el (mark-paragraph): Revert eb090f65ceb0ae8a90829e911694348583135ba5 (bug#45318). This restores - the behaviour from Emacs 27 -- further work is needed on this patch. + the behavior from Emacs 27 -- further work is needed on this patch. 2021-01-07 Michael Albinus @@ -47854,7 +47854,7 @@ c-laomib-loop. Insert code which calls c-laomib-loop minimally, with the help of the new cache. - * lisp/progmodes/cc-mode.el (c-basic-common-init): Initialise the new cach + * lisp/progmodes/cc-mode.el (c-basic-common-init): Initialize the new cach (at mode start). (c-before-change): Invalidate the new cache. (c-fl-decl-start): Add an extra check (> (point) bod-lim) to prevent looping. @@ -49336,7 +49336,7 @@ 2020-12-14 Alan Mackenzie - Optimise c-font-lock-<>-arglists, particularly for buffers with few <..> pairs + Optimize c-font-lock-<>-arglists, particularly for buffers with few <..> pairs * lisp/progmodes/cc-fonts.el (c-font-lock-<>-arglists): In place of a regexp search for a complicated and slow regexp, search simply for "<" outside of @@ -49357,7 +49357,7 @@ 2020-12-14 Alan Mackenzie - Optimise c-parse-state for large buffers with few (if any) braces. + Optimize c-parse-state for large buffers with few (if any) braces. * lisp/progmodes/cc-engine.el (c-get-fallback-scan-pos): Search a maximum of 50,000 characters back for the two BODs. Return nil if we dont' find them. @@ -50555,7 +50555,7 @@ * test/src/casefiddle-tests.el (casefiddle-tests-char-casing): (upcase ?ß) now returns ?ẞ (U+7838), partly for technical reasons but - the previous behaviour was arbitrary and arguably less useful. + the previous behavior was arbitrary and arguably less useful. Correct upcasing of ß is normally SS, which is what Fupcase returns if given a string, or (for special purposes) ẞ. @@ -50644,7 +50644,7 @@ exactly what the output looks like (see https://github.com/JetBrains/kotlin/commit/\ ffe8ae3840d7b9bdc82170c8181031f05ced68bd) and there is no reason to - risk mismatches or expensive backtracking (bug#18109). Recognise + risk mismatches or expensive backtracking (bug#18109). Recognize 'info' level messages. Convert to rx. 2020-12-09 Lars Ingebrigtsen @@ -50724,7 +50724,7 @@ 2020-12-09 Mattias Engdegård - Recognise ß properly as a lower-case letter (bug#11309) + Recognize ß properly as a lower-case letter (bug#11309) ß was incorrectly treated as a caseless character and thus not matched by the regexp [[:lower:]] (or, in case-folding mode, [[:upper:]]). @@ -52985,7 +52985,7 @@ Remove keyboard anachronisms from tutorial * etc/tutorials/TUTORIAL: Don't keep referring to EDIT as if it were a - common name for the Meta key; since a few decades back it's labelled + common name for the Meta key; since a few decades back it's labeled Alt (or Option or ⌥ but those keys usually also have 'alt' engraved on them). Similarly, CTL is practically extinct and not worth mentioning. @@ -54086,7 +54086,7 @@ 2020-11-19 Mattias Engdegård - More string-search optimisations + More string-search optimizations All-ASCII strings cannot have substrings with non-ASCII characters in them; use this fact to avoid searching entirely. @@ -55761,7 +55761,7 @@ 2020-11-09 Harald Jörg - cperl-mode: Indentation of ')' follows customisation + cperl-mode: Indentation of ')' follows customization * lisp/progmodes/cperl-mode.el (cperl-style-alist): Add cperl-close-paren-offset to the settings for PBP style. @@ -56835,7 +56835,7 @@ * lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Only document the values we want to support, not the ones we actually support. - (define-minor-mode): Partially revert to previous behaviour. + (define-minor-mode): Partially revert to previous behavior. 2020-11-01 Stefan Kangas @@ -57163,7 +57163,7 @@ Since a supplied test function can do anything, assoc is not side-effect-free (bug#44018). However, with only two arguments it is - pure and should be optimised accordingly. + pure and should be optimized accordingly. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Remove 'assoc'. (byte-optimize-assoc): Constant-propagate through 2-arg assoc calls. @@ -57767,7 +57767,7 @@ Remove unused function in gdb-mi.el * lisp/progmodes/gdb-mi.el (gdb-var-evaluate-expression-handler): - Remove. (It was left behind in an old code reorganisation.) + Remove. (It was left behind in an old code reorganization.) 2020-10-27 Lars Ingebrigtsen @@ -58100,7 +58100,7 @@ (shortdoc-section): Remove colors. (shortdoc-separator): New face. (shortdoc-display-group, shortdoc--display-function): Don't use - background colours, because that makes things harder to read. + background colors, because that makes things harder to read. Separate with a horizontal line instead. 2020-10-26 Andrea Corallo @@ -58386,7 +58386,7 @@ * lisp/emacs-lisp/eldoc.el: (eldoc-echo-area-prefer-doc-buffer): Rename from eldoc-echo-area-prefer-doc-buffer - (eldoc-display-in-echo-area): Rework to honour + (eldoc-display-in-echo-area): Rework to honor eldoc-echo-area-prefer-doc-buffer. 2020-10-24 João Távora @@ -59827,7 +59827,7 @@ mixal-mode: add missed instructions - Synchronises with latest released GNU MDK 1.2.11 + Synchronizes with latest released GNU MDK 1.2.11 * lisp/progmodes/mixal-mode.el (mixal-operation-codes-alist): Add missed instructions: SLB,SRB,JAE,JAO,JXE,JXO. @@ -60030,7 +60030,7 @@ (No mixed fonts): Remove references to MELPA. (How do the themes look like) (Enable and load, Load automatically) - (Configure options prior to loading, Customisation Options) + (Configure options prior to loading, Customization Options) (No mixed fonts, Command prompts, Mode line, Completion UIs) (Fringes, Line highlighting, Matching parentheses, Diffs) (Org mode blocks, Heading styles, Tweak colors (DIY)) @@ -60212,7 +60212,7 @@ Sanitize ical data in gnus-icalendar-event-from-ical * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical): - Sanitise the data before passing it on to the constructor. This + Sanitize the data before passing it on to the constructor. This avoids backtraces on icals with extra, unknown slots (bug#43057). 2020-10-16 Basil L. Contovounesios @@ -60262,7 +60262,7 @@ 2020-10-16 Lars Ingebrigtsen - Restore vc-revision-other-window buffer-changing behaviour + Restore vc-revision-other-window buffer-changing behavior * lisp/vc/vc.el (vc-revision-other-window): This function used to change the current buffer, but this was changed in the previous @@ -60950,14 +60950,14 @@ Add more numeric shortdocs * lisp/emacs-lisp/shortdoc.el (shortdoc-section) - (shortdoc-example): Lighten up colours on light backgrounds. + (shortdoc-example): Lighten up colors on light backgrounds. 2020-10-11 Lars Ingebrigtsen - Tweak shortdoc colours on light backgrounds + Tweak shortdoc colors on light backgrounds * lisp/emacs-lisp/shortdoc.el (shortdoc-section) - (shortdoc-example): Lighten up colours on light backgrounds. + (shortdoc-example): Lighten up colors on light backgrounds. 2020-10-11 Lars Ingebrigtsen @@ -62739,10 +62739,10 @@ 2020-09-30 Lars Ingebrigtsen - Fix isearch-group-* colours on low-colour displays + Fix isearch-group-* colors on low-colour displays * lisp/isearch.el (isearch-group-1): On low-colour displays, just - use the normal isearch colour (bug#43702). + use the normal isearch color (bug#43702). (isearch-group-2 etc): Ditto. 2020-09-30 Lars Ingebrigtsen @@ -62818,13 +62818,13 @@ 2020-09-29 Lars Ingebrigtsen - Fix emacsclient -c foo.txt behaviour with many frames + Fix emacsclient -c foo.txt behavior with many frames * lisp/server.el (server-execute): Pass in whether we opened a new frame or not (bug#43645). (server-switch-buffer): Use this to switch to the requested buffer in the new frame if we have "emacsclient -c foo.txt", and retain - the old behaviour if it's "emacsclient foo.txt". + the old behavior if it's "emacsclient foo.txt". 2020-09-29 Lars Ingebrigtsen @@ -63038,7 +63038,7 @@ 2020-09-27 Mattias Engdegård - Minor string-search optimisations (bug#43598) + Minor string-search optimizations (bug#43598) * src/fns.c (Fstring_search): Perform cheap all-ASCII checks before more expensive ones. Use a faster loop when searching for non-ASCII @@ -63896,7 +63896,7 @@ Speed up shr-insert slightly - * lisp/net/shr.el (shr-insert): Speed up regularising spaces -- + * lisp/net/shr.el (shr-insert): Speed up regularizing spaces -- the vast majority of the spaces are already OK, so transforming " " to " " just takes time. @@ -65867,7 +65867,7 @@ 2020-09-11 Mattias Engdegård - Calc: regularise test names + Calc: regularize test names * test/lisp/calc/calc-tests.el (calc-remove-units, calc-extract-units) (calc-convert-units, calc-bug-23889, calc-trig, calc-format-radix) @@ -66416,7 +66416,7 @@ 2020-09-08 João Távora - Change icomplete-show-matches-on-no-input behaviour for Icomplete only + Change icomplete-show-matches-on-no-input behavior for Icomplete only (Bug#19032), bug#43120 @@ -66552,7 +66552,7 @@ 2020-09-07 João Távora - Better explain behaviour of icomplete--sorted-completions + Better explain behavior of icomplete--sorted-completions * lisp/icomplete.el (icomplete--sorted-completions): Overhaul comment @@ -67923,9 +67923,9 @@ 2020-08-30 Lars Ingebrigtsen - Tweak background colours in shr when there's indentation + Tweak background colors in shr when there's indentation - * lisp/net/shr.el (shr-fill-line): Get the background colour right + * lisp/net/shr.el (shr-fill-line): Get the background color right for the indentation, too. 2020-08-30 Mauro Aranda @@ -68838,7 +68838,7 @@ 2020-08-25 Lars Ingebrigtsen - Extend background colours in shr + Extend background colors in shr * lisp/net/shr.el (shr-colorize-region): Extend backgrounds to the end (bug#43031). This avoid ragged edges to the right when, for @@ -69800,7 +69800,7 @@ * lisp/simple.el (read-extended-command): Allow doing interactive searches over the completions (bug#12490). This restores the - behaviour from Emacs 23 that was lost in Emacs 24. + behavior from Emacs 23 that was lost in Emacs 24. 2020-08-19 Grégoire Jadi @@ -69870,7 +69870,7 @@ 2020-08-19 Tino Calancha - Make thingatpt recognise files names with @ in them + Make thingatpt recognize files names with @ in them * lisp/thingatpt.el (thing-at-point-file-name-chars): Add @ (Bug#24606). @@ -72775,7 +72775,7 @@ Tweak how whitespace-mode marks the end of the buffer * lisp/whitespace.el (whitespace-missing-newline-at-eof): Change - the colours to not be as angry. + the colors to not be as angry. (whitespace-color-on): Don't mark the end of the buffer if point is there. @@ -74455,11 +74455,11 @@ 2020-07-25 Mattias Engdegård - Optimise 3-arg +, - and * + Optimize 3-arg +, - and * Turn (+ a b c) into (+ (+ a b) c), and do the same for - and *. The 2-arg operations have their own bytecode which results in a 1.5× - speed-up. Furthermore, the transform enables other optimisations; for + speed-up. Furthermore, the transform enables other optimizations; for example, (+ a 1 b) -> (+ (1+ a) b). * lisp/emacs-lisp/byte-opt.el (byte-optimize-plus, byte-optimize-minus) @@ -74914,12 +74914,12 @@ 2020-07-17 Lars Ingebrigtsen - Fix NOT-CURRENT behaviour in text-property-search-backward + Fix NOT-CURRENT behavior in text-property-search-backward * lisp/emacs-lisp/text-property-search.el - (text-property-search-backward): Fix inconsistent behaviour of + (text-property-search-backward): Fix inconsistent behavior of S-TAB in eww (and other callers that use the NOT-CURRENT - behaviour) when there are adjacent elements + behavior) when there are adjacent elements (bug#39239). 2020-07-17 Xu Chunyang @@ -75842,7 +75842,7 @@ (eldoc-documentation-compose, eldoc-documentation-default): Handle non-nil, non-string values of elements of eldoc-documentation-functions. Use eldoc--handle-multiline. - (eldoc-print-current-symbol-info): Honour non-nil, non-string + (eldoc-print-current-symbol-info): Honor non-nil, non-string values returned by eldoc-documentation-callback. (eldoc--make-callback): Now also a function. (eldoc-documentation-default, eldoc-documentation-compose): Tweak docstring. @@ -75894,7 +75894,7 @@ 2020-07-07 Mattias Engdegård - Optimise assoc and rassoc with symbol key to assq and rassq + Optimize assoc and rassoc with symbol key to assq and rassq This is the same transformation made for member to memq. @@ -75926,9 +75926,9 @@ 2020-07-06 Mattias Engdegård - Simplify byte-code optimisation of pure functions + Simplify byte-code optimization of pure functions - Most pure functions need no explicit optimisation; we can do away with + Most pure functions need no explicit optimization; we can do away with almost all uses of byte-optimize-predicate (now renamed to byte-optimize-constant-args, since it is not just for predicates). Also remove some superfluous arity warnings. @@ -76176,7 +76176,7 @@ CC Mode: optimize for repeated simple operations. - Do this by recognising that unterminated strings in a buffer are typically + Do this by recognizing that unterminated strings in a buffer are typically going to be few and close together. Also optimize code for C++ attributes. * lisp/progmodes/cc-defs.el (c-previous-single-property-change): New macro. @@ -76492,7 +76492,7 @@ * lisp/gnus/gnus-cloud.el (gnus-cloud-download-data): Return the result of calling `gnus-cloud-update-all' when UPDATE is t, as per the - documented behaviour. (Bug#40280) + documented behavior. (Bug#40280) 2020-06-23 Andrea Corallo @@ -76795,7 +76795,7 @@ * lisp/progmodes/project.el (project-shell): Improve docstring to include information about an implementation detail. - * lisp/progmodes/project.el (project-eshell): Modelled after + * lisp/progmodes/project.el (project-eshell): Modeled after 'project-shell', change default behavior such that we don't create too many eshell buffers by default. Use universal argument to create subsequent buffers. @@ -77656,14 +77656,14 @@ 2020-06-10 Mattias Engdegård - Improved light/dark colour predicate (bug#41544) + Improved light/dark color predicate (bug#41544) - Add a predicate, color-dark-p, for deciding whether a colour is more + Add a predicate, color-dark-p, for deciding whether a color is more readable with black or white as contrast. It has experimentally been shown to be more accurate and robust than the various methods currently employed. - The new predicate compares the relative luminance of the colour to an + The new predicate compares the relative luminance of the color to an empirically determined cut-off value, and it seems to get it right in almost all cases, with no value leading to outright bad results. @@ -77825,14 +77825,14 @@ 2020-06-08 Mattias Engdegård - More robust NS hex colour string parsing + More robust NS hex color string parsing Invalid arguments to color-values, such as "#abcdefg" or "#1234", or valid ones like "#111222333", should not yield nonsense values. * src/nsterm.m (ns_get_color): Only accept "#RGB" strings with 1-4 digits per components, equal number - of digits each, and no trailing characters. Parse 12-bit colours + of digits each, and no trailing characters. Parse 12-bit colors correctly. 2020-06-08 Michael Albinus @@ -78280,7 +78280,7 @@ Make color-distance symmetric and more accurate * src/xfaces.c (color_distance): Don't throw away the low 8 bits of - the colours, and make the function symmetric (bug41544) + the colors, and make the function symmetric (bug41544) (Fcolor_distance): Add caution about this not being a true metric. * test/src/xfaces-tests.el: New file. @@ -78808,7 +78808,7 @@ * lisp/international/ucs-normalize.el (ucs-normalize-hfs-nfd-post-read-conversion) (ucs-normalize-hfs-nfd-pre-write-conversion): - Use save-match-data to avoid match data clobber in normalisation. + Use save-match-data to avoid match data clobber in normalization. * test/lisp/international/ucs-normalize-tests.el (ucs-normalize-save-match-data): New test. @@ -80375,7 +80375,7 @@ 2020-05-14 Mattias Engdegård - Fix customisation of mouse-drag-and-drop-region (bug#41251) + Fix customization of mouse-drag-and-drop-region (bug#41251) Reported by David Ponce. @@ -80811,12 +80811,12 @@ cc-mode: extend regexp used by ‘c-or-c++-mode’ * lisp/progmodes/cc-mode.el (c-or-c++-mode--regexp): Expand the regexp to - match some more C++-only constructs and recognise a few more standard + match some more C++-only constructs and recognize a few more standard C++ header files. Also make sure identifiers start with non-digit. (c-or-c++-mode): Add ‘(interactive)’ declaration. * test/lisp/progmodes/cc-mode-tests.el (c-or-c++-mode): Add test case - for the newly recognised constructs. + for the newly recognized constructs. 2020-05-09 Michal Nazarewicz @@ -82585,7 +82585,7 @@ * src/nsterm.m (ns_parent_window_rect): New function. (NS_PARENT_WINDOW_LEFT_POS): (NS_PARENT_WINDOW_TOP_POS): Move to nsterm.m and simplify. - (ns_set_offset): Fix strange behaviours when using negative values. + (ns_set_offset): Fix strange behaviors when using negative values. (ns_set_window_size): (ns_set_undecorated): ([EmacsView windowDidResize:]): @@ -82701,7 +82701,7 @@ 2020-04-16 Mattias Engdegård - Regularise some file-matching regexps + Regularize some file-matching regexps * admin/authors.el (authors-obsolete-files-regexps) (authors-renamed-files-regexps): Replace ^ and $ with \` and \'. @@ -83231,7 +83231,7 @@ * lisp/progmodes/cl-font-lock.el: Fix header and make it a minor mode - Change copyright to FSF and licence to GPLv3+. + Change copyright to FSF and license to GPLv3+. Tweak Commentary (the code doesn't seem to provide the lambda prettification mentioned). @@ -83624,7 +83624,7 @@ Avoid expensive recoding for ASCII identity cases (bug#40407) - Optimise for the common case of encoding or decoding an ASCII-only + Optimize for the common case of encoding or decoding an ASCII-only string using an ASCII-compatible coding, for file names in particular. * src/coding.c (string_ascii_p): New function. @@ -83956,7 +83956,7 @@ 2020-04-03 Ashish SHUKLA - configure.ac: switch to POSIX sh behaviour + configure.ac: switch to POSIX sh behavior 2020-04-03 Federico Tedin @@ -85925,7 +85925,7 @@ (ns_dumpglyphs_stretch): Remove unused variable. (ns_term_init): ([EmacsWindow setAppearance]): Only compile on macOS. - (ns_mouse_position): Make sure f is initialised on GNUstep. + (ns_mouse_position): Make sure f is initialized on GNUstep. * src/emacs.c (main): Move allocation of autorelease pool to before first use. @@ -87644,7 +87644,7 @@ 2019-11-17 Prepend "unsigned" to MINI_GMP_LIMB_TYPE 2019-11-17 Enable testing with different limb sizes (types) 2019-11-20 Use already defined constants - 2019-11-09 Avoid undefined behaviour with small limb sizes + 2019-11-09 Avoid undefined behavior with small limb sizes 2020-01-26 Paul Eggert @@ -91015,7 +91015,7 @@ 2019-12-26 Mattias Engdegård - Optimise 'while' bodies for effect + Optimize 'while' bodies for effect * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Treat all expressions in the body of 'while' as for-effect, @@ -96974,7 +96974,7 @@ * lisp/progmodes/compile.el (compilation-parse-errors): When 'omake' is enabled, allow error messages to be indented by 0 or 6 spaces instead of any number of spaces, to avoid pathological - behaviour. + behavior. (compilation-error-regexp-alist-alist): Anchor the 'omake' pattern to bol for performance. Repair the 'ruby-Test::Unit' pattern, which relied on the previously over-generous 'omake' hack. @@ -96997,7 +96997,7 @@ Speed up 'maven' compilation error message regexp - Anchor the regexp at line-start to prevent quadratic behaviour when + Anchor the regexp at line-start to prevent quadratic behavior when it doesn't match (bug#39595). It's unclear whether the type tag, like [ERROR], is always present; we keep it optional just in case. @@ -98121,7 +98121,7 @@ Calc: fix interval entry (bug#39040) - * lisp/calc/calc.el (calcDigit-start): Initialise calc-prev-char to + * lisp/calc/calc.el (calcDigit-start): Initialize calc-prev-char to something more reasonable, so that non-algebraic entry of intervals whose start is a single digit, like (1..10), works properly. Reported by Michel Schinz. @@ -98137,7 +98137,7 @@ flymake: fix typo in variable binding (bug#38752) - This mistake was found by an experimental elisp optimiser. + This mistake was found by an experimental elisp optimizer. * lisp/progmodes/flymake-proc.el (flymake-proc-stop-all-syntax-checks): Add missing brackets. @@ -99239,7 +99239,7 @@ Improve sorting of flex completion style with non-nil minibuffer-default - This affects the behaviour of flex completion when there is a default + This affects the behavior of flex completion when there is a default completion and the user hasn't entered any input pattern to flex-match against. It is most visible when icomplete-mode or fido-mode are being used in conjunctio. @@ -99417,7 +99417,7 @@ * lisp/emacs-lisp/regexp-opt.el (regexp-opt): * doc/lispref/searching.texi (Regexp Functions): Be more specific about how the KEEP-ORDER argument actually works. - If nil, the regexp guarantees a longest match; this is the behaviour + If nil, the regexp guarantees a longest match; this is the behavior that many callers implicitly rely on. 2019-12-18 Michael Albinus @@ -101996,7 +101996,7 @@ Handle FC_CHARCELL in xftfont_open * src/xftfont.c (xftfont_open): FC_CHARCELL is apparently an alias - for FC_DUAL used in some east Asian fonts (bug#35079). Modelled + for FC_DUAL used in some east Asian fonts (bug#35079). Modeled after a patch suggested by Kenichi Handa. 2019-11-17 Eli Zaretskii @@ -102147,7 +102147,7 @@ When using this option and editing input, some transient situations may arise that lead to file-name shadowing, but that shouldn't - necessarily lead to auto-delete behaviour, which will be surprising. + necessarily lead to auto-delete behavior, which will be surprising. In '/foo/x/bar', if the user deletes the 'x', shadowing occurs, but probably shouldn't. So, somewhat like ido-mode, only auto-tidy @@ -102863,7 +102863,7 @@ Add extra bindings to fido-mode. * lisp/icomplete.el (icomplete-fido-mode-map) : Add arrows and other - bindings to reproduce ido behaviour. + bindings to reproduce ido behavior. 2019-11-09 Glenn Morris @@ -105275,9 +105275,9 @@ 2019-10-23 Lars Ingebrigtsen - Make Gnus recognise "git am" diffs in all groups + Make Gnus recognize "git am" diffs in all groups - * lisp/gnus/mm-uu.el (mm-uu-diff-groups-regexp): Recognise diffs + * lisp/gnus/mm-uu.el (mm-uu-diff-groups-regexp): Recognize diffs in all groups (bug#32730). 2019-10-22 Stefan Kangas @@ -107975,7 +107975,7 @@ 2019-10-09 Lars Ingebrigtsen - Fix possible initialisation error in shell-mode-map + Fix possible initialization error in shell-mode-map * lisp/shell.el (shell-mode-map): Comint is the parent mode, so there's no need to explicitly make it a parent map here (bug#25187). @@ -108323,10 +108323,10 @@ 2019-10-06 Lars Ingebrigtsen - Fix the colours on Motif horizontal scroll bars + Fix the colors on Motif horizontal scroll bars * src/xterm.c (x_create_horizontal_toolkit_scroll_bar): Use the - same foreground/background colours as the vertical scroll bar + same foreground/background colors as the vertical scroll bar (bug#37359). 2019-10-06 Lars Ingebrigtsen @@ -109177,7 +109177,7 @@ C++ Mode: Fontify correctly declarators with identifier preceded by & - The problem was bar in the following being spuriously recognised as a + The problem was bar in the following being spuriously recognized as a function, and foo as a type, as though the & were a *: Foo foo (&bar);. * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): New variable @@ -109644,9 +109644,9 @@ 2019-09-29 Lars Ingebrigtsen - Allow customising pdf-to-text parameters + Allow customizing pdf-to-text parameters - * lisp/doc-view.el (doc-view-pdf->txt): Allow customising the + * lisp/doc-view.el (doc-view-pdf->txt): Allow customizing the parameters (bug#8519). (doc-view-pdftotext-program-args): New variable. @@ -112145,12 +112145,12 @@ 2019-09-14 Lars Ingebrigtsen - Add default foreground colours to SVG images + Add default foreground colors to SVG images - * lisp/net/shr.el (svg--wrap-svg): Add a default foreground colour + * lisp/net/shr.el (svg--wrap-svg): Add a default foreground color to SVG images (bug#37159). This helps with images like the ones in https://en.wikipedia.org/wiki/Banach_fixed-point_theorem that - specify no foreground or background colours. + specify no foreground or background colors. (shr-parse-image-data): Use it. 2019-09-14 Lars Ingebrigtsen @@ -112955,7 +112955,7 @@ * lisp/epa-file.el (epa-file--replace-text): Gingerly replace the text in the buffer to preserve as many markers as possible - (bug#34720). This emulates the behaviour of Finsert_file_contents + (bug#34720). This emulates the behavior of Finsert_file_contents more accurately. (epa-file-decode-and-insert): Remove compat code. (epa-file-insert-file-contents): Use the new function. @@ -112967,7 +112967,7 @@ Repair change to compilation-context-lines (bug#36832) * lisp/progmodes/compile.el (compilation-set-window): - Restore proper behaviour when compilation-context-lines is nil, + Restore proper behavior when compilation-context-lines is nil, which is the default. 2019-09-04 Michael Albinus @@ -113647,7 +113647,7 @@ 2019-08-29 Lars Ingebrigtsen - Tweak shr background colour handling + Tweak shr background color handling * lisp/net/shr.el (shr-fill-line): Extend the background to the end of the line when folding lines. @@ -115755,7 +115755,7 @@ * lisp/progmodes/cc-engine.el (c-beginning-of-statement-1): Check for operators which cannot start a statement, which may follow a closing brace. - Don't recognise an end of statement in such a case. + Don't recognize an end of statement in such a case. * lisp/progmodes/cc-langs.el (c-operator-re, c-bin-tern-operators) (c-unary-operators, c-non-after-{}-operators, c-non-after-{}-ops-re): New lang @@ -116230,11 +116230,11 @@ 2019-08-04 Lars Ingebrigtsen - Capitalise a couple of node names + Capitalize a couple of node names - * doc/lispref/functions.texi (Advising Functions): Capitalise node + * doc/lispref/functions.texi (Advising Functions): Capitalize node names (bug#17717). - (Advice Combinators, Porting Old Advice): Capitalise. + (Advice Combinators, Porting Old Advice): Capitalize. 2019-08-04 Michael Heerdegen @@ -116624,9 +116624,9 @@ 2019-08-02 Lars Ingebrigtsen - Make Info-find-file ensure that Info is initialised + Make Info-find-file ensure that Info is initialized - * lisp/info.el (Info-find-file): Ensure that Info is initialised, + * lisp/info.el (Info-find-file): Ensure that Info is initialized, because libraries call that function (bug#19880). 2019-08-02 Lars Ingebrigtsen @@ -116743,7 +116743,7 @@ This fixes bug #36801. * lisp/progmodes/cc-langs.el (c-pre-lambda-tokens-re): Use c-make-keywords-re - rather than regexp-opt to make an optimised regexp out of a list of tokens. + rather than regexp-opt to make an optimized regexp out of a list of tokens. 2019-08-02 Lars Ingebrigtsen @@ -116843,7 +116843,7 @@ Document batch-byte-compile directory behavior * lisp/emacs-lisp/bytecomp.el (batch-byte-compile): Document the - behaviour with directories (bug#20867). + behavior with directories (bug#20867). 2019-08-01 Stefan Monnier @@ -118335,7 +118335,7 @@ 2019-07-25 Lars Ingebrigtsen - Tweak the behaviour of thing-at-point--end-of-sexp + Tweak the behavior of thing-at-point--end-of-sexp * lisp/thingatpt.el (thing-at-point--end-of-sexp): Don't return nil when called with point between two parentheses (bug#29499). @@ -118387,7 +118387,7 @@ Make `C-u w' in the Gnus Summary buffer open externally - * doc/misc/gnus.texi (Article Commands): Document new behaviour. + * doc/misc/gnus.texi (Article Commands): Document new behavior. * lisp/gnus/gnus-sum.el (gnus-shorten-url): New function. (gnus-summary-browse-url): Change function to make `C-u' use the @@ -119763,9 +119763,9 @@ 2019-07-14 Lars Ingebrigtsen - Tweak background colour handling in shr + Tweak background color handling in shr - * lisp/net/shr.el (shr-fill-line): Keep the background colour on + * lisp/net/shr.el (shr-fill-line): Keep the background color on the newline and the indentation. 2019-07-14 Lars Ingebrigtsen @@ -120232,7 +120232,7 @@ * lisp/epg.el (epg-start-encrypt) * lisp/gnus/mml-sec.el (mml-secure-epg-encrypt): When 'mml-secure-openpgp-sign-with-sender' is non-nil message sender's - email address (in addition to its old behaviour) will also be used + email address (in addition to its old behavior) will also be used to set gpg's "--sender email@domain" option. 2019-07-12 Paul Eggert @@ -120443,7 +120443,7 @@ Support program switches in 'comint-run' command * etc/NEWS: - * doc/emacs/misc.texi: Describe new behaviour (bug#33037). + * doc/emacs/misc.texi: Describe new behavior (bug#33037). * lisp/comint.el (comint-run): Add optional SWITCHES argument. With prefix argument C-u, prompt for SWITCHES. @@ -121588,11 +121588,11 @@ 2019-07-04 Mattias Engdegård - Optimise more inputs to `regexp-opt' (bug#36444) + Optimize more inputs to `regexp-opt' (bug#36444) Use a more precise test to determine whether the input to `regexp-opt' - is safe to optimise when KEEP-ORDER is non-nil, permitting more inputs - to be optimised than before. For example, ("good" "goal" "go") is now + is safe to optimize when KEEP-ORDER is non-nil, permitting more inputs + to be optimized than before. For example, ("good" "goal" "go") is now accepted. * lisp/emacs-lisp/regexp-opt.el (regexp-opt): @@ -122390,7 +122390,7 @@ 2019-06-27 Lars Ingebrigtsen - Mention the new emacsclient -a/--eval behaviour + Mention the new emacsclient -a/--eval behavior 2019-06-27 Lars Ingebrigtsen @@ -122568,11 +122568,11 @@ `replace-regexp-in-string' omits the first START characters of the input string in its return value. This is a clear bug, but fixing it - probably causes more trouble; document the behaviour instead (bug#36372). + probably causes more trouble; document the behavior instead (bug#36372). * doc/lispref/searching.texi (Search and Replace) * lisp/subr.el (replace-regexp-in-string): - Document current behaviour. + Document current behavior. 2019-06-26 Stefan Monnier @@ -122835,7 +122835,7 @@ * lisp/view.el (view-search): Jump to the next/prev occurrence of the search, even if it's displayed in the buffer (bug#18131). - This seems more logical than the previous (undocumented) behaviour. + This seems more logical than the previous (undocumented) behavior. 2019-06-25 Paul Eggert @@ -123019,7 +123019,7 @@ (goto-address-uri-schemes): Ditto. (goto-address-url-regexp): Use them to compose the final regexp. - * lisp/net/goto-addr.el: The URI schemes to be recognised by + * lisp/net/goto-addr.el: The URI schemes to be recognized by `goto-address-mode' were not regexp-quoted (Bug#23343). 2019-06-25 Tino Calancha @@ -123607,7 +123607,7 @@ Make ls-lisp--dired ape dired-noselect more closely - * lisp/ls-lisp.el (ls-lisp--dired): Emulate the behaviour of + * lisp/ls-lisp.el (ls-lisp--dired): Emulate the behavior of non-ls-lisp.el dired better by defaulting to default-directory as dired-noselect does (bug#35390). @@ -126549,7 +126549,7 @@ (global-auto-revert-mode): Don't use `after-set-visited-file-name-hook' here. (auto-revert-set-visited-file-name): Rename from - `auto-revert--global-set-visited-file-name' and generalise. + `auto-revert--global-set-visited-file-name' and generalize. * test/lisp/autorevert-tests.el (auto-revert-test06-write-file): New. 2019-06-11 Michael Albinus @@ -130991,10 +130991,10 @@ 2019-05-05 Mattias Engdegård - Reorganise (auto-)revert nodes in the manual + Reorganize (auto-)revert nodes in the manual Put all information about auto-revert into a section of its own, and - organise the text in a more logical way. Previously it was mainly + organize the text in a more logical way. Previously it was mainly described in the section about reverting (bug#35418). * doc/emacs/files.texi (Files): Adjust menu. @@ -133936,7 +133936,7 @@ * lisp/progmodes/cc-engine.el (c-looking-at-or-maybe-in-bracelist): On detection of such a ref-qualifier, set braceassignp to nil. When this variable has a nil value, return nil as the value of the function. On - encountering a } when scanning backwards, recognise this as the end of a + encountering a } when scanning backwards, recognize this as the end of a previous construct and stop the scan. 2019-04-12 Stefan Monnier @@ -138187,7 +138187,7 @@ * doc/lispref/searching.texi (Regular Expression Functions): * etc/NEWS: - Document the new behaviour. + Document the new behavior. * lisp/emacs-lisp/regexp-opt.el (regexp-opt): Return a never-match regexp for empty inputs. @@ -139904,7 +139904,7 @@ xref-find-definitions or xref-find-definitions-other-window how to choose a window for the *xref* buffer or how to find windows for displaying the results after choosing a candidate. This patch makes - that task easier, but keeps the current behaviour intact. + that task easier, but keeps the current behavior intact. * lisp/progmodes/xref.el (xref--show-pos-in-buf): Simplify. @@ -140664,7 +140664,7 @@ image-mode: Make parameters buffer-local Image parameters were treated as image specific, but because they - actually were global variables, their behaviour transferred to new + actually were global variables, their behavior transferred to new images. * lisp/image-mode.el (image-transform-resize, image-transform-scale) (image-transform-rotation): Declare with defvar-local. (Bug#33990) @@ -140804,7 +140804,7 @@ To resolve this confusion, never cycle with C-M-i in icomplete: non-ambiguous cycling can be achieved with C-. and C-, - The former behaviour can still be restored with: + The former behavior can still be restored with: (define-key icomplete-minibuffer-map (kbd "C-M-i") 'minibuffer-force-complete) @@ -140929,7 +140929,7 @@ really reindented. Rewrite comment. (electric-layout-allow-duplicate-newlines): New variable. (electric-layout-post-self-insert-function-1): Rewrite comments. - Honours electric-layout-allow-duplicate-newlines. Don't reindent + Honors electric-layout-allow-duplicate-newlines. Don't reindent previous line because racecar. * test/lisp/electric-tests.el: New test. @@ -140944,7 +140944,7 @@ Remove tests of electric-pair-mode and CC-based modes - The behaviour previously observed in cc-mode-based-modes (and every + The behavior previously observed in cc-mode-based-modes (and every other major-mode) when electric-pair-mode or electric-layout-mode is turned on may no longer be observed: this because CC-mode goes around the generic implementation of electric-pair-mode. @@ -142071,10 +142071,10 @@ 2019-01-10 Alan Third - Fix drag and drop behaviour on NS (bug#30929) + Fix drag and drop behavior on NS (bug#30929) * doc/emacs/macos.texi (Mac / GNUstep Events): Describe the new drag - and drop behaviour. + and drop behavior. * lisp/term/ns-win.el (ns-drag-n-drop): Handle the new event format. (ns-drag-n-drop-other-frame): (ns-drag-n-drop-as-text): @@ -148771,7 +148771,7 @@ 2018-09-09 mktime: simplify in prep for glibc merge 2018-09-07 intprops: minor clarification of code 2018-09-06 stddef: Override max_align_t on NetBSD 8.0/x86 - 2018-09-06 fcntl: Fix F_DUPFD_CLOEXEC behaviour on Haiku + 2018-09-06 fcntl: Fix F_DUPFD_CLOEXEC behavior on Haiku 2018-09-06 strtoll, strtoull: Rely on limits-h module 2018-09-06 limits-h: Provide numerical limits macros 2018-09-06 fcntl: Don't access nonexistent optional argument @@ -151024,7 +151024,7 @@ 2018-08-09 João Távora - Synchronous JSONRPC requests can be cancelled on user input + Synchronous JSONRPC requests can be canceled on user input This allows building more responsive interfaces, such as a snappier completion backend. @@ -154022,7 +154022,7 @@ Tweak previous gnutls change for efficiency - * src/gnutls.c (Fgnutls_peer_status): Minor optimisation to avoid + * src/gnutls.c (Fgnutls_peer_status): Minor optimization to avoid computing the topmost certificate twice. 2018-06-24 Lars Ingebrigtsen @@ -157117,7 +157117,7 @@ * lisp/window.el (scroll-other-window-down): Move to src/window.c as Fscroll_other_window_down. - * src/window.c (scroll_command): Generalise for arbitrary windows. + * src/window.c (scroll_command): Generalize for arbitrary windows. (Fscroll_up, Fscroll_down): Use scroll_command with selected_window. (Fscroll_other_window, Fscroll_other_window_down): Rewrite in terms of scroll_command. @@ -157841,7 +157841,7 @@ 326a296 ; * etc/NEWS: Mention 'display-buffer-in-major-side-window' c... 3bdc9a1 Fix flyspell-auto-correct-previous-word broken by recent change a539eb5 * test/src/lread-tests.el (lread-test-bug-31186): New test. - 3fa472b Fix undefined behaviour while looking for lexical-binding fil... + 3fa472b Fix undefined behavior while looking for lexical-binding fil... 4341aac Minor wording improvement in "Bookmarks" Conflicts: @@ -158441,7 +158441,7 @@ * lisp/gnus/gnus-group.el (gnus-update-group-mark-positions): Rewrite a call to string-to-multibyte that didn't even work. After the rewrite it gives the correct result and should allow - people to customise Gnus group process mark positions (but that's + people to customize Gnus group process mark positions (but that's a pretty obscure feature). 2018-04-14 Lars Ingebrigtsen @@ -158767,9 +158767,9 @@ From the discussion on the ding mailing list, I said: - I think the colours should be reverted back to what they were before the + I think the colors should be reverted back to what they were before the change. Normal text should be white on black (if you have a dark - background), and colours should be used to emphasise or de-emphasise + background), and colors should be used to emphasize or de-emphasize certain text. Following that principle, normal Gnus groups should be white, not ... er... what are they now? Teal? @@ -160198,8 +160198,8 @@ and numeric conversion in function in order to parse -signal and -SIGNALNAME correctly. * doc/misc/eshell.texi (kill): Update docs to reflect new function - behaviour. - * etc/NEWS: Mention new eshell/kill behaviour. + behavior. + * etc/NEWS: Mention new eshell/kill behavior. 2018-03-25 Noam Postavsky @@ -164749,7 +164749,7 @@ 2018-01-16 Alan Mackenzie - C++ Mode: Fontify correctly uniform initialisation with inner parentheses. + C++ Mode: Fontify correctly uniform initialization with inner parentheses. E.g.: someStruct x ( (nullptr != y) ? 3 : 4 ) Also fontify declarations of function pointers correctly. @@ -168798,7 +168798,7 @@ 413978727c Simplify Flymake user documentation 6ff18c3995 * etc/NEWS: Mention the new version of Org. b78332c3c6 Don't use (format "%s" ...) for string copying (Bug#28774) - 078fb7f6df Make frame-list-z-order on NS match Windows behaviour (bug... + 078fb7f6df Make frame-list-z-order on NS match Windows behavior (bug... # Conflicts: # etc/NEWS @@ -186364,7 +186364,7 @@ * lisp/progmodes/flymake-proc.el (flymake-proc--diagnostics-for-pattern): Rewrite (using cl-loop) to - honour more sophisticated flymake-proc-diagnostic-type-pred. + honor more sophisticated flymake-proc-diagnostic-type-pred. (flymake-warning-re): Is now an obsolete alias for flymake-proc-diagnostic-type-pred. (flymake-proc-diagnostic-type-pred): Rename and augment from @@ -202820,7 +202820,7 @@ titlecase_char_table member. It’s set to the ‘titlecase’ Unicode property table if capitalization has been requested. (case_character): Make use of the titlecase_char_table to title-case - initial characters when capitalising. + initial characters when capitalizing. * test/src/casefiddle-tests.el (casefiddle-tests--characters, casefiddle-tests-casing): Update test cases which are now passing. @@ -205075,7 +205075,7 @@ * lisp/net/tramp.el (tramp-completion-mode): Fix docstring. (tramp-completion-mode-p): Optional parameter VEC. Replace - check for `last-input-event' by analysing VEC argument. + check for `last-input-event' by analyzing VEC argument. (tramp-error-with-buffer, tramp-file-name-handler) (tramp-connectable-p, tramp-handle-file-name-as-directory): * lisp/net/tramp-sh.el (tramp-maybe-open-connection): Use it. diff --git a/admin/notes/spelling b/admin/notes/spelling index b783227a37a..b20f68bf624 100644 --- a/admin/notes/spelling +++ b/admin/notes/spelling @@ -6,6 +6,6 @@ Re "behavior" vs "behaviour", etc. for new text (code, docs), choose the US variant. - It's probably (IMHO --ttn, 2017-10-13) not a high priority to - change existing text; use your best judgement (ask if unsure). + change existing text; use your best judgment (ask if unsure). - https://lists.gnu.org/r/emacs-devel/2005-06/msg00489.html diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 86f418442d5..fe4de0abbb2 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1897,7 +1897,7 @@ attempts. Other zero-width assertions may also bring benefits by causing a match to fail early. @item -Avoid or-patterns in favour of character alternatives: write +Avoid or-patterns in favor of character alternatives: write @samp{[ab]} instead of @samp{a\|b}. Recall that @samp{\s-} and @samp{\sw} are equivalent to @samp{[[:space:]]} and @samp{[[:word:]]}, respectively. @@ -1932,7 +1932,7 @@ purposes. @ifnottex @item -Consider using @code{rx} (@pxref{Rx Notation}); it can optimise some +Consider using @code{rx} (@pxref{Rx Notation}); it can optimize some or-patterns automatically and will never introduce capturing groups unless explicitly requested. @end ifnottex diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 958da2f3609..6ac631ebbfc 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -3313,7 +3313,7 @@ for @var{object} is the current buffer. Search for the next region that has text property @var{prop} set to @var{value} according to @var{predicate}. -This function is modelled after @code{search-forward} and friends in +This function is modeled after @code{search-forward} and friends in that it moves point, but it returns a structure that describes the match instead of returning it in @code{match-beginning} and friends. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 07979b0d91e..b9f50ecc6ac 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -326,7 +326,7 @@ Example of a loop summing a list of numbers: @anchor{Tail recursion} Recursive calls to @var{name} that occur in @emph{tail -positions} in @var{body} are guaranteed to be optimised as @emph{tail +positions} in @var{body} are guaranteed to be optimized as @emph{tail calls}, which means that they will not consume any additional stack space no matter how deeply the recursion runs. Such recursive calls will effectively jump to the top of the loop with new values for the @@ -1346,7 +1346,7 @@ disappear without prior notice. The byte-compiler can also warn about lexical variables that are special in other Emacs Lisp files, often indicating a missing -@code{defvar} declaration. This useful but somewhat specialised check +@code{defvar} declaration. This useful but somewhat specialized check requires three steps: @enumerate diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index d5a550836aa..d608f3113fd 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -5070,7 +5070,7 @@ Opening bracket for adopted articles. The default is @samp{<}. @item ] Closing bracket, which is normally @samp{]}, but can also be @samp{>} -for adopted articles. This can be customised using following settings: +for adopted articles. This can be customized using following settings: @table @code @item gnus-sum-closing-bracket diff --git a/doc/misc/modus-themes.org b/doc/misc/modus-themes.org index 6b1d91c396a..5451f806736 100644 --- a/doc/misc/modus-themes.org +++ b/doc/misc/modus-themes.org @@ -1736,7 +1736,7 @@ things with precision ([[#h:bf1c82f2-46c7-4eb2-ad00-dd11fdd8b53f][Customization This section is of interest only to users who are prepared to maintain their own local tweaks and who are willing to deal with any possible incompatibilities between versioned releases of the themes. As such, -they are labelled as "do-it-yourself" or "DIY". +they are labeled as "do-it-yourself" or "DIY". ** Per-theme customization settings :properties: @@ -2050,7 +2050,7 @@ this example: Whenever we enter a ~diff-mode~ buffer, we now get a magenta-colored region. -Perhaps you may wish to generalise those findings in to a set of +Perhaps you may wish to generalize those findings in to a set of functions that also accept an arbitrary face. We shall leave the experimentation up to you. @@ -2318,7 +2318,7 @@ come into effect: subtle ochre tints for Modus Operandi and night sky shades for Modus Vivendi. Switching between the two themes, such as with {{{kbd(M-x modus-themes-toggle)}}} will also use the overrides. -Given that this is a user-level customisation, one is free to implement +Given that this is a user-level customization, one is free to implement whatever color values they desire, even if the possible combinations fall below the minimum 7:1 contrast ratio that governs the design of the themes (the WCAG AAA legibility standard). Alternatively, this can also diff --git a/doc/misc/org.org b/doc/misc/org.org index b1dc7084986..9f69c684318 100644 --- a/doc/misc/org.org +++ b/doc/misc/org.org @@ -2866,12 +2866,12 @@ For more information and examples see the [[https://orgmode.org/worg/org-tutoria - transpose :: When =y=, =yes=, or =t= attempt to transpose the table data before - plotting. Also recognises the shorthand option =trans=. + plotting. Also recognizes the shorthand option =trans=. - =type= :: Specify the type of the plot, by default one of =2d=, =3d=, =radar=, or =grid=. - Available types can be customised with ~org-plot/preset-plot-types~. + Available types can be customized with ~org-plot/preset-plot-types~. - =with= :: diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 2d3657b6eaf..06df3192968 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2402,7 +2402,7 @@ example below: @end lisp @vindex password-word-equivalents -This user option is, by default, initialised from +This user option is, by default, initialized from @code{password-word-equivalents} when @value{tramp} is loaded, and it is usually more convenient to add new passphrases to that user option instead of altering this user option. @@ -5454,7 +5454,7 @@ The verbosity levels are With @code{tramp-verbose} greater than or equal to 4, messages are also written to a @value{tramp} debug buffer. Such debug buffers are -essential to bug and problem analyses. For @value{tramp} bug reports, +essential to bug and problem analyzes. For @value{tramp} bug reports, set the @code{tramp-verbose} level to 6 (@pxref{Bug Reports}). The debug buffer is in diff --git a/etc/NEWS b/etc/NEWS index 722b0da696b..1aa16a4c059 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1449,7 +1449,7 @@ the entire buffer. *** 'so-long-target-modes' now includes 'fundamental-mode' by default. This means that 'global-so-long-mode' will also process files which were -not recognised. (This only has an effect if 'set-auto-mode' chooses +not recognized. (This only has an effect if 'set-auto-mode' chooses 'fundamental-mode'; buffers which are simply in 'fundamental-mode' by default are unaffected.) @@ -1763,8 +1763,8 @@ If non-nil (the default), create registry entries for all messages. If nil, don't automatically create entries, they must be created manually. -*** New user options to customise the summary line specs "%[" and "%]". -Four new options introduced in customisation group +*** New user options to customize the summary line specs "%[" and "%]". +Four new options introduced in customization group 'gnus-summary-format'. These are 'gnus-sum-opening-bracket', 'gnus-sum-closing-bracket', 'gnus-sum-opening-bracket-adopted', and 'gnus-sum-closing-bracket-adopted'. Their default values are "[", "]", @@ -2102,7 +2102,7 @@ modified flag. The default is nil, to preserve the old behavior. ** CC mode *** Added support for Doxygen documentation style. -'doxygen' is now a valid 'c-doc-comment-style' which recognises all +'doxygen' is now a valid 'c-doc-comment-style' which recognizes all comment styles supported by Doxygen (namely '///', '//!', '/** … */' and '/*! … */'. 'gtkdoc' remains the default for C and C++ modes; to use 'doxygen' by default one might evaluate: diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 37a39131d93..3c164b1282f 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -293,7 +293,7 @@ with width equal to the pixel-width of the buffer text multiplied by 0.7. This functionality is implemented in a new function, ~org-display-inline-image--width~ which contains the width determination logic previously in ~org-display-inline-images~ and the -new behaviour. +new behavior. ** New options *** Option ~org-hidden-keywords~ now also applies to #+SUBTITLE: @@ -311,7 +311,7 @@ descriptions. *** New option ~org-id-ts-format~ Earlier, IDs generated using =ts= method had a hard-coded format (i.e. =20200923T160237.891616=). -The new option allows user to customise the format. +The new option allows user to customize the format. Defaults are unchanged. *** New argument for ~file-desc~ babel header @@ -503,16 +503,16 @@ heading, except return nil. *** Faces of all the heading text elements now conform to the headline face -In the past, faces of todo keywords, emphasised text, tags, and +In the past, faces of todo keywords, emphasized text, tags, and priority cookies inherited =default= face. The resulting headline fontification was not always consistent, as discussed in [[msg::87h7sawubl.fsf@protesilaos.com][this bug report]]. Now, the relevant faces adapt to face used to fontify the current headline level. -Users who prefer to keep the old behaviour should change their face -customisation explicitly stating that =default= face is inherited. +Users who prefer to keep the old behavior should change their face +customization explicitly stating that =default= face is inherited. -Example of old face customisation: +Example of old face customization: #+begin_src emacs-lisp (setq org-todo-keyword-faces '(("TODO" @@ -520,7 +520,7 @@ Example of old face customisation: :height 0.75))) #+end_src -To preserve the old behaviour the above customisation should be +To preserve the old behavior the above customization should be changed to #+begin_src emacs-lisp @@ -543,7 +543,7 @@ The function does not allow for a third optional parameter anymore. *** LaTeX environment =#+results= are now removed If a babel src block produces a raw LaTeX environment, it will now be -recognised as a result, and so replaced when re-evaluated. +recognized as a result, and so replaced when re-evaluated. *** Tag completion now uses =completing-read-multiple= @@ -681,7 +681,7 @@ enabled, and point is neither in a table nor on a timestamp or a link: - =C-j= (bound to the new command ~org-return-and-maybe-indent~) merely inserts a newline. -To get the previous behaviour back, disable ~electric-indent-mode~ +To get the previous behavior back, disable ~electric-indent-mode~ explicitly: #+begin_src emacs-lisp @@ -1029,7 +1029,7 @@ Previously all session names had ~org-babel-session-~ prepended. *** Forward/backward paragraph functions in line with the rest of Emacs ~org-forward-paragraph~ and ~org-backward-paragraph~, bound to -~~ and ~~ functions mimic more closely behaviour of +~~ and ~~ functions mimic more closely behavior of ~forward-paragraph~ and ~backward-paragraph~ functions when available. diff --git a/etc/themes/modus-themes.el b/etc/themes/modus-themes.el index f49a809e491..7a4809c6eb2 100644 --- a/etc/themes/modus-themes.el +++ b/etc/themes/modus-themes.el @@ -7045,7 +7045,7 @@ by virtue of calling either of `modus-themes-load-operandi' and blue-alt-other)))) ;;;;; selectrum ;; NOTE 2021-02-22: The `selectrum-primary-highlight' and - ;; `selectrum-secondary-highlight' are deprecated upstream in favour + ;; `selectrum-secondary-highlight' are deprecated upstream in favor ;; of their selectrum-prescient counterparts. We shall remove those ;; faces from the themes once we are certain that they are no longer ;; relevant. diff --git a/lisp/ChangeLog.17 b/lisp/ChangeLog.17 index 6333d1dadd2..cebafe18aa0 100644 --- a/lisp/ChangeLog.17 +++ b/lisp/ChangeLog.17 @@ -825,7 +825,7 @@ 2015-03-10 Paul Eggert - Prefer "initialize" to "initialise" + Prefer "initialize" * progmodes/js.el (js-indent-first-init): Rename from js-indent-first-initialiser, to avoid worrying about American vs British spelling. All uses changed. diff --git a/lisp/ChangeLog.9 b/lisp/ChangeLog.9 index 00c81337439..a8ebe81e7d7 100644 --- a/lisp/ChangeLog.9 +++ b/lisp/ChangeLog.9 @@ -5165,7 +5165,7 @@ * sql.el (sql-interbase): New function. (sql-interbase-program): New option. (sql-interbase-options): New option. - And some typos fixed: "customise" to "customize". + And some typos fixed: "customize". 2001-03-06 Dave Love diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el index bbed955a393..f68b2f73c0a 100644 --- a/lisp/elec-pair.el +++ b/lisp/elec-pair.el @@ -575,7 +575,7 @@ The decision is taken by order of preference: (save-excursion (electric-pair--insert pair)))))))) (defun electric-pair-open-newline-between-pairs-psif () - "Honour `electric-pair-open-newline-between-pairs'. + "Honor `electric-pair-open-newline-between-pairs'. Member of `post-self-insert-hook' if `electric-pair-mode' is on." (when (and (if (functionp electric-pair-open-newline-between-pairs) (funcall electric-pair-open-newline-between-pairs) diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 5f83a217061..7159c22dfae 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -289,7 +289,7 @@ Earlier variables shadow later ones with the same name.") (if (eq fn localfn) ;; From the same file => same mode. (macroexp--unfold-lambda `(,fn ,@(cdr form))) - ;; Since we are called from inside the optimiser, we need to make + ;; Since we are called from inside the optimizer, we need to make ;; sure not to propagate lexvar values. (let ((byte-optimize--lexvars nil) ;; Silence all compilation warnings: the useful ones should @@ -322,7 +322,7 @@ Same format as `byte-optimize--lexvars', with shared structure and contents.") This indicates the loop discovery phase.") (defvar byte-optimize--dynamic-vars nil - "List of variables declared as dynamic during optimisation.") + "List of variables declared as dynamic during optimization.") (defvar byte-optimize--aliased-vars nil "List of variables which may be aliased by other lexical variables. @@ -429,7 +429,7 @@ for speeding up processing.") (`(cond . ,clauses) ;; FIXME: The condition in the first clause is always executed, and ;; clause bodies are mutually exclusive -- use this for improved - ;; optimisation (see comment about `if' below). + ;; optimization (see comment about `if' below). (cons fn (mapcar (lambda (clause) (if (consp clause) @@ -477,9 +477,9 @@ for speeding up processing.") ;; FIXME: We have to traverse the expressions in left-to-right ;; order (because that is the order of evaluation and variable ;; mutations must be found prior to their use), but doing so we miss - ;; some optimisation opportunities: + ;; some optimization opportunities: ;; consider (and A B) in a for-effect context, where B => nil. - ;; Then A could be optimised in a for-effect context too. + ;; Then A could be optimized in a for-effect context too. (let ((tail exps) (args nil)) (while tail @@ -493,19 +493,19 @@ for speeding up processing.") ;; FIXME: If the loop condition is statically nil after substitution ;; of surrounding variables then we can eliminate the whole loop, ;; even if those variables are mutated inside the loop. - ;; We currently don't perform this important optimisation. + ;; We currently don't perform this important optimization. (let* ((byte-optimize--vars-outside-loop byte-optimize--lexvars) (condition-body (if byte-optimize--inhibit-outside-loop-constprop ;; We are already inside the discovery phase of an outer ;; loop so there is no need for traversing this loop twice. (cons exp exps) - ;; Discovery phase: run optimisation without substitution + ;; Discovery phase: run optimization without substitution ;; of variables bound outside this loop. (let ((byte-optimize--inhibit-outside-loop-constprop t)) (cons (byte-optimize-form exp nil) (byte-optimize-body exps t))))) - ;; Optimise again, this time with constprop enabled (unless + ;; Optimize again, this time with constprop enabled (unless ;; we are in discovery of an outer loop), ;; as mutated variables have been marked as non-substitutable. (condition (byte-optimize-form (car condition-body) nil)) @@ -559,7 +559,7 @@ for speeding up processing.") ;; Needed as long as we run byte-optimize-form after cconv. (`(internal-make-closure . ,_) ;; Look up free vars and mark them to be kept, so that they - ;; won't be optimised away. + ;; won't be optimized away. (dolist (var (caddr form)) (let ((lexvar (assq var byte-optimize--lexvars))) (when lexvar @@ -643,7 +643,7 @@ for speeding up processing.") (defun byte-optimize-one-form (form &optional for-effect) "The source-level pass of the optimizer." - ;; Make optimiser aware of lexical arguments. + ;; Make optimizer aware of lexical arguments. (let ((byte-optimize--lexvars (mapcar (lambda (v) (list (car v) t)) byte-compile--lexical-environment))) @@ -655,7 +655,7 @@ for speeding up processing.") ;; First, optimize all sub-forms of this one. (setq form (byte-optimize-form-code-walker form for-effect)) - ;; If a form-specific optimiser is available, run it and start over + ;; If a form-specific optimizer is available, run it and start over ;; until a fixpoint has been reached. (and (consp form) (symbolp (car form)) diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 5300b0594d2..82db264ce8a 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -794,7 +794,7 @@ function passes responsibility to the functions in Other third-party values of `eldoc-documentation-strategy' should not use `eldoc--make-callback'. They must find some alternate way to produce callbacks to feed to -`eldoc-documentation-functions' and should endeavour to display +`eldoc-documentation-functions' and should endeavor to display the docstrings eventually produced, using `eldoc-display-functions'." (let* (;; How many callbacks have been created by the strategy diff --git a/lisp/faces.el b/lisp/faces.el index e93d8c7af85..59287ffbbd1 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1847,7 +1847,7 @@ This value was determined experimentally.") "Whether RGB is more readable against white than black. RGB is a 3-element list (R G B), each component in the range [0,1]. This predicate can be used both for determining a suitable (black or white) -contrast colour with RGB as background and as foreground." +contrast color with RGB as background and as foreground." (unless (<= 0 (apply #'min rgb) (apply #'max rgb) 1) (error "RGB components %S not in [0,1]" rgb)) ;; Compute the relative luminance after gamma-correcting (assuming sRGB), diff --git a/lisp/gnus/ChangeLog.3 b/lisp/gnus/ChangeLog.3 index c75f5354ca8..f3324b29190 100644 --- a/lisp/gnus/ChangeLog.3 +++ b/lisp/gnus/ChangeLog.3 @@ -7385,7 +7385,7 @@ 2011-01-02 Lars Magne Ingebrigtsen * gnus-sum.el (gnus-select-newsgroup): Don't propagate marks to - backends after sanitising on entry, because this never makes sense: + backends after sanitizing on entry, because this never makes sense: If the articles have gone missing, then the data no longer exists on the backend, and if they haven't, then Gnus is wrong, and shouldn't overwrite anything anyway. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 96172574709..6442cdb60f7 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -369,7 +369,7 @@ require user confirmation." (defun icomplete-fido-exit (force) "Attempt to exit minibuffer immediately with current input. Unless FORCE is non-nil (interactively with a prefix argument), -honour a non-nil REQUIRE-MATCH argument to `completing-read' by +honor a non-nil REQUIRE-MATCH argument to `completing-read' by trying to complete as much as possible and disallowing the exit if that doesn't produce a completion match." (interactive "P") diff --git a/lisp/net/shr.el b/lisp/net/shr.el index e8b0fbc18c4..cb75d91c566 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -820,7 +820,7 @@ size, and full-buffer size." (let* ((props (copy-sequence (text-properties-at (point)))) (face (plist-get props 'face))) ;; We don't want to use the faces on the indentation, because - ;; that's ugly, but we do want to use the background colour. + ;; that's ugly, but we do want to use the background color. (when face (setq props (plist-put props 'face (shr-face-background face)))) (add-text-properties gap-start (point) props)))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index b8855591f80..b224435b3d6 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -612,7 +612,7 @@ This regexp must match both `tramp-initial-end-of-output' and "Regexp matching password-like prompts. The regexp should match at end of buffer. -This variable is, by default, initialised from +This variable is, by default, initialized from `password-word-equivalents' when Tramp is loaded, and it is usually more convenient to add new passphrases to that variable instead of altering this variable. diff --git a/lisp/org/ChangeLog.1 b/lisp/org/ChangeLog.1 index 7e08d1a3c9a..836e1430dfe 100644 --- a/lisp/org/ChangeLog.1 +++ b/lisp/org/ChangeLog.1 @@ -4001,7 +4001,7 @@ buffer. (org-agenda-ignore-drawer-properties): New option. (org-agenda-prepare-buffers): - Honour `org-agenda-ignore-drawer-properties'. + Honor `org-agenda-ignore-drawer-properties'. * org-clock.el (org-clock-goto): Recenter to thrd line @@ -4134,7 +4134,7 @@ (orgstruct-heading-prefix-regexp, orgstruct-setup-hook): New options. (orgstruct-initialized): New variable. - (org-get-local-variables): Honour state property. + (org-get-local-variables): Honor state property. (org-run-like-in-org-mode): Use `let' instead of `progv'. Do not override variables with non-default values. (org-forward-heading-same-level): Do not skip to headlines on diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 0a2d5ed796b..cbf6709792f 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -142,7 +142,7 @@ to the highlighted and clickable region." t))) ;; All groups 2..10 are within bounds. (cons m-b1 m-e1) - ;; The regexp doesn't fulfil the contract of + ;; The regexp doesn't fulfill the contract of ;; bug-reference-bug-regexp, so fall back to the old behavior. (unless (member bug-reference-bug-regexp bug-reference--nonconforming-regexps) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 83d7bc8641c..1e9f3e1f9bb 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1664,9 +1664,9 @@ the file they refer to is visited and `flymake-mode' is turned on in the resulting buffer. Flymake backends that somehow gain sporadic information about -diagnostics in neighbouring files may freely modify this variable +diagnostics in neighboring files may freely modify this variable by adding or removing entries to for those files. If the -information about those neighbouring files is acquired repeatedly +information about those neighboring files is acquired repeatedly and reliably, it may be more sensible to report them as \"foreign\" diagnostics instead. diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index a1385b0dea8..823d9297403 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -2809,7 +2809,7 @@ END-CHAR is the ending delimiter; will stop at end-of-buffer otherwise." pieces) (forward-char)) (t - (warn "Unrecognised escape char: %c" (following-char)))) + (warn "Unrecognized escape char: %c" (following-char)))) (setq start (point))) (push (buffer-substring start (1- (point))) pieces) (let ((s (apply #'concat (nreverse pieces)))) diff --git a/lisp/ses.el b/lisp/ses.el index 542fb3d7c87..c2c1efe0f93 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -3782,7 +3782,7 @@ function is redefined." (default (and cur-printer (ses--locprn-def cur-printer))) create-printer) (cond - ;; cancelled operation => do nothing + ;; canceled operation => do nothing ((eq definition t)) ;; no change => do nothing ((and cur-printer (equal definition default))) diff --git a/lisp/so-long.el b/lisp/so-long.el index 17af532249c..8611081c0f4 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -38,7 +38,7 @@ ;; compacted into the smallest file size possible, which often entails removing ;; newlines should they not be strictly necessary). This can result in lines ;; which are many thousands of characters long, and most programming modes -;; simply aren't optimised (remotely) for this scenario, so performance can +;; simply aren't optimized (remotely) for this scenario, so performance can ;; suffer significantly. ;; ;; When so-long detects such a file, it calls the command `so-long', which @@ -412,7 +412,7 @@ ;; ;; 1.1.2 - Use `so-long-mode-line-active' face on `mode-name' in `so-long-mode'. ;; 1.1.1 - Identical to 1.1, but fixing an incorrect GNU ELPA release. -;; 1.1 - Utilise `buffer-line-statistics' in Emacs 28+, with the new +;; 1.1 - Utilize `buffer-line-statistics' in Emacs 28+, with the new ;; `so-long-predicate' function `so-long-statistics-excessive-p'. ;; - Increase `so-long-threshold' from 250 to 10,000. ;; - Increase `so-long-max-lines' from 5 to 500. @@ -449,7 +449,7 @@ ;; - Added sgml-mode and nxml-mode to `so-long-target-modes'. ;; 0.7.4 - Refactored the handling of `whitespace-mode'. ;; 0.7.3 - Added customization group `so-long' with user options. -;; - Added `so-long-original-values' to generalise the storage and +;; - Added `so-long-original-values' to generalize the storage and ;; restoration of values from the original mode upon `so-long-revert'. ;; - Added `so-long-revert-hook'. ;; 0.7.2 - Remember the original major mode even with M-x `so-long-mode'. @@ -642,7 +642,7 @@ Note that `so-long-statistics-excessive-p' requires Emacs 28.1 or later." (defun so-long--action-type () "Generate a :type for `so-long-action' based on `so-long-action-alist'." ;; :type seemingly cannot be a form to be evaluated on demand, so we - ;; endeavour to keep it up-to-date with `so-long-action-alist' by + ;; endeavor to keep it up-to-date with `so-long-action-alist' by ;; calling this from `so-long--action-alist-setter'. `(radio ,@(mapcar (lambda (x) (list 'const :tag (cadr x) (car x))) (assq-delete-all nil so-long-action-alist)) diff --git a/lisp/windmove.el b/lisp/windmove.el index 6c239dcd1ba..5c7bc91192a 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -787,7 +787,7 @@ Default value of MODIFIERS is `shift-super'." (const :tag "Hyper" hyper) (const :tag "Super" super) (const :tag "Alt" alt)))) - "Customisation type for windmove modifiers.") + "Customization type for windmove modifiers.") (defcustom windmove-default-keybindings nil "Default keybindings for regular windmove commands. diff --git a/src/xfaces.c b/src/xfaces.c index 22bd5a81b5b..14555b4f18a 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -928,7 +928,7 @@ DEFUN ("color-values-from-color-spec", Scolor_values_from_color_spec, 1, 1, 0, doc: /* Parse color SPEC as a numeric color and return (RED GREEN BLUE). -This function recognises the following formats for SPEC: +This function recognizes the following formats for SPEC: #RGB, where R, G and B are hex numbers of equal length, 1-4 digits each. rgb:R/G/B, where R, G, and B are hex numbers, 1-4 digits each. diff --git a/test/ChangeLog.1 b/test/ChangeLog.1 index fe7e6626cbf..328609038a7 100644 --- a/test/ChangeLog.1 +++ b/test/ChangeLog.1 @@ -65,7 +65,7 @@ 2015-03-10 Paul Eggert - Prefer "initialize" to "initialise" + Prefer "initialize" * indent/js-indent-init-t.js: Rename from indent/js-indent-first-initialiser-t.js. * indent/js-indent-init-dynamic.js: Rename from diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el index 5f9e02f774d..abedbb9712a 100644 --- a/test/lisp/calc/calc-tests.el +++ b/test/lisp/calc/calc-tests.el @@ -445,7 +445,7 @@ An existing calc stack is reused, otherwise a new one is created." (t ; n