commit 358ad0d30a099efcdc5a8f1d6fffe27360a91168 (HEAD, refs/remotes/origin/master) Merge: 5e07d1d0fc 14833cd9df Author: Stefan Kangas Date: Wed Aug 10 06:31:02 2022 +0200 Merge from origin/emacs-28 14833cd9df Improve wording when documenting other TRAMP syntaxes 628df15da5 ; * doc/misc/viper.texi (Rudimentary Changes): Avoid alias. 85de996bbb * lisp/vc/diff-mode.el: Don't mention XEmacs. commit 5e07d1d0fc93bfd59983d5a832d08e771e5b6212 Author: Po Lu Date: Wed Aug 10 10:33:43 2022 +0800 Improve MPX interaction with xwidgets and drag-and-drop * src/xterm.c (handle_one_xevent): Handle focus interaction in more places. diff --git a/src/xterm.c b/src/xterm.c index ab43a8ec51..41537ade15 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -21333,6 +21333,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, } #endif + if (f && device) + xi_handle_interaction (dpyinfo, f, device, + xev->time); + if (xev->evtype == XI_ButtonPress && x_dnd_last_seen_window != None) { @@ -21579,11 +21583,19 @@ handle_one_xevent (struct x_display_info *dpyinfo, xev->send_event); source = xi_device_from_id (dpyinfo, xev->sourceid); + device = xi_device_from_id (dpyinfo, xev->deviceid); #ifdef HAVE_XWIDGETS xvw = xwidget_view_from_window (xev->event); if (xvw) { + /* If the user interacts with a frame that's focused + on another device, but not the current focus + frame, make it the focus frame. */ + if (device) + xi_handle_interaction (dpyinfo, xvw->frame, + device, xev->time); + xwidget_button (xvw, xev->evtype == XI_ButtonPress, lrint (xev->event_x), lrint (xev->event_y), xev->detail, xi_convert_event_state (xev), @@ -21603,8 +21615,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, } #endif - device = xi_device_from_id (dpyinfo, xev->deviceid); - if (!device) goto XI_OTHER; commit fcd2d14db1c42add0b6aa09ac8b99cd9229596ec Author: Dmitry Gutov Date: Wed Aug 10 03:18:29 2022 +0300 js--font-lock-keywords-2: Remove the 'for each' matcher * lisp/progmodes/js.el (js--font-lock-keywords-2): Remove the 'for each' matcher. First, because it was slow (bug#56682), and second: the 'for each' syntax was only present in Mozilla's dialect of JavaScript (added in version 1.5), and has been deprecated for a decade now. diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 2eefcf44dc..d2c24a7581 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -307,9 +307,6 @@ Match group 1 is the name of the macro.") (defconst js--font-lock-keywords-2 (append js--font-lock-keywords-1 (list (list js--keyword-re 1 font-lock-keyword-face) - (list "\\_" - "\\s-+\\(each\\)\\_>" nil nil - (list 1 'font-lock-keyword-face)) (cons js--basic-type-re font-lock-type-face) (cons js--constant-re font-lock-constant-face))) "Level two font lock keywords for `js-mode'.") commit ec2bd7dd5c68510130e7abf7e76361d776c4fe22 Author: Stefan Kangas Date: Wed Aug 10 00:41:25 2022 +0200 Make wisent-pad-string obsolete in favor of string-pad * lisp/cedet/semantic/wisent/comp.el (wisent-pad-string): Make obsolete in favor of 'string-pad'. Update callers. (subr-x): Require when compiling. diff --git a/lisp/cedet/semantic/wisent/comp.el b/lisp/cedet/semantic/wisent/comp.el index ba67d25060..17cd3b1d59 100644 --- a/lisp/cedet/semantic/wisent/comp.el +++ b/lisp/cedet/semantic/wisent/comp.el @@ -38,6 +38,7 @@ ;;; Code: (require 'semantic/wisent) (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'subr-x)) ; `string-pad' ;;;; ------------------- ;;;; Misc. useful things @@ -80,18 +81,13 @@ `(dlet ,(wisent-context-bindings name) ,@body)) -;; Other utilities - (defsubst wisent-pad-string (s n &optional left) "Fill string S with spaces. Return a new string of at least N characters. Insert spaces on right. If optional LEFT is non-nil insert spaces on left." - (let ((i (length s))) - (if (< i n) - (if left - (concat (make-string (- n i) ?\ ) s) - (concat s (make-string (- n i) ?\ ))) - s))) + (declare (obsolete string-pad "29.1")) + (string-pad s n nil left)) + ;;;; ------------------------ ;;;; Environment dependencies @@ -704,7 +700,7 @@ S must be a vector of integers." (setq i 1) (while (<= i nrules) (unless (aref ruseful i) - (wisent-log "#%s " (wisent-pad-string (format "%d" i) 4)) + (wisent-log "#%s " (string-pad (format "%d" i) 4)) (wisent-log "%s:" (wisent-tag (aref rlhs i))) (setq r (aref rrhs i)) (while (natnump (aref ritem r)) @@ -2298,7 +2294,7 @@ there are any reduce/reduce conflicts." ;; Don't print rules disabled in `wisent-reduce-grammar-tables'. (when (aref ruseful i) (wisent-log " %s %s ->" - (wisent-pad-string (number-to-string i) 6) + (string-pad (number-to-string i) 6) (wisent-tag (aref rlhs i))) (setq r (aref rrhs i)) (if (> (aref ritem r) 0) commit 561d09d7adfc6d346780b30e4a2afd908ae4f4a0 Author: Stefan Kangas Date: Wed Aug 10 00:27:51 2022 +0200 Make unused function filesets-ormap obsolete * lisp/filesets.el (filesets-ormap): Simplify and make obsolete in favor of 'seq-drop-while'. diff --git a/lisp/filesets.el b/lisp/filesets.el index 83e7fa3c9a..4831bf167d 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -154,14 +154,8 @@ COND-FN takes one argument: the current element." (defun filesets-ormap (fsom-pred lst) "Return the tail of LST for the head of which FSOM-PRED is non-nil." - (let ((fsom-lst lst) - (fsom-rv nil)) - (while (and fsom-lst - (null fsom-rv)) - (if (funcall fsom-pred (car fsom-lst)) - (setq fsom-rv fsom-lst) - (setq fsom-lst (cdr fsom-lst)))) - fsom-rv)) + (declare (obsolete seq-drop-while "29.1")) + (seq-drop-while (lambda (x) (not (funcall fsom-pred x))) lst)) (define-obsolete-function-alias 'filesets-some #'cl-some "28.1") (define-obsolete-function-alias 'filesets-member #'cl-member "28.1") commit cbc925bbed8f59135039e0055b5eadcead14ee29 Author: Stefan Kangas Date: Wed Aug 10 00:21:31 2022 +0200 Make filesets-filter-list obsolete in favor of seq-filter * lisp/filesets.el (filesets-filter-list): Make obsolete in favor of 'seq-filter'. Update callers. diff --git a/lisp/filesets.el b/lisp/filesets.el index e1d1379551..83e7fa3c9a 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -146,18 +146,11 @@ is loaded before user customizations. Thus, if (require \\='filesets) precedes the `custom-set-variables' command or, for XEmacs, if init.el is loaded before custom.el, set this variable to t.") - -;;; utils (defun filesets-filter-list (lst cond-fn) "Remove all elements not conforming to COND-FN from list LST. COND-FN takes one argument: the current element." -; (cl-remove 'dummy lst :test (lambda (dummy elt) -; (not (funcall cond-fn elt))))) - (let ((rv nil)) - (dolist (elt lst) - (when (funcall cond-fn elt) - (push elt rv))) - (nreverse rv))) + (declare (obsolete seq-filter "29.1")) + (seq-filter cond-fn lst)) (defun filesets-ormap (fsom-pred lst) "Return the tail of LST for the head of which FSOM-PRED is non-nil." @@ -257,13 +250,13 @@ SYM to VAL and return t. If INIT-FLAG is non-nil, set with (setq filesets-menu-use-cached-flag nil) (when (default-boundp 'filesets-data) (let ((modified-filesets - (filesets-filter-list val - (lambda (x) - (let ((name (car x)) - (data (cdr x))) - (let ((elt (assoc name filesets-data))) - (or (not elt) - (not (equal data (cdr elt)))))))))) + (seq-filter (lambda (x) + (let ((name (car x)) + (data (cdr x))) + (let ((elt (assoc name filesets-data))) + (or (not elt) + (not (equal data (cdr elt))))))) + val))) (dolist (x modified-filesets) (filesets-reset-fileset (car x)))))) (filesets-set-default sym val)) @@ -1033,12 +1026,12 @@ defined in `filesets-ingroup-patterns'." (defun filesets-filter-dir-names (lst &optional negative) "Remove non-directory names from a list of strings. If NEGATIVE is non-nil, remove all directory names." - (filesets-filter-list lst - (lambda (x) - (and (not (string-match-p "^\\.+/$" x)) - (if negative - (not (string-match-p "[:/\\]$" x)) - (string-match-p "[:/\\]$" x)))))) + (seq-filter (lambda (x) + (and (not (string-match-p "^\\.+/$" x)) + (if negative + (not (string-match-p "[:/\\]$" x)) + (string-match-p "[:/\\]$" x)))) + lst)) (defun filesets-conditional-sort (lst &optional access-fn) "Return a sorted copy of LST, LST being a list of strings. @@ -1683,9 +1676,9 @@ Assume MODE (see `filesets-entry-mode'), if provided." (filesets-directory-files dir patt ':files t)) ;; (message "Filesets: malformed entry: %s" entry))))))) (error "Filesets: malformed entry: %s" entry))))))) - (filesets-filter-list fl - (lambda (file) - (not (filesets-filetype-property file event)))))) + (seq-filter (lambda (file) + (not (filesets-filetype-property file event))) + fl))) (defun filesets-files-under (level depth entry dir patt &optional relativep) "Files under DIR that match PATT. commit 230a198a0f1cd80bbee907d1f664ce2270216446 Author: Lars Ingebrigtsen Date: Tue Aug 9 23:17:54 2022 +0200 Avoid having language environments interpreted as sections diff --git a/etc/NEWS b/etc/NEWS index 78f60d64cd..8d54ccc0dc 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1102,31 +1102,31 @@ now has font-selection and character composition rules, a language environment, and an input method. The newly-added scripts and the corresponding language environments are: -**** Tai Tham script and the Northern Thai language environment -**** Brahmi script and language environment -**** Kaithi script and language environment -**** Tirhuta script and language environment -**** Sharada script and language environment -**** Siddham script and language environment -**** Syloti Nagri script and language environment -**** Modi script and language environment -**** Baybayin script and Tagalog language environment -**** Hanunoo script and language environment -**** Buhid script and language environment -**** Tagbanwa script and language environment -**** Limbu script and language environment -**** Balinese script and language environment -**** Javanese script and language environment -**** Sundanese script and language environment -**** Batak script and language environment -**** Rejang script and language environment -**** Makasar script and language environment -**** Lontara script and language environment -**** Hanifi Rohingya script and language environment -**** Grantha script and language environment -**** Kharoshthi script and language environment -**** Lepcha script and language environment -**** Meetei Mayek script and language environment +Tai Tham script and the Northern Thai language environment +Brahmi script and language environment +Kaithi script and language environment +Tirhuta script and language environment +Sharada script and language environment +Siddham script and language environment +Syloti Nagri script and language environment +Modi script and language environment +Baybayin script and Tagalog language environment +Hanunoo script and language environment +Buhid script and language environment +Tagbanwa script and language environment +Limbu script and language environment +Balinese script and language environment +Javanese script and language environment +Sundanese script and language environment +Batak script and language environment +Rejang script and language environment +Makasar script and language environment +Lontara script and language environment +Hanifi Rohingya script and language environment +Grantha script and language environment +Kharoshthi script and language environment +Lepcha script and language environment +Meetei Mayek script and language environment --- *** The "Oriya" language environment was renamed to "Odia". commit 0e824bd683b2ba2ed7dc50a71efcdba38b70dd62 Author: Stefan Kangas Date: Tue Aug 9 22:41:53 2022 +0200 Make rng-collapse-space obsolete * lisp/nxml/rng-util.el (rng-collapse-space): Make obsolete in favor of 'string-clean-whitespace'. Update callers. Suggested by Lars Ingebrigtsen . diff --git a/lisp/nxml/rng-dt.el b/lisp/nxml/rng-dt.el index b88653f79e..0523e8132b 100644 --- a/lisp/nxml/rng-dt.el +++ b/lisp/nxml/rng-dt.el @@ -52,7 +52,7 @@ a datatype library.") (rng-dt-error "The string datatype does not take any parameters"))) ((eq name 'token) (if (null params) - '(t rng-collapse-space) + '(t string-clean-whitespace) (rng-dt-error "The token datatype does not take any parameters"))) (t (rng-dt-error "There is no built-in datatype %s" name)))) diff --git a/lisp/nxml/rng-loc.el b/lisp/nxml/rng-loc.el index 302aa05176..40332aacd5 100644 --- a/lisp/nxml/rng-loc.el +++ b/lisp/nxml/rng-loc.el @@ -354,7 +354,7 @@ NS is t if the document has a non-nil, but not otherwise known namespace." (or (cdr (assq 'uri props)) (let ((type-id (cdr (assq 'typeId props)))) (and type-id - (cons (rng-collapse-space type-id) nil))))) + (cons (string-clean-whitespace type-id) nil))))) (defun rng-possible-type-ids-using (file type-ids) (let ((rules (rng-get-parsed-schema-locating-file file)) @@ -366,7 +366,7 @@ NS is t if the document has a non-nil, but not otherwise known namespace." (let ((id (cdr (assq 'id (cdr rule))))) (when id (setq type-ids - (cons (rng-collapse-space id) + (cons (string-clean-whitespace id) type-ids))))) ((eq (car rule) 'include) (let ((uri (cdr (assq 'rules (cdr rule))))) @@ -390,7 +390,7 @@ or nil." (cond ((and (eq (car rule) 'typeId) (let ((id (assq 'id (cdr rule)))) (and id - (string= (rng-collapse-space (cdr id)) type-id)))) + (string= (string-clean-whitespace (cdr id)) type-id)))) (setq schema (rng-match-default-rule (cdr rule)))) ((eq (car rule) 'include) (let ((uri (cdr (assq 'rules (cdr rule))))) diff --git a/lisp/nxml/rng-util.el b/lisp/nxml/rng-util.el index 70951f35d5..7ac6db25f4 100644 --- a/lisp/nxml/rng-util.el +++ b/lisp/nxml/rng-util.el @@ -71,10 +71,6 @@ LIST is not modified." s t)) -(defun rng-collapse-space (string) - (string-trim - (replace-regexp-in-string "[ \t\r\n]+" " " string t t))) - (define-error 'rng-error nil) (defun rng-uniquify-eq (list) @@ -83,6 +79,7 @@ LIST is not modified." (define-obsolete-function-alias 'rng-uniquify-equal #'seq-uniq "28.1") (define-obsolete-function-alias 'rng-blank-p #'string-blank-p "29.1") +(define-obsolete-function-alias 'rng-collapse-space #'string-clean-whitespace "29.1") (provide 'rng-util) commit 14833cd9dfc82a2dcfb8bc24a209e9b16c48b5b8 (refs/remotes/origin/emacs-28) Author: Stefan Kangas Date: Tue Aug 9 22:35:35 2022 +0200 Improve wording when documenting other TRAMP syntaxes * doc/misc/tramp.texi (Change file name syntax): Improve wording. (Bug#57061) diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 06df319296..3dc6da6e7d 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -3161,7 +3161,7 @@ names. Beside the @code{default} value, @var{syntax} can be @item @code{simplified} @cindex simplified syntax -The remote file name syntax is similar to the syntax used by Ange FTP@. +This remote file name syntax is similar to the syntax used by Ange FTP@. A remote file name has the form @code{@value{prefix}user@@host@value{postfix}path/to/file}. The @code{user@@} part is optional, and the method is determined by @@ -3173,7 +3173,7 @@ A remote file name has the form @clear unified @set separate @include trampver.texi -The remote file name syntax is similar to the syntax used by XEmacs. +This remote file name syntax originated in the XEmacs text editor. A remote file name has the form @code{@trampfn{method,user@@host,path/to/file}}. The @code{method} and @code{user@@} parts are optional. commit 32d8fc999c070a4fa1539ebba6a6310bca58c5ef Author: Stefan Kangas Date: Tue Aug 9 22:28:08 2022 +0200 Avoid using aliases for color functions * lisp/emulation/viper-init.el (viper-has-face-support-p): * lisp/emulation/viper-util.el (viper-save-cursor-color) (viper-change-cursor-color): * lisp/faces.el (read-color): * lisp/net/dictionary.el (dictionary-color-support): * lisp/obsolete/gs.el (gs-set-ghostview-colors-window-prop): * lisp/progmodes/cperl-mode.el (cperl-choose-color): * lisp/woman.el (woman-fontify): Avoid using aliases for color-defined-p, display-color-p, and color-values. diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index 5430cd700b..df2487a447 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -71,7 +71,7 @@ In all likelihood, you don't need to bother with this setting." (defun viper-has-face-support-p () (cond ((viper-window-display-p)) (viper-force-faces) - ((x-display-color-p)) + ((display-color-p)) (t (memq window-system '(pc))))) diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index c9e4fa70d0..25c55acf96 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el @@ -57,7 +57,7 @@ (define-obsolete-function-alias 'viper-int-to-char #'identity "27.1") (define-obsolete-function-alias 'viper-get-face #'facep "27.1") (define-obsolete-function-alias 'viper-color-defined-p - #'x-color-defined-p "27.1") + #'color-defined-p "27.1") (define-obsolete-function-alias 'viper-iconify #'iconify-or-deiconify-frame "27.1") @@ -71,7 +71,7 @@ (= char char1)) (t nil))) -(define-obsolete-function-alias 'viper-color-display-p #'x-display-color-p "29.1") +(define-obsolete-function-alias 'viper-color-display-p #'display-color-p "29.1") (defun viper-get-cursor-color (&optional _frame) (cdr (assoc 'cursor-color (frame-parameters)))) @@ -89,8 +89,8 @@ Otherwise return the normal value." ;; cursor colors (defun viper-change-cursor-color (new-color &optional frame) - (if (and (viper-window-display-p) (x-display-color-p) - (stringp new-color) (x-color-defined-p new-color) + (if (and (viper-window-display-p) (display-color-p) + (stringp new-color) (color-defined-p new-color) (not (string= new-color (viper-get-cursor-color)))) (modify-frame-parameters (or frame (selected-frame)) @@ -121,9 +121,9 @@ Otherwise return the normal value." ;; By default, saves current frame cursor color before changing viper state (defun viper-save-cursor-color (before-which-mode) - (if (and (viper-window-display-p) (x-display-color-p)) + (if (and (viper-window-display-p) (display-color-p)) (let ((color (viper-get-cursor-color))) - (if (and (stringp color) (x-color-defined-p color) + (if (and (stringp color) (color-defined-p color) ;; there is something fishy in that the color is not saved if ;; it is the same as frames default cursor color. need to be ;; checked. diff --git a/lisp/faces.el b/lisp/faces.el index d75c66f881..c7acbf5758 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2037,7 +2037,7 @@ as backgrounds." (setq color (background-color-at-point)))) (when (and convert-to-RGB (not (string-equal color ""))) - (let ((components (x-color-values color))) + (let ((components (color-values color))) (unless (string-match-p "^#\\(?:[[:xdigit:]][[:xdigit:]][[:xdigit:]]\\)+$" color) (setq color (format "#%04X%04X%04X" (logand 65535 (nth 0 components)) diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 9143c7d111..43dd28ff6d 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -357,7 +357,7 @@ is utf-8" (defvar dictionary-color-support (condition-case nil - (x-display-color-p) + (display-color-p) (error nil)) "Determines if the Emacs has support to display color.") diff --git a/lisp/obsolete/gs.el b/lisp/obsolete/gs.el index 7bf324ceec..d5a8713129 100644 --- a/lisp/obsolete/gs.el +++ b/lisp/obsolete/gs.el @@ -144,7 +144,7 @@ image in pixels." (defun gs-set-ghostview-colors-window-prop (frame pixel-colors) "Set the `GHOSTVIEW_COLORS' environment variable depending on FRAME." - (let ((mode (cond ((x-display-color-p frame) "Color") + (let ((mode (cond ((display-color-p frame) "Color") ((x-display-grayscale-p frame) "Grayscale") (t "Monochrome")))) (x-change-window-property "GHOSTVIEW_COLORS" diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index c6235d9013..91c00ad048 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -98,7 +98,7 @@ (let (answer) (while list (or answer - (if (or (x-color-defined-p (car list)) + (if (or (color-defined-p (car list)) (null (cdr list))) (setq answer (car list)))) (setq list (cdr list))) diff --git a/lisp/woman.el b/lisp/woman.el index 23ce2218b5..7f494a3b68 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -902,7 +902,7 @@ Troff emulation is experimental and largely untested. (defcustom woman-fontify (or (display-color-p) (display-graphic-p) - (x-display-color-p)) + (display-color-p)) "If non-nil then WoMan assumes that face support is available. It defaults to a non-nil value if the display supports either colors or different fonts." commit 06cb954ae30f9e3e032b964df09215a788670aed Author: Stefan Kangas Date: Tue Aug 9 22:26:36 2022 +0200 Remove some compat code from ps-print.el * lisp/ps-print.el (ps-print-color-p): Assume color-values is fboundp; it always is. diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el index 48664608ad..e19726a7ea 100644 --- a/lisp/progmodes/ebnf2ps.el +++ b/lisp/progmodes/ebnf2ps.el @@ -2037,7 +2037,6 @@ It must be a float between 0.0 (top) and 1.0 (bottom)." :group 'ebnf2ps) -;; Printing color requires x-color-values. (defcustom ebnf-color-p t "Non-nil means use color." :type 'boolean diff --git a/lisp/ps-print.el b/lisp/ps-print.el index 2d6c4542cc..dad4c8ffba 100644 --- a/lisp/ps-print.el +++ b/lisp/ps-print.el @@ -2926,9 +2926,8 @@ Either a float or a cons of floats (LANDSCAPE-SIZE . PORTRAIT-SIZE)." ;;; Colors -;; Printing color requires x-color-values. ;;;###autoload -(defcustom ps-print-color-p (fboundp 'x-color-values) +(defcustom ps-print-color-p t "Specify how buffer's text color is printed. Valid values are: commit 628df15da5c2ed2950944b11803b5382ca698ed7 Author: Stefan Kangas Date: Tue Aug 9 22:21:01 2022 +0200 ; * doc/misc/viper.texi (Rudimentary Changes): Avoid alias. diff --git a/doc/misc/viper.texi b/doc/misc/viper.texi index b0deb31d10..0e2473ddf3 100644 --- a/doc/misc/viper.texi +++ b/doc/misc/viper.texi @@ -1842,7 +1842,7 @@ usually most effective: (set-face-background viper-replace-overlay-face "yellow") @end smallexample For a complete list of colors available to you, evaluate the expression -@code{(x-defined-colors)}. (Type it in the buffer @file{*scratch*} and then +@code{(defined-colors)}. (Type it in the buffer @file{*scratch*} and then hit the @kbd{C-j} key. @item viper-replace-overlay-cursor-color "Red" commit 8caa91b2ce4a27a9a11d8a7cf190a15b136768e7 Author: Stefan Kangas Date: Tue Aug 9 22:09:20 2022 +0200 * lisp/vc/pcvs-util.el (cvs-partition): Simplify. diff --git a/lisp/vc/pcvs-util.el b/lisp/vc/pcvs-util.el index 702033dd88..89f8d26880 100644 --- a/lisp/vc/pcvs-util.el +++ b/lisp/vc/pcvs-util.el @@ -38,6 +38,7 @@ (apply #'append (mapcar (lambda (x) (if (listp x) x (list x))) xs))) (defun cvs-first (l &optional n) + ;; FIXME: Replace this with `seq-take'? (if (null n) (car l) (when l (let* ((nl (list (pop l))) @@ -53,10 +54,9 @@ The function returns a `cons' cell where the `car' contains elements of L for which P is true while the `cdr' contains the other elements. The ordering among elements is maintained." - (let (car cdr) - (dolist (x l) - (if (funcall p x) (push x car) (push x cdr))) - (cons (nreverse car) (nreverse cdr)))) + (let ((res (seq-group-by p l))) + (cons (cdr (assq t res)) + (cdr (assq nil res))))) ;;; ;;; frame, window, buffer handling commit caabc5a4ab584e00417d3d1f9a2bf0ee9052b092 Author: Stefan Kangas Date: Tue Aug 9 20:29:27 2022 +0200 * lisp/nxml/rng-util.el (rng-collapse-space): Simplify. diff --git a/lisp/nxml/rng-util.el b/lisp/nxml/rng-util.el index da51e81dbe..70951f35d5 100644 --- a/lisp/nxml/rng-util.el +++ b/lisp/nxml/rng-util.el @@ -72,13 +72,8 @@ LIST is not modified." t)) (defun rng-collapse-space (string) - (setq string - (replace-regexp-in-string "[ \t\r\n]+" " " string t t)) - (when (string-match "\\` " string) - (setq string (substring string 1))) - (when (string-match " \\'" string) - (setq string (substring string 0 -1))) - string) + (string-trim + (replace-regexp-in-string "[ \t\r\n]+" " " string t t))) (define-error 'rng-error nil) commit fd4aad569783befeafceb3cdfa6c4b192cafbf60 Author: Stefan Kangas Date: Tue Aug 9 20:10:52 2022 +0200 ; * lisp/mouse.el: Delete stale comment. diff --git a/lisp/mouse.el b/lisp/mouse.el index ddcb51aecf..bee664dc56 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1,6 +1,6 @@ ;;; mouse.el --- window system-independent mouse support -*- lexical-binding: t -*- -;; Copyright (C) 1993-1995, 1999-2022 Free Software Foundation, Inc. +;; Copyright (C) 1993-2022 Free Software Foundation, Inc. ;; Maintainer: emacs-devel@gnu.org ;; Keywords: hardware, mouse @@ -31,8 +31,6 @@ (eval-when-compile (require 'rect)) -;;; Utility functions. - ;; Indent track-mouse like progn. (put 'track-mouse 'lisp-indent-function 0) commit c47507ec560a09535a2b5830f1386d9fc9a58442 Author: Stefan Kangas Date: Tue Aug 9 19:54:49 2022 +0200 Make rng-blank-p obsolete in favor of string-blank-p * lisp/nxml/rng-util.el (rng-blank-p): Make obsolete in favor of string-blank-p. Update callers. diff --git a/lisp/nxml/rng-match.el b/lisp/nxml/rng-match.el index e767a9333b..f3549681f2 100644 --- a/lisp/nxml/rng-match.el +++ b/lisp/nxml/rng-match.el @@ -1154,7 +1154,7 @@ list may contain duplicates." (if (or (rng--ipattern-nullable (rng-data-deriv child value)) (and (rng--ipattern-nullable child) - (rng-blank-p value))) + (string-blank-p value))) (rng--ipattern-after ipattern) rng-not-allowed-ipattern))) ((eq type 'data) diff --git a/lisp/nxml/rng-parse.el b/lisp/nxml/rng-parse.el index 76cb94b144..1c08d77f56 100644 --- a/lisp/nxml/rng-parse.el +++ b/lisp/nxml/rng-parse.el @@ -62,7 +62,7 @@ be signaled in the same way as when it is not well-formed." (unless (rng-match-element-value (or text "")) (cons "Invalid data" (and text 'text)))) ((and text - (not (rng-blank-p text)) + (not (string-blank-p text)) (not (rng-match-mixed-text))) (cons "Text not allowed" 'text)) ((not start-tag) diff --git a/lisp/nxml/rng-util.el b/lisp/nxml/rng-util.el index 74f405410a..da51e81dbe 100644 --- a/lisp/nxml/rng-util.el +++ b/lisp/nxml/rng-util.el @@ -36,8 +36,6 @@ (defconst rng-builtin-datatypes-uri (rng-make-datatypes-uri "")) -(defun rng-blank-p (str) (string-match "\\`[ \t\n\r]*\\'" str)) - (defun rng-substq (new old list) "Replace first member of LIST (if any) that is `eq' to OLD by NEW. LIST is not modified." @@ -84,13 +82,12 @@ LIST is not modified." (define-error 'rng-error nil) -;; Obsolete. - (defun rng-uniquify-eq (list) (declare (obsolete seq-uniq "28.1")) (seq-uniq list #'eq)) (define-obsolete-function-alias 'rng-uniquify-equal #'seq-uniq "28.1") +(define-obsolete-function-alias 'rng-blank-p #'string-blank-p "29.1") (provide 'rng-util) diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el index b9c980222e..ad5c9c7a15 100644 --- a/lisp/nxml/rng-valid.el +++ b/lisp/nxml/rng-valid.el @@ -1275,7 +1275,7 @@ Return nil at end of buffer, t otherwise." (defun rng-segment-blank-p (segment) (if (car segment) - (rng-blank-p (car segment)) + (string-blank-p (car segment)) (apply #'rng-region-blank-p (cdr segment)))) @@ -1303,7 +1303,7 @@ string between START and END." ((not (or (and whitespace (or (eq whitespace t) (if value - (rng-blank-p value) + (string-blank-p value) (rng-region-blank-p start end)))) (rng-match-mixed-text))) (rng-mark-invalid "Text not allowed" start (or end (point)))))) commit 581fa3d958c064e05a8f980472880f153aba30a6 Author: Stefan Kangas Date: Tue Aug 9 19:49:40 2022 +0200 Autoload string-blank-p * lisp/eshell/em-hist.el (subr-x): * lisp/net/eudc.el (subr-x): Don't require. * lisp/emacs-lisp/subr-x.el (string-blank-p): Autoload. diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index d5d7bfeb6f..b7083bfe7c 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -118,6 +118,7 @@ the resulting string may be longer than the original if LENGTH is (concat "..." (substring string (min (1- strlen) (max 0 (- strlen length)))))))) +;;;###autoload (defsubst string-blank-p (string) "Check whether STRING is either empty or only whitespace. The following characters count as whitespace here: space, tab, newline and diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 1877749c5c..1db239b9f7 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -55,7 +55,6 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) -(eval-when-compile (require 'subr-x)) ; `string-blank-p' (require 'ring) (require 'esh-opt) diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el index 5cfd4e25ec..eb440ba614 100644 --- a/lisp/net/eudc.el +++ b/lisp/net/eudc.el @@ -48,7 +48,6 @@ (require 'wid-edit) (require 'cl-lib) (require 'eudc-vars) -(eval-when-compile (require 'subr-x)) ;;{{{ Internal cooking commit 0bc2079ce664cfe089a10f8ba0b17f4d2dae9ace Author: Stefan Kangas Date: Tue Aug 9 19:42:07 2022 +0200 * lisp/ibuf-ext.el (ibuffer-remove-alist): Simplify. diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 44c1ae867d..6b5cccec51 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -48,9 +48,7 @@ ;;; Utility functions (defun ibuffer-remove-alist (key alist) "Remove all entries in ALIST that have a key equal to KEY." - (while (when-let ((it (assoc key alist))) - (setq alist (remove it alist)) it)) - alist) + (assoc-delete-all key (copy-sequence alist))) (defun ibuffer-split-list (fn elts) (declare (obsolete seq-group-by "29.1")) commit 47aa2317c343de3cf1bca1e19906dccc7415fe28 Author: Lars Ingebrigtsen Date: Tue Aug 9 21:12:54 2022 +0200 Use new convenience functions in replace-string * lisp/replace.el (replace-string): Use new convenience functions. diff --git a/lisp/replace.el b/lisp/replace.el index ae5c804be5..2bb9c1b90d 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -666,8 +666,8 @@ and TO-STRING is also null.)" (declare (interactive-only "use `search-forward' and `replace-match' instead.") (interactive-args - (start (if (use-region-p) (region-beginning))) - (end (if (use-region-p) (region-end))))) + (start (use-region-beginning)) + (end (use-region-end)))) (interactive (let ((common (query-replace-read-args @@ -679,8 +679,7 @@ and TO-STRING is also null.)" (if (use-region-p) " in region" "")) nil))) (list (nth 0 common) (nth 1 common) (nth 2 common) - (if (use-region-p) (region-beginning)) - (if (use-region-p) (region-end)) + (use-region-beginning) (use-region-end) (nth 3 common) (if (use-region-p) (region-noncontiguous-p))))) (perform-replace from-string to-string nil nil delimited nil nil start end backward region-noncontiguous-p)) commit 6ac92c65a800e593d6a8aaf7f089c3811fcb7f33 Author: Lars Ingebrigtsen Date: Tue Aug 9 21:11:29 2022 +0200 Add use-region-beginning and use-region-end * lisp/simple.el (use-region-beginning, use-region-end): New functions. (use-region-p): Mention them in the doc strings (bug#45607). diff --git a/lisp/simple.el b/lisp/simple.el index e7768837f6..a4ea345ca5 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -6863,6 +6863,14 @@ point otherwise." :version "23.1" :group 'editing-basics) +(defun use-region-beginning () + "Return the start of the region if `use-region-p'." + (and (use-region-p) (region-beginning))) + +(defun use-region-end () + "Return the end of the region if `use-region-p'." + (and (use-region-p) (region-end))) + (defun use-region-p () "Return t if the region is active and it is appropriate to act on it. This is used by commands that act specially on the region under @@ -6873,7 +6881,11 @@ mark is active; furthermore, if `use-empty-active-region' is nil, the region must not be empty. Otherwise, the return value is nil. For some commands, it may be appropriate to ignore the value of -`use-empty-active-region'; in that case, use `region-active-p'." +`use-empty-active-region'; in that case, use `region-active-p'. + +Also see the convenience functions `use-region-beginning' and +`use-region-end', which may be handy when writing `interactive' +specs." (and (region-active-p) (or use-empty-active-region (> (region-end) (region-beginning))) t)) commit 619d5af54ab1eb4d8f8e5971de65c8baf63f4732 Author: Juri Linkov Date: Tue Aug 9 21:54:32 2022 +0300 * lisp/replace.el (replace-highlight): Optimize for large buffers (bug#56815) Let-bind isearch-lazy-count and lazy-highlight-buffer to nil to avoid revisiting all matches in the whole buffer after every replacement. diff --git a/lisp/replace.el b/lisp/replace.el index cac0edf43a..ae5c804be5 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -2744,7 +2744,9 @@ to a regexp that is actually used for the search.") (isearch-case-fold-search case-fold) (isearch-forward (not backward)) (isearch-other-end match-beg) - (isearch-error nil)) + (isearch-error nil) + (isearch-lazy-count nil) + (lazy-highlight-buffer nil)) (isearch-lazy-highlight-new-loop range-beg range-end)))) (defun replace-dehighlight () commit 41169b55340878120fdf695eb4ac1fcb2679e7b8 Author: Andrea Greselin Date: Tue Aug 9 20:43:08 2022 +0200 Add new user option electric-quote-replace-consecutive * lisp/electric.el (electric-quote-replace-consecutive): New user option (bug#57057). (electric-quote-post-self-insert-function): Use it. diff --git a/etc/NEWS b/etc/NEWS index 9e509bc56e..78f60d64cd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -375,6 +375,9 @@ option) and can be set to nil to disable Just-in-time Lock mode. * Changes in Emacs 29.1 +--- +** New user option 'electric-quote-replace-consecutive'. + --- ** Emacs is now capable of editing files with very long lines. The display of long lines has been optimized, and Emacs should no diff --git a/lisp/electric.el b/lisp/electric.el index 0cf3a299cf..f2ff837333 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -540,6 +540,16 @@ closing double quote otherwise." :version "26.1" :type 'boolean :safe #'booleanp :group 'electricity) +(defcustom electric-quote-replace-consecutive t + "Non-nil means to replace a pair of single quotes with a double quote. +Two single quotes are replaced by the corresponding double quote +when the second quote of the pair is entered (i.e. by typing ` or +') by default. If nil, the single quotes are not altered." + :version "29.1" + :type 'boolean + :safe #'booleanp + :group 'electricity) + (defvar electric-quote-inhibit-functions () "List of functions that should inhibit electric quoting. When the variable `electric-quote-mode' is non-nil, Emacs will @@ -592,7 +602,9 @@ This requotes when a quoting key is typed." (memq (char-syntax (char-before)) '(?\s ?\()))) (setq backtick ?\'))) - (cond ((search-backward (string q< backtick) (- (point) 2) t) + (cond ((and electric-quote-replace-consecutive + (search-backward + (string q< backtick) (- (point) 2) t)) (replace-match (string q<<)) (when (and electric-pair-mode (eq (cdr-safe @@ -606,7 +618,8 @@ This requotes when a quoting key is typed." ((search-backward "\"" (1- (point)) t) (replace-match (string q<<)) (setq last-command-event q<<))) - (cond ((search-backward (string q> ?') (- (point) 2) t) + (cond ((and electric-quote-replace-consecutive + (search-backward (string q> ?') (- (point) 2) t)) (replace-match (string q>>)) (setq last-command-event q>>)) ((search-backward "'" (1- (point)) t) @@ -627,7 +640,7 @@ and text paragraphs, and these are selectively controlled with `electric-quote-paragraph'. Customize `electric-quote-chars' to use characters other than the -ones listed here. +ones listed here. Also see `electric-quote-replace-consecutive'. This is a global minor mode. To toggle the mode in a single buffer, use `electric-quote-local-mode'." commit 744ed0ceeed7472a160fea7154939cf641205577 Author: Stephen Berman Date: Tue Aug 9 20:21:09 2022 +0200 Make outline buttons work in NEWS * lisp/outline.el (outline-minor-mode-highlight-buffer): Fix button insertion. (outline-minor-mode): Ditto. (outline--insert-open-button): Don't mark buffer as modified when inserting buttons. (outline--insert-close-button): Ditto. * lisp/textmodes/emacs-news-mode.el (emacs-news--mode-common): Adjust outline regexp. diff --git a/lisp/outline.el b/lisp/outline.el index 7750f9a75d..35524a79a9 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -435,7 +435,7 @@ outline font-lock faces to those of major mode." (goto-char (match-beginning 0)) (not (get-text-property (point) 'face)))) (overlay-put overlay 'face (outline-font-lock-face))) - (when (outline--use-buttons-p) + (when (and (outline--use-buttons-p) (outline-on-heading-p)) (outline--insert-open-button))) (goto-char (match-end 0)))))) @@ -452,11 +452,10 @@ See the command `outline-mode' for more information on this mode." (if outline-minor-mode (progn (when outline-minor-mode-highlight - (if (and global-font-lock-mode (font-lock-specified-p major-mode)) - (progn - (font-lock-add-keywords nil outline-font-lock-keywords t) - (font-lock-flush)) - (outline-minor-mode-highlight-buffer))) + (when (and global-font-lock-mode (font-lock-specified-p major-mode)) + (font-lock-add-keywords nil outline-font-lock-keywords t) + (font-lock-flush)) + (outline-minor-mode-highlight-buffer)) ;; Turn off this mode if we change major modes. (add-hook 'change-major-mode-hook (lambda () (outline-minor-mode -1)) @@ -1011,32 +1010,34 @@ If non-nil, EVENT should be a mouse event." o)) (defun outline--insert-open-button () - (save-excursion - (beginning-of-line) - (when (derived-mode-p 'special-mode) - (let ((inhibit-read-only t)) - (insert " ") - (beginning-of-line))) - (let ((o (outline--make-button-overlay 'open))) - (overlay-put o 'help-echo "Click to hide") - (overlay-put o 'keymap - (define-keymap - "RET" #'outline-hide-subtree - "" #'outline-hide-subtree))))) + (with-silent-modifications + (save-excursion + (beginning-of-line) + (when (derived-mode-p 'special-mode) + (let ((inhibit-read-only t)) + (insert " ") + (beginning-of-line))) + (let ((o (outline--make-button-overlay 'open))) + (overlay-put o 'help-echo "Click to hide") + (overlay-put o 'keymap + (define-keymap + "RET" #'outline-hide-subtree + "" #'outline-hide-subtree)))))) (defun outline--insert-close-button () - (save-excursion - (beginning-of-line) - (when (derived-mode-p 'special-mode) - (let ((inhibit-read-only t)) - (insert " ") - (beginning-of-line))) - (let ((o (outline--make-button-overlay 'close))) - (overlay-put o 'help-echo "Click to show") - (overlay-put o 'keymap - (define-keymap - "RET" #'outline-show-subtree - "" #'outline-show-subtree))))) + (with-silent-modifications + (save-excursion + (beginning-of-line) + (when (derived-mode-p 'special-mode) + (let ((inhibit-read-only t)) + (insert " ") + (beginning-of-line))) + (let ((o (outline--make-button-overlay 'close))) + (overlay-put o 'help-echo "Click to show") + (overlay-put o 'keymap + (define-keymap + "RET" #'outline-show-subtree + "" #'outline-show-subtree)))))) (defun outline--fix-up-all-buttons (&optional from to) (when from diff --git a/lisp/textmodes/emacs-news-mode.el b/lisp/textmodes/emacs-news-mode.el index c7fa9fa2b2..e6e1f03728 100644 --- a/lisp/textmodes/emacs-news-mode.el +++ b/lisp/textmodes/emacs-news-mode.el @@ -69,11 +69,9 @@ (defun emacs-news--mode-common () (setq-local font-lock-defaults '(emacs-news-mode-font-lock-keywords t)) - (setq-local outline-regexp "\\*+ " + (setq-local outline-regexp "\\(:? +\\)?\\(\\*+\\) " outline-minor-mode-cycle t - ;; We subtract one from the level, because we have a - ;; space after the asterisks. - outline-level (lambda () (1- (length (match-string 0)))) + outline-level (lambda () (length (match-string 2))) outline-minor-mode-highlight 'append) (outline-minor-mode)) commit 38f9d9bf060e08f3fe5edab9a13bc7eaabe7e2f1 Author: Eli Zaretskii Date: Tue Aug 9 21:26:21 2022 +0300 ; * src/keyboard.c (timer_check_2): Restore run-time conditions. diff --git a/src/keyboard.c b/src/keyboard.c index f8e6ef748d..4ad6e4e6bd 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -4645,24 +4645,29 @@ timer_check_2 (Lisp_Object timers, Lisp_Object idle_timers) /* If we got here, presumably `decode_timer` has checked that this timer has not yet been triggered. */ eassert (NILP (AREF (chosen_timer, 0))); - specpdl_ref count = SPECPDL_INDEX (); - Lisp_Object old_deactivate_mark = Vdeactivate_mark; + /* In a production build, where assertions compile to + nothing, we still want to play it safe here. */ + if (NILP (AREF (chosen_timer, 0))) + { + specpdl_ref count = SPECPDL_INDEX (); + Lisp_Object old_deactivate_mark = Vdeactivate_mark; - /* Mark the timer as triggered to prevent problems if the lisp - code fails to reschedule it right. */ - ASET (chosen_timer, 0, Qt); + /* Mark the timer as triggered to prevent problems if the lisp + code fails to reschedule it right. */ + ASET (chosen_timer, 0, Qt); - specbind (Qinhibit_quit, Qt); + specbind (Qinhibit_quit, Qt); - call1 (Qtimer_event_handler, chosen_timer); - Vdeactivate_mark = old_deactivate_mark; - timers_run++; - unbind_to (count, Qnil); + call1 (Qtimer_event_handler, chosen_timer); + Vdeactivate_mark = old_deactivate_mark; + timers_run++; + unbind_to (count, Qnil); - /* Since we have handled the event, - we don't need to tell the caller to wake up and do it. */ - /* But the caller must still wait for the next timer, so - return 0 to indicate that. */ + /* Since we have handled the event, + we don't need to tell the caller to wake up and do it. */ + /* But the caller must still wait for the next timer, so + return 0 to indicate that. */ + } nexttime = make_timespec (0, 0); break; commit b7b160b4098949d745e7114bd198653d4e72a70d Author: Eli Zaretskii Date: Tue Aug 9 20:51:42 2022 +0300 Revert "Make compat alias check-ispell-version obsolete" This reverts commit 24795e45e5fab6e2f699582662f9be7c5c6e25f8. That alias is in no way obsolete, and was added for a different reason. diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 91354940e7..f85d0aba9c 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -116,6 +116,8 @@ "User variables for Emacs ispell interface." :group 'applications) +(defalias 'check-ispell-version 'ispell-check-version) + (declare-function flyspell-unhighlight-at "flyspell" (pos)) ;;; ********************************************************************** @@ -4228,8 +4230,6 @@ Both should not be used to define a buffer-local dictionary." (insert comment-end))))) (insert (concat " " word)))))))) -(define-obsolete-function-alias 'check-ispell-version #'ispell-check-version "29.1") - (provide 'ispell) commit 2504d19dade7bcfcce7cd93011edf06f3c955a50 Merge: 8813399cfa b2bf91003d Author: Eli Zaretskii Date: Tue Aug 9 20:42:39 2022 +0300 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit b2bf91003db3bc2171c566ed710ec34d4a55c064 Author: Lars Ingebrigtsen Date: Tue Aug 9 19:19:29 2022 +0200 Further lisp-current-defun-name tweaks * lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Tweak so that cl-defmethod and friends work again. diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 1bc2c0ece6..c31fbec640 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -774,7 +774,7 @@ decided heuristically.)" ;; name). If the symbol starts with \"def\", then it's ;; likely that the next symbol is the name. (when (and (not name) - (string-match-p "\\`def" (symbol-name symbol))) + (string-match-p "\\(\\`\\|-\\)def" (symbol-name symbol))) (when-let ((candidate (ignore-errors (read (current-buffer))))) (cond ((symbolp candidate) commit 5269842833471c960352ced3c60ce2329660b8cf Author: Lars Ingebrigtsen Date: Tue Aug 9 19:18:55 2022 +0200 Add a faster seq-uniq for lists * lisp/emacs-lisp/seq.el (seq-uniq): Add a faster method for lists (bug#57079). diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 1b8d86563a..6ddd8de6e8 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -455,6 +455,23 @@ TESTFN is used to compare elements, or `equal' if TESTFN is nil." (setq result (cons elt result)))) (nreverse result))) +(cl-defmethod seq-uniq ((sequence list) &optional testfn) + (let ((result nil)) + (if (not testfn) + ;; Fast path. + (while sequence + (unless (member (car sequence) result) + (push (car sequence) result)) + (pop sequence)) + ;; Slower path. + (while sequence + (unless (seq-find (lambda (elem) + (funcall testfn elem (car sequence))) + result) + (push (car sequence) result)) + (pop sequence))) + (nreverse result))) + (cl-defgeneric seq-mapcat (function sequence &optional type) "Concatenate the result of applying FUNCTION to each element of SEQUENCE. The result is a sequence of type TYPE, or a list if TYPE is nil." diff --git a/test/lisp/emacs-lisp/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el index 3b22e42df2..a655377e6c 100644 --- a/test/lisp/emacs-lisp/seq-tests.el +++ b/test/lisp/emacs-lisp/seq-tests.el @@ -559,5 +559,18 @@ Evaluate BODY for each created sequence. (should (equal (seq-split seq 3) '("012" "345" "678" "9"))))) +(ert-deftest test-seq-uniq-list () + (let ((list '(1 2 3))) + (should (equal (seq-uniq (append list list)) '(1 2 3)))) + (let ((list '(1 2 3 2 1))) + (should (equal (seq-uniq list) '(1 2 3)))) + (let ((list (list (substring "1") + (substring "2") + (substring "3") + (substring "2") + (substring "1")))) + (should (equal (seq-uniq list) '("1" "2" "3"))) + (should (equal (seq-uniq list #'eq) '("1" "2" "3" "2" "1"))))) + (provide 'seq-tests) ;;; seq-tests.el ends here commit b92e88875802724af9e08201ea65a96dd5f20ff1 Author: Laurence Warne Date: Tue Aug 9 08:33:18 2022 +0100 Fix python escape code fontification for multi-line literals * lisp/progmodes/python.el (python--string-bytes-literal-matcher): Go backward one char after a match so that consecutive escape codes are highlighted (python--not-raw-string-literal-start-regexp): Make regular expression more comprehensive, so multi-line bytes literals are not caught (python-rx): Accept one to three octal digits in octal escape codes instead of always three diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5edd6e7df5..96f9d14832 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -432,7 +432,7 @@ This variant of `rx' supports common Python named REGEXPS." (seq (not "\\") (group (or "\\\\" "\\'" "\\a" "\\b" "\\f" "\\n" "\\r" "\\t" "\\v" - (seq "\\" (= 3 (in "0-7"))) + (seq "\\" (** 1 3 (in "0-7"))) (seq "\\x" hex hex))))) (string-escape-sequence (or bytes-escape-sequence @@ -556,7 +556,14 @@ the {...} holes that appear within f-strings." "A regular expression matching the start of a not-raw bytes literal.") (defconst python--not-raw-string-literal-start-regexp - (rx (or bos (not alnum)) (? (or "u" "U" "F" "f")) (or "\"" "\"\"\"" "'" "'''") eos) + (rx bos (or + ;; Multi-line string literals + (seq (? (? (not alnum)) (or "u" "U" "F" "f")) (or "\"\"\"" "'''")) + (seq (? anychar) (not alnum) (or "\"\"\"" "'''")) + ;; Single line string literals + (seq (? (** 0 2 anychar) (not alnum)) (or "u" "U" "F" "f") (or "'" "\"")) + (seq (? (** 0 3 anychar) (not (any "'\"" alnum))) (or "'" "\""))) + eos) "A regular expression matching the start of a not-raw string literal.") (defun python--string-bytes-literal-matcher (regexp start-regexp) @@ -565,11 +572,12 @@ the {...} holes that appear within f-strings." (cl-loop for result = (re-search-forward regexp limit t) for result-valid = (and result - (let* ((pos (nth 8 (syntax-ppss))) - (before-quote - (buffer-substring-no-properties - (max (- pos 5) (point-min)) - (min (+ pos 1) (point-max))))) + (when-let* ((pos (nth 8 (syntax-ppss))) + (before-quote + (buffer-substring-no-properties + (max (- pos 4) (point-min)) + (min (+ pos 1) (point-max))))) + (backward-char) (string-match-p start-regexp before-quote))) until (or (not result) result-valid) finally return (and result-valid result)))) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index e3c8d5554a..d303050fad 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -407,6 +407,81 @@ u\"\\n\"" (31 . font-lock-constant-face) (33 . font-lock-string-face)))) +(ert-deftest python-font-lock-escape-sequence-multiline-string () + (python-tests-assert-faces + (let ((escape-sequences "\\x12 \123 \\n \\u1234 \\U00010348 \\N{Plus-Minus Sign}")) + (cl-loop for string-prefix in '("" "f" "rf" "fr" "r" "rb" "br" "b") + concat (cl-loop for quote-string in '("\"\"\"" "'''") + concat (concat string-prefix + quote-string + escape-sequences + quote-string + "\n")))) + '((1 . font-lock-doc-face) + (4 . font-lock-constant-face) + (8 . font-lock-doc-face) + (11 . font-lock-constant-face) + (13 . font-lock-doc-face) + (14 . font-lock-constant-face) + (20 . font-lock-doc-face) + (21 . font-lock-constant-face) + (31 . font-lock-doc-face) + (32 . font-lock-constant-face) + (51 . font-lock-doc-face) (54) + (55 . font-lock-doc-face) + (58 . font-lock-constant-face) + (62 . font-lock-doc-face) + (65 . font-lock-constant-face) + (67 . font-lock-doc-face) + (68 . font-lock-constant-face) + (74 . font-lock-doc-face) + (75 . font-lock-constant-face) + (85 . font-lock-doc-face) + (86 . font-lock-constant-face) + (105 . font-lock-doc-face) (108) + (110 . font-lock-string-face) + (113 . font-lock-constant-face) + (117 . font-lock-string-face) + (120 . font-lock-constant-face) + (122 . font-lock-string-face) + (123 . font-lock-constant-face) + (129 . font-lock-string-face) + (130 . font-lock-constant-face) + (140 . font-lock-string-face) + (141 . font-lock-constant-face) + (160 . font-lock-string-face) (163) + (165 . font-lock-string-face) + (168 . font-lock-constant-face) + (172 . font-lock-string-face) + (175 . font-lock-constant-face) + (177 . font-lock-string-face) + (178 . font-lock-constant-face) + (184 . font-lock-string-face) + (185 . font-lock-constant-face) + (195 . font-lock-string-face) + (196 . font-lock-constant-face) + (215 . font-lock-string-face) (218) + (221 . font-lock-string-face) (274) + (277 . font-lock-string-face) (330) + (333 . font-lock-string-face) (386) + (389 . font-lock-string-face) (442) + (444 . font-lock-string-face) (497) + (499 . font-lock-string-face) (552) + (555 . font-lock-string-face) (608) + (611 . font-lock-string-face) (664) + (667 . font-lock-string-face) (720) + (723 . font-lock-string-face) (776) + (778 . font-lock-string-face) + (781 . font-lock-constant-face) + (785 . font-lock-string-face) + (788 . font-lock-constant-face) + (790 . font-lock-string-face) (831) + (833 . font-lock-string-face) + (836 . font-lock-constant-face) + (840 . font-lock-string-face) + (843 . font-lock-constant-face) + (845 . font-lock-string-face) (886)))) + (ert-deftest python-font-lock-escape-sequence-bytes-newline () (python-tests-assert-faces "b'\\n' @@ -421,19 +496,23 @@ b\"\\n\"" (ert-deftest python-font-lock-escape-sequence-hex-octal () (python-tests-assert-faces - "b'\\x12 \\777' -'\\x12 \\777'" + "b'\\x12 \\777 \\1\\23' +'\\x12 \\777 \\1\\23'" '((1) (2 . font-lock-doc-face) (3 . font-lock-constant-face) (7 . font-lock-doc-face) (8 . font-lock-constant-face) - (12 . font-lock-doc-face) (13) - (14 . font-lock-doc-face) - (15 . font-lock-constant-face) - (19 . font-lock-doc-face) - (20 . font-lock-constant-face) - (24 . font-lock-doc-face)))) + (12 . font-lock-doc-face) + (13 . font-lock-constant-face) + (18 . font-lock-doc-face) (19) + (20 . font-lock-doc-face) + (21 . font-lock-constant-face) + (25 . font-lock-doc-face) + (26 . font-lock-constant-face) + (30 . font-lock-doc-face) + (31 . font-lock-constant-face) + (36 . font-lock-doc-face)))) (ert-deftest python-font-lock-escape-sequence-unicode () (python-tests-assert-faces commit 3ef18c7a213f4f3c03eec033fcb8219fb17cd53d Author: Stefan Kangas Date: Tue Aug 9 18:15:56 2022 +0200 Make ibuffer-aif obsolete in favor of if-let * lisp/ibuf-macs.el (ibuffer-aif): Make obsolete in favor of 'if-let'. * lisp/ibuffer.el (ibuffer-mouse-toggle-mark) (ibuffer-mark-interactive, ibuffer-compile-format, process): Prefer 'if-let' to above obsolete macro. (ibuffer-toggle-marks, ibuffer-map-lines): Prefer 'when-let' to above obsolete macro. diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index a56c1a8721..44c1ae867d 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -865,7 +865,7 @@ specification, with the same structure as an element of the list "Move point to the filter group whose name is NAME." (interactive (list (ibuffer-read-filter-group-name "Jump to filter group: "))) - (ibuffer-aif (assoc name (ibuffer-current-filter-groups-with-position)) + (if-let ((it (assoc name (ibuffer-current-filter-groups-with-position)))) (goto-char (cdr it)) (error "No filter group with name %s" name))) @@ -876,7 +876,7 @@ The group will be added to `ibuffer-filter-group-kill-ring'." (interactive (list (ibuffer-read-filter-group-name "Kill filter group: " t))) (when (equal name "Default") (error "Can't kill default filter group")) - (ibuffer-aif (assoc name ibuffer-filter-groups) + (if-let ((it (assoc name ibuffer-filter-groups))) (progn (push (copy-tree it) ibuffer-filter-group-kill-ring) (setq ibuffer-filter-groups (ibuffer-remove-alist @@ -891,13 +891,12 @@ The group will be added to `ibuffer-filter-group-kill-ring'." "Kill the filter group at point. See also `ibuffer-kill-filter-group'." (interactive "P\np") - (ibuffer-aif (save-excursion - (ibuffer-forward-line 0) - (get-text-property (point) 'ibuffer-filter-group-name)) - (progn - (ibuffer-kill-filter-group it)) - (funcall (if interactive-p #'call-interactively #'funcall) - #'kill-line arg))) + (if-let ((it (save-excursion + (ibuffer-forward-line 0) + (get-text-property (point) 'ibuffer-filter-group-name)))) + (ibuffer-kill-filter-group it) + (funcall (if interactive-p #'call-interactively #'funcall) + #'kill-line arg))) (defun ibuffer-insert-filter-group-before (newgroup group) (let* ((found nil) @@ -953,7 +952,7 @@ prompt for NAME, and use the current filters." (list (read-from-minibuffer "Save current filter groups as: ") ibuffer-filter-groups))) - (ibuffer-aif (assoc name ibuffer-saved-filter-groups) + (if-let ((it (assoc name ibuffer-saved-filter-groups))) (setcdr it groups) (push (cons name groups) ibuffer-saved-filter-groups)) (ibuffer-maybe-save-stuff)) @@ -1125,7 +1124,7 @@ Interactively, prompt for NAME, and use the current filters." (list (read-from-minibuffer "Save current filters as: ") ibuffer-filtering-qualifiers))) - (ibuffer-aif (assoc name ibuffer-saved-filters) + (if-let ((it (assoc name ibuffer-saved-filters))) (setcdr it filters) (push (cons name filters) ibuffer-saved-filters)) (ibuffer-maybe-save-stuff)) @@ -1337,11 +1336,11 @@ pattern. For example, for a buffer associated with file For a buffer associated with file '/a/b/c.d', this matches against '/a/b'. For a buffer not associated with a file, this matches against the value of `default-directory' in that buffer." - (:description "directory name" - :reader (read-from-minibuffer "Filter by directory name (regex): ")) - (ibuffer-aif (with-current-buffer buf (ibuffer-buffer-file-name)) - (let ((dirname (file-name-directory it))) - (when dirname (string-match qualifier dirname))) + ( :description "directory name" + :reader (read-from-minibuffer "Filter by directory name (regex): ")) + (if-let ((it (with-current-buffer buf (ibuffer-buffer-file-name)))) + (when-let ((dirname (file-name-directory it))) + (string-match qualifier dirname)) (when default-directory (string-match qualifier default-directory)))) ;;;###autoload (autoload 'ibuffer-filter-by-size-gt "ibuf-ext") diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el index 718b779a92..acffb74ead 100644 --- a/lisp/ibuf-macs.el +++ b/lisp/ibuf-macs.el @@ -35,7 +35,7 @@ If TEST returns non-nil, bind `it' to the value, and evaluate TRUE-BODY. Otherwise, evaluate forms in FALSE-BODY as if in `progn'. Compare with `if'." - (declare (indent 2)) + (declare (obsolete if-let "29.1") (indent 2)) (let ((sym (make-symbol "ibuffer-aif-sym"))) `(let ((,sym ,test)) (if ,sym diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index d6870aab5d..5cb4fe2a7a 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -832,7 +832,7 @@ width and the longest string in LIST." (let ((pt (save-excursion (mouse-set-point event) (point)))) - (ibuffer-aif (get-text-property (point) 'ibuffer-filter-group-name) + (if-let ((it (get-text-property (point) 'ibuffer-filter-group-name))) (ibuffer-toggle-marks it) (goto-char pt) (let ((mark (ibuffer-current-mark))) @@ -1263,8 +1263,8 @@ become unmarked. If point is on a group name, then this function operates on that group." (interactive) - (ibuffer-aif (get-text-property (point) 'ibuffer-filter-group-name) - (setq group it)) + (when-let ((it (get-text-property (point) 'ibuffer-filter-group-name))) + (setq group it)) (let ((count (ibuffer-map-lines (lambda (_buf mark) @@ -1336,7 +1336,7 @@ If point is on a group name, this function operates on that group." (when (and movement (< movement 0)) (setq arg (- arg))) (ibuffer-forward-line 0) - (ibuffer-aif (get-text-property (point) 'ibuffer-filter-group-name) + (if-let ((it (get-text-property (point) 'ibuffer-filter-group-name))) (progn (require 'ibuf-ext) (ibuffer-mark-on-buffer #'identity mark it)) @@ -1540,7 +1540,7 @@ If point is on a group name, this function operates on that group." ;; `ibuffer-inline-columns' alist and insert it ;; into our generated code. Otherwise, we just ;; generate a call to the column function. - (ibuffer-aif (assq sym ibuffer-inline-columns) + (if-let ((it (assq sym ibuffer-inline-columns))) (nth 1 it) `(or (,sym buffer mark) ""))) ;; You're not expected to understand this. Hell, I @@ -1737,7 +1737,7 @@ If point is on a group name, this function operates on that group." (cond ((zerop total) "No processes") ((= 1 total) "1 process") (t (format "%d processes" total)))))) - (ibuffer-aif (get-buffer-process buffer) + (if-let ((it (get-buffer-process buffer))) (format "(%s %s)" it (process-status it)) "")) @@ -1872,8 +1872,8 @@ the buffer object itself and the current mark symbol." (let ((result (if (buffer-live-p (ibuffer-current-buffer)) (when (or (null group) - (ibuffer-aif (get-text-property (point) 'ibuffer-filter-group) - (equal group it))) + (when-let ((it (get-text-property (point) 'ibuffer-filter-group))) + (equal group it))) (save-excursion (funcall function (ibuffer-current-buffer) commit b0653b27e25bfad2416364c33e1a5994285435c4 Author: Michael Albinus Date: Tue Aug 9 18:12:27 2022 +0200 Further Tramp fixes for Android 12 * lisp/net/tramp-adb.el (tramp-adb-handle-file-attributes) (tramp-adb-handle-directory-files-and-attributes) (tramp-adb-handle-file-name-all-completions): Pipe "ls" output through "cat", in order to avoid quoting special characters. (tramp-adb-sh-fix-ls-output): Remove fix for file names with spaces. * test/lisp/net/tramp-tests.el (tramp-test22-file-times): Adapt test. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index ed51628c4a..d033667e87 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -257,7 +257,7 @@ arguments to pass to the OPERATION." (tramp-convert-file-attributes v localname id-format (and (tramp-adb-send-command-and-check - v (format "%s -d -l %s" + v (format "%s -d -l %s | cat" (tramp-adb-get-ls-command v) (tramp-shell-quote-argument localname))) (with-current-buffer (tramp-get-buffer v) @@ -310,16 +310,15 @@ arguments to pass to the OPERATION." directory full match nosort id-format count (with-current-buffer (tramp-get-buffer v) (when (tramp-adb-send-command-and-check - v (format "%s -a -l %s" + v (format "%s -a -l %s | cat" (tramp-adb-get-ls-command v) (tramp-shell-quote-argument localname))) ;; We insert also filename/. and filename/.., because "ls" - ;; doesn't. Looks like it does include them in toybox, since - ;; Android 6. + ;; doesn't on some file systems, like "sdcard". (unless (re-search-backward "\\.$" nil t) (narrow-to-region (point-max) (point-max)) (tramp-adb-send-command - v (format "%s -d -a -l %s %s" + v (format "%s -d -a -l %s %s | cat" (tramp-adb-get-ls-command v) (tramp-shell-quote-argument (tramp-compat-file-name-concat localname ".")) @@ -362,10 +361,6 @@ arguments to pass to the OPERATION." Android's \"ls\" command doesn't insert size column for directories: Emacs dired can't find files." (save-excursion - ;; Fix file names with spaces. - ;; FIXME: It would be better if we could call "ls" with proper - ;; argument or environment variable. - (replace-string-in-region "\\ " " " (point-min)) ;; Insert missing size. (goto-char (point-min)) (while @@ -460,7 +455,7 @@ Emacs dired can't find files." (with-parsed-tramp-file-name (expand-file-name directory) nil (with-tramp-file-property v localname "file-name-all-completions" (tramp-adb-send-command - v (format "%s -a %s" + v (format "%s -a %s | cat" (tramp-adb-get-ls-command v) (tramp-shell-quote-argument localname))) (mapcar @@ -471,9 +466,8 @@ Emacs dired can't find files." (with-current-buffer (tramp-get-buffer v) (delete-dups (append - ;; In older Android versions, "." and ".." are not - ;; included. In newer versions (toybox, since Android 6) - ;; they are. We fix this by `delete-dups'. + ;; On some file systems like "sdcard", "." and ".." are + ;; not included. We fix this by `delete-dups'. '("." "..") (delq nil diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index a3e80e8956..ad81d0c09e 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4160,7 +4160,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (file-attributes tmp-name1)))) ;; Skip the test, if the remote handler is not able to set ;; the correct time. - (skip-unless (set-file-times tmp-name1 (seconds-to-time 1))) + ;; Some remote machines cannot resolve seconds. So we use a minute. + (skip-unless (set-file-times tmp-name1 (seconds-to-time 60))) ;; Dumb remote shells without perl(1) or stat(1) are not ;; able to return the date correctly. They say "don't know". (unless (tramp-compat-time-equal-p @@ -4168,16 +4169,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (file-attributes tmp-name1)) tramp-time-dont-know) (should - (or (tramp-compat-time-equal-p - (file-attribute-modification-time - (file-attributes tmp-name1)) - (seconds-to-time 1)) - ;; Some remote machines cannot resolve seconds. - ;; The return the modification time `(0 0). - (tramp-compat-time-equal-p - (file-attribute-modification-time - (file-attributes tmp-name1)) - (seconds-to-time 0)))) + (tramp-compat-time-equal-p + (file-attribute-modification-time (file-attributes tmp-name1)) + (seconds-to-time 60))) ;; Setting the time for not existing files shall fail. (should-error (set-file-times tmp-name2) @@ -4192,18 +4186,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; regular files, there shouldn't be a difference. (when (tramp--test-emacs28-p) (with-no-warnings - (set-file-times tmp-name1 (seconds-to-time 1) 'nofollow) + (set-file-times tmp-name1 (seconds-to-time 60) 'nofollow) (should - (or (tramp-compat-time-equal-p - (file-attribute-modification-time - (file-attributes tmp-name1)) - (seconds-to-time 1)) - ;; Some remote machines cannot resolve seconds. - ;; The return the modification time `(0 0). - (tramp-compat-time-equal-p - (file-attribute-modification-time - (file-attributes tmp-name1)) - (seconds-to-time 0)))))))) + (tramp-compat-time-equal-p + (file-attribute-modification-time + (file-attributes tmp-name1)) + (seconds-to-time 60))))))) ;; Cleanup. (ignore-errors commit e5bf2b942fec6e901c165aff93c89e4dd8e448dd Author: Stefan Kangas Date: Tue Aug 9 17:55:21 2022 +0200 Improve message regarding missing LEIM * lisp/international/ja-dic-utl.el (skkdic-lookup-key): * lisp/international/mule-diag.el (list-input-methods-1): * lisp/international/quail.el (quail-use-package): Explain that LEIM is installed together with Emacs. diff --git a/lisp/international/ja-dic-utl.el b/lisp/international/ja-dic-utl.el index cc636986f9..3f6500669a 100644 --- a/lisp/international/ja-dic-utl.el +++ b/lisp/international/ja-dic-utl.el @@ -112,11 +112,9 @@ without okurigana are placed at the head of the returned list." (princ (substitute-command-keys "\ The library `ja-dic' can't be loaded. -The most common case is that you have not yet installed the library -included in LEIM (Libraries of Emacs Input Method) which is -distributed separately from Emacs. - -LEIM is available from the same ftp directory as Emacs."))) +This might indicate a problem with your Emacs installation, as +LEIM (Libraries of Emacs Input Method) should normally always be +installed together with Emacs."))) (signal (car err) (cdr err))))) (let ((vec (make-vector len 0)) diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 646e0b8480..cdf2e527e2 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -1068,8 +1068,11 @@ see the function `describe-fontset' for the format of the list." (with-current-buffer standard-output (if (not input-method-alist) (insert " -No input method is available, perhaps because you have not -installed LEIM (Libraries of Emacs Input Methods).") +No input method is available. + +This might indicate a problem with your Emacs installation, as +LEIM (Libraries of Emacs Input Method) should normally always be +installed together with Emacs.") (insert (substitute-command-keys "LANGUAGE\n NAME (`TITLE' in mode line)\n")) (insert " SHORT-DESCRIPTION\n------------------------------\n") diff --git a/lisp/international/quail.el b/lisp/international/quail.el index 529cf97215..4bb6dbcc8e 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el @@ -249,11 +249,9 @@ This activates input method defined by PACKAGE-NAME by running (princ (car libraries)) (princ (substitute-command-keys "\" is not in `load-path'. -The most common case is that you have not yet installed appropriate -libraries in LEIM (Libraries of Emacs Input Method) which is -distributed separately from Emacs. - -LEIM is available from the same ftp directory as Emacs."))) +This might indicate a problem with your Emacs installation, as +LEIM (Libraries of Emacs Input Method) should normally always be +installed together with Emacs."))) (error "Can't use the Quail package `%s'" package-name)) (setq libraries (cdr libraries)))))) (quail-select-package package-name) commit f9ee2db4937cf51aa4442f5d24275b82c773208b Author: Stefan Kangas Date: Tue Aug 9 17:47:50 2022 +0200 Improve readability of list-input-methods * lisp/international/mule-diag.el: Make screen more readable by improving the formatting. diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 6b630c73e8..646e0b8480 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -1065,35 +1065,36 @@ see the function `describe-fontset' for the format of the list." (help-xref-button 1 'help-input-method (match-string 1)))))))) (defun list-input-methods-1 () - (if (not input-method-alist) - (princ " + (with-current-buffer standard-output + (if (not input-method-alist) + (insert " No input method is available, perhaps because you have not installed LEIM (Libraries of Emacs Input Methods).") - (princ (substitute-command-keys - "LANGUAGE\n NAME (`TITLE' in mode line)\n")) - (princ " SHORT-DESCRIPTION\n------------------------------\n") - (setq input-method-alist - (sort input-method-alist - (lambda (x y) (string< (nth 1 x) (nth 1 y))))) - - (let (language) - (dolist (elt input-method-alist) - (when (not (equal language (nth 1 elt))) - (setq language (nth 1 elt)) - (princ language) - (terpri)) - (princ (format-message - " %s (`%s' in mode line)\n %s\n" - (car elt) - (let ((title (nth 3 elt))) - (if (and (consp title) (stringp (car title))) - (car title) - title)) - ;; If the doc is multi-line, indent all - ;; non-blank lines. (Bug#8066) - (replace-regexp-in-string - "\n\\(.\\)" "\n \\1" - (substitute-command-keys (or (nth 4 elt) ""))))))))) + (insert (substitute-command-keys + "LANGUAGE\n NAME (`TITLE' in mode line)\n")) + (insert " SHORT-DESCRIPTION\n------------------------------\n") + (setq input-method-alist + (sort input-method-alist + (lambda (x y) (string< (nth 1 x) (nth 1 y))))) + + (let (language) + (dolist (elt input-method-alist) + (when (not (equal language (nth 1 elt))) + (setq language (nth 1 elt)) + (insert "\n" (propertize language 'face 'help-for-help-header) "\n\n")) + (insert (format-message + " %s (`%s' in mode line)\n %s\n" + (car elt) + (let ((title (nth 3 elt))) + (if (and (consp title) (stringp (car title))) + (car title) + title)) + ;; If the doc is multi-line, indent all + ;; non-blank lines. (Bug#8066) + (replace-regexp-in-string + "\n\\(.\\)" "\n \\1" + (substitute-command-keys (or (nth 4 elt) "")))))))))) + ;;; DIAGNOSIS commit 171b9314bf2b2ed1719f2451b527960e0a363a40 Author: Stefan Kangas Date: Tue Aug 9 14:29:12 2022 +0200 Replace utility functions with seq-uniq * lisp/gnus/gnus-util.el (gnus-delete-duplicates): * lisp/ibuf-ext.el (ibuffer-remove-duplicates): Redefine as obsolete function alias for 'seq-uniq'. Update callers. diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 880192e3bb..d1ad5bd7b2 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -750,15 +750,6 @@ nil. See also `gnus-bind-print-variables'." (when (file-exists-p file) (delete-file file))) -(defun gnus-delete-duplicates (list) - "Remove duplicate entries from LIST." - (let ((result nil)) - (while list - (unless (member (car list) result) - (push (car list) result)) - (pop list)) - (nreverse result))) - (defun gnus-delete-directory (directory) "Delete files in DIRECTORY. Subdirectories remain. If there's no subdirectory, delete DIRECTORY as well." @@ -1550,6 +1541,8 @@ lists of strings." ;; gnus-util. (autoload 'gnus-output-to-rmail "gnus-rmail") +(define-obsolete-function-alias 'gnus-delete-duplicates #'seq-uniq "29.1") + (provide 'gnus-util) ;;; gnus-util.el ends here diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 17bbfda08f..73cd183a02 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -555,7 +555,7 @@ during splitting, which may be slow." ;; Look for the credentials based on ;; the virtual server name and the address (nnimap-credentials - (gnus-delete-duplicates + (seq-uniq (list server nnimap-address)) ports nnimap-user)))) diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 951978fc5b..3dc74c95fb 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -99,7 +99,7 @@ SUFFIX should start with \":2,\"." (let* ((flags (substring suffix 3)) (flags-as-list (append flags nil)) (new-flags - (concat (gnus-delete-duplicates + (concat (seq-uniq ;; maildir flags must be sorted (sort (cons flag flags-as-list) #'<))))) (concat ":2," new-flags))) @@ -1015,7 +1015,7 @@ This variable is set by `nnmaildir-request-article'.") dir (nnmaildir--nndir dir) dir (nnmaildir--marks-dir dir) ls (nnmaildir--group-ls nnmaildir--cur-server pgname) - all-marks (gnus-delete-duplicates + all-marks (seq-uniq ;; get mark names from mark dirs and from flag ;; mappings (append @@ -1697,7 +1697,7 @@ This variable is set by `nnmaildir-request-article'.") pgname (nnmaildir--pgname nnmaildir--cur-server gname) ls (nnmaildir--group-ls nnmaildir--cur-server pgname) all-marks (funcall ls marksdir nil "\\`[^.]" 'nosort) - all-marks (gnus-delete-duplicates + all-marks (seq-uniq ;; get mark names from mark dirs and from flag ;; mappings (append diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 621e648a2d..a56c1a8721 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -52,17 +52,6 @@ (setq alist (remove it alist)) it)) alist) -;; borrowed from Gnus -(defun ibuffer-remove-duplicates (list) - "Return a copy of LIST with duplicate elements removed." - (let ((new nil) - (tail list)) - (while tail - (or (member (car tail) new) - (setq new (cons (car tail) new))) - (setq tail (cdr tail))) - (nreverse new))) - (defun ibuffer-split-list (fn elts) (declare (obsolete seq-group-by "29.1")) (let ((res (seq-group-by fn elts))) @@ -799,7 +788,7 @@ specification, with the same structure as an element of the list (mapcar (lambda (mode) (cons (format "%s" mode) `((mode . ,mode)))) (let ((modes - (ibuffer-remove-duplicates + (seq-uniq (mapcar (lambda (buf) (buffer-local-value 'major-mode buf)) (buffer-list))))) @@ -1986,6 +1975,8 @@ defaults to one." (push buf ibuffer-do-occur-bufs))) (occur-1 regexp nlines ibuffer-do-occur-bufs))) +(define-obsolete-function-alias 'ibuffer-remove-duplicates #'seq-uniq "29.1") + (provide 'ibuf-ext) ;; Local Variables: commit 8813399cfa336a2719f4c89e7ccc543dbcbce547 Merge: 7b84954a7c ee201bc77b Author: Eli Zaretskii Date: Tue Aug 9 18:52:25 2022 +0300 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit ee201bc77b37181bbb4378f360ee8dc94c231676 Author: Lars Ingebrigtsen Date: Tue Aug 9 16:36:41 2022 +0200 Make the loaddefs.el file slightly shorter * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--shorten-autoload): New function. (loaddefs-generate--make-autoload): Use it to drop optional nil values from the `autoloads' forms. This makes the loaddefs.el file about 12K shorter. diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 8aa17be765..3b329357ad 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -127,6 +127,15 @@ scanning for autoloads and will be in the `load-path'." (substring name 0 (match-beginning 0)) name))) +(defun loaddefs-generate--shorten-autoload (form) + "Remove optional nil elements from an `autoload' form." + (take (max (- (length form) + (seq-position (reverse form) nil + (lambda (e1 e2) + (not (eq e1 e2))))) + 3) + form)) + (defun loaddefs-generate--make-autoload (form file &optional expansion) "Turn FORM into an autoload or defvar for source file FILE. Returns nil if FORM is not a special autoload form (i.e. a function definition @@ -165,8 +174,8 @@ expression, in which case we want to handle forms differently." ;; Add the usage form at the end where describe-function-1 ;; can recover it. (when (consp args) (setq doc (help-add-fundoc-usage doc args))) - ;; (message "autoload of %S" (nth 1 form)) - `(autoload ,(nth 1 form) ,file ,doc ,interactive ,type))) + (loaddefs-generate--shorten-autoload + `(autoload ,(nth 1 form) ,file ,doc ,interactive ,type)))) ((and expansion (memq car '(progn prog1))) (let ((end (memq :autoload-end form))) @@ -220,22 +229,23 @@ expression, in which case we want to handle forms differently." ;; can recover it. (when (listp args) (setq doc (help-add-fundoc-usage doc args))) ;; `define-generic-mode' quotes the name, so take care of that - `(autoload ,(if (listp name) name (list 'quote name)) - ,file ,doc - ,(or (and (memq car '(define-skeleton define-derived-mode - define-generic-mode - easy-mmode-define-global-mode - define-global-minor-mode - define-globalized-minor-mode - easy-mmode-define-minor-mode - define-minor-mode)) - t) - (and (eq (car-safe (car body)) 'interactive) - ;; List of modes or just t. - (or (if (nthcdr 1 (car body)) - (list 'quote (nthcdr 1 (car body))) - t)))) - ,(if macrop ''macro nil)))) + (loaddefs-generate--shorten-autoload + `(autoload ,(if (listp name) name (list 'quote name)) + ,file ,doc + ,(or (and (memq car '(define-skeleton define-derived-mode + define-generic-mode + easy-mmode-define-global-mode + define-global-minor-mode + define-globalized-minor-mode + easy-mmode-define-minor-mode + define-minor-mode)) + t) + (and (eq (car-safe (car body)) 'interactive) + ;; List of modes or just t. + (or (if (nthcdr 1 (car body)) + (list 'quote (nthcdr 1 (car body))) + t)))) + ,(if macrop ''macro nil))))) ;; For defclass forms, use `eieio-defclass-autoload'. ((eq car 'defclass) commit accb1d1132ad467304a909aa2e01993e0b5ff0f9 Author: Stefan Kangas Date: Tue Aug 9 15:46:54 2022 +0200 Make ibuffer-awhen obsolete in favor of when-let * lisp/ibuf-macs.el (ibuffer-awhen): Make obsolete in favor of 'when-let'. Update callers. diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 3fa17e583d..621e648a2d 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -48,7 +48,7 @@ ;;; Utility functions (defun ibuffer-remove-alist (key alist) "Remove all entries in ALIST that have a key equal to KEY." - (while (ibuffer-awhen (assoc key alist) + (while (when-let ((it (assoc key alist))) (setq alist (remove it alist)) it)) alist) @@ -1313,7 +1313,7 @@ For example, for a buffer associated with file '/a/b/c.d', this matches against '/a/b/c.d'." (:description "full file name" :reader (read-from-minibuffer "Filter by full file name (regexp): ")) - (ibuffer-awhen (with-current-buffer buf (ibuffer-buffer-file-name)) + (when-let ((it (with-current-buffer buf (ibuffer-buffer-file-name)))) (string-match qualifier it))) ;;;###autoload (autoload 'ibuffer-filter-by-basename "ibuf-ext") @@ -1325,7 +1325,7 @@ matches against `c.d'." (:description "file basename" :reader (read-from-minibuffer "Filter by file name, without directory part (regex): ")) - (ibuffer-awhen (with-current-buffer buf (ibuffer-buffer-file-name)) + (when-let ((it (with-current-buffer buf (ibuffer-buffer-file-name)))) (string-match qualifier (file-name-nondirectory it)))) ;;;###autoload (autoload 'ibuffer-filter-by-file-extension "ibuf-ext") @@ -1338,7 +1338,7 @@ pattern. For example, for a buffer associated with file (:description "filename extension" :reader (read-from-minibuffer "Filter by filename extension without separator (regex): ")) - (ibuffer-awhen (with-current-buffer buf (ibuffer-buffer-file-name)) + (when-let ((it (with-current-buffer buf (ibuffer-buffer-file-name)))) (string-match qualifier (or (file-name-extension it) "")))) ;;;###autoload (autoload 'ibuffer-filter-by-directory "ibuf-ext") diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el index 51b206d7c4..718b779a92 100644 --- a/lisp/ibuf-macs.el +++ b/lisp/ibuf-macs.el @@ -47,10 +47,9 @@ Compare with `if'." (defmacro ibuffer-awhen (test &rest body) "Evaluate BODY if TEST returns non-nil. During evaluation of body, bind `it' to the value returned by TEST." - (declare (indent 1)) - `(ibuffer-aif ,test - (progn ,@body) - nil)) + (declare (indent 1) (obsolete when-let "29.1")) + `(when-let ((it ,test)) + ,@body)) (defmacro ibuffer-save-marks (&rest body) "Save the marked status of the buffers and execute BODY; restore marks." diff --git a/test/lisp/ibuffer-tests.el b/test/lisp/ibuffer-tests.el index 343e2ae50b..d54718e297 100644 --- a/test/lisp/ibuffer-tests.el +++ b/test/lisp/ibuffer-tests.el @@ -132,7 +132,7 @@ (ibuffer-switch-to-saved-filter-groups "saved-filters") (should (assoc "Elisp" (cdar ibuffer-saved-filter-groups)))) (setq ibuffer-saved-filter-groups orig-filters) - (ibuffer-awhen (get-buffer "*Ibuffer*") + (when-let ((it (get-buffer "*Ibuffer*"))) (and (buffer-live-p it) (kill-buffer it)))))) commit d3f6edf5aa0a7083efa2dd08ed3eb7d8709689c8 Author: Stefan Kangas Date: Tue Aug 9 15:37:53 2022 +0200 Make ibuffer-split-list obsolete in favor of seq-group-by * lisp/ibuf-ext.el (ibuffer-split-list): Make obsolete in favor of 'seq-group-by'. (ibuffer-generate-filter-groups): Don't use above obsolete function. diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 822ecbdd99..3fa17e583d 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -63,15 +63,10 @@ (setq tail (cdr tail))) (nreverse new))) -(defun ibuffer-split-list (ibuffer-split-list-fn ibuffer-split-list-elts) - (let ((hip-crowd nil) - (lamers nil)) - (dolist (ibuffer-split-list-elt ibuffer-split-list-elts) - (if (funcall ibuffer-split-list-fn ibuffer-split-list-elt) - (push ibuffer-split-list-elt hip-crowd) - (push ibuffer-split-list-elt lamers))) - ;; Too bad Emacs Lisp doesn't have multiple values. - (list (nreverse hip-crowd) (nreverse lamers)))) +(defun ibuffer-split-list (fn elts) + (declare (obsolete seq-group-by "29.1")) + (let ((res (seq-group-by fn elts))) + (list (cdr (assq t res)) (cdr (assq nil res))))) (defcustom ibuffer-never-show-predicates nil "A list of predicates (a regexp or function) for buffers not to display. @@ -769,11 +764,12 @@ specification, with the same structure as an element of the list (i 0)) (dolist (filtergroup filter-group-alist) (let ((filterset (cdr filtergroup))) - (cl-destructuring-bind (hip-crowd lamers) - (ibuffer-split-list (lambda (bufmark) - (ibuffer-included-in-filters-p (car bufmark) - filterset)) - bmarklist) + (let* ((res (seq-group-by (lambda (bufmark) + (ibuffer-included-in-filters-p (car bufmark) + filterset)) + bmarklist)) + (hip-crowd (cdr (assq t res))) + (lamers (cdr (assq nil res)))) (aset vec i hip-crowd) (cl-incf i) (setq bmarklist lamers)))) commit 24795e45e5fab6e2f699582662f9be7c5c6e25f8 Author: Stefan Kangas Date: Tue Aug 9 15:36:13 2022 +0200 Make compat alias check-ispell-version obsolete * lisp/textmodes/ispell.el (check-ispell-version): Make compat alias obsolete. diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index f85d0aba9c..91354940e7 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -116,8 +116,6 @@ "User variables for Emacs ispell interface." :group 'applications) -(defalias 'check-ispell-version 'ispell-check-version) - (declare-function flyspell-unhighlight-at "flyspell" (pos)) ;;; ********************************************************************** @@ -4230,6 +4228,8 @@ Both should not be used to define a buffer-local dictionary." (insert comment-end))))) (insert (concat " " word)))))))) +(define-obsolete-function-alias 'check-ispell-version #'ispell-check-version "29.1") + (provide 'ispell) commit e7a582cbe44cff7d0cde4b52108f98882d6a8fdf Author: Stefan Kangas Date: Tue Aug 9 15:35:15 2022 +0200 * lisp/ibuffer.el (ibuffer): Use substitute-command-keys for help. diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 65430d7d11..d6870aab5d 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -2332,7 +2332,18 @@ FORMATS is the value to use for `ibuffer-formats'. (run-hooks 'ibuffer-hook)) (setq buffer-read-only t)) (unless ibuffer-expert - (message "Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help")))))) + (message (substitute-command-keys + (concat "Commands: \\[ibuffer-mark-forward], " + "\\[ibuffer-unmark-forward], " + "\\[ibuffer-toggle-marks], " + "\\[ibuffer-visit-buffer], " + "\\[ibuffer-update], " + "\\[ibuffer-do-kill-lines], " + "\\[ibuffer-do-save], " + "\\[ibuffer-do-delete], " + "\\[ibuffer-do-query-replace]; " + "\\[quit-window] to quit; " + "\\[describe-mode] for help")))))))) ;;;###autoload (defun ibuffer-jump (&optional other-window) commit 7b84954a7c87ffd1ccba06dd1c078b5b8c93a035 Author: Eli Zaretskii Date: Tue Aug 9 15:11:12 2022 +0300 ; * etc/NEWS: Mention the new 'js-json-mode'. diff --git a/etc/NEWS b/etc/NEWS index 2662ba453f..9e509bc56e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2267,6 +2267,11 @@ This mode is used to edit files geared towards testing actions in Emacs buffers, like indentation and the like. The new ert function 'ert-test-erts-file' is used to parse these files. +--- +** New mode 'js-json-mode'. +This is a lightweight variant of 'js-mode' that is used by default +when visiting JSON files. + * Incompatible Lisp Changes in Emacs 29.1 commit 1137219c97dda512a309ce4bfad5abde0d2be206 Author: Stefan Kangas Date: Tue Aug 9 14:04:12 2022 +0200 Make compat alias image-refresh obsolete * lisp/image.el (image-refresh): Make compat alias obsolete. Update callers. diff --git a/lisp/image.el b/lisp/image.el index 02e5c85faf..de2afdc2c7 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -32,7 +32,6 @@ :group 'multimedia) (declare-function image-flush "image.c" (spec &optional frame)) -(defalias 'image-refresh 'image-flush) (defconst image-type-header-regexps `(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm) @@ -1304,6 +1303,8 @@ changing the displayed image size does not affect the saved image." (setf (image-property image :flip) (not (image-property image :flip))))) +(define-obsolete-function-alias 'image-refresh #'image-flush "29.1") + (provide 'image) ;;; image.el ends here diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el index c2da24266a..831c84befc 100644 --- a/lisp/org/org-plot.el +++ b/lisp/org/org-plot.el @@ -622,7 +622,7 @@ manner suitable for prepending to a user-specified script." (dolist (img-overlay org-inline-image-overlays) (when (string= img-file (plist-get (cdr (overlay-get img-overlay 'display)) :file)) (when (file-exists-p img-file) - (image-refresh (overlay-get img-overlay 'display)))))) + (image-flush (overlay-get img-overlay 'display)))))) ;;----------------------------------------------------------------------------- ;; facade functions diff --git a/lisp/org/org.el b/lisp/org/org.el index 8bb69e98ce..68f522b060 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -16487,7 +16487,7 @@ INCLUDE-LINKED is passed to `org-display-inline-images'." (org-toggle-inline-images))) ;; For without-x builds. -(declare-function image-refresh "image" (spec &optional frame)) +(declare-function image-flush "image" (spec &optional frame)) (defcustom org-display-remote-inline-images 'skip "How to display remote inline images. @@ -16628,7 +16628,7 @@ buffer boundaries with possible narrowing." (org-element-property :begin link) 'org-image-overlay))) (if (and (car-safe old) refresh) - (image-refresh (overlay-get (cdr old) 'display)) + (image-flush (overlay-get (cdr old) 'display)) (let ((image (org--create-inline-image file width))) (when image (let ((ov (make-overlay commit 2ebfd7188f07e8c0c4e88d17e094d6fdd59f4769 Author: Po Lu Date: Tue Aug 9 19:55:47 2022 +0800 ; * src/xterm.c (xi_populate_device_from_info): Minor ifdef cleanup. diff --git a/src/xterm.c b/src/xterm.c index 806933fd07..ab43a8ec51 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -5282,16 +5282,15 @@ xi_populate_device_from_info (struct xi_device_t *xi_device, * device->num_classes); values = NULL; #endif -#ifdef HAVE_XINPUT2_2 - xi_device->touchpoints = NULL; -#endif xi_device->use = device->use; + xi_device->name = build_string (device->name); + xi_device->attachment = device->attachment; + #ifdef HAVE_XINPUT2_2 + xi_device->touchpoints = NULL; xi_device->direct_p = false; #endif - xi_device->name = build_string (device->name); - xi_device->attachment = device->attachment; for (c = 0; c < device->num_classes; ++c) { commit 0a044f9405bea977a0f87fa1b777d16a11f4911a Author: Stefan Kangas Date: Tue Aug 9 13:20:07 2022 +0200 Make compat aliases obsolete in fortran.el * lisp/progmodes/fortran.el (fortran-indent-new-line) (fortran-auto-fill-mode): Make compat aliases obsolete; update callers. diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index 786c5ae804..58d7a2026e 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el @@ -1117,7 +1117,7 @@ Auto-indent does not happen if a numeric ARG is used." (eq ?\t (char-after (line-beginning-position))) (not (or (eq last-command 'fortran-indent-line) (eq last-command - 'fortran-indent-new-line)))) + 'reindent-then-newline-and-indent)))) (save-excursion (re-search-backward "[^ \t0-9]" (line-beginning-position) @@ -1586,10 +1586,6 @@ Return point or nil." (if (< (current-column) cfi) (move-to-column cfi))))) -;; Historically this was a separate function which advertised itself -;; as reindenting but only did so where `most likely to be necessary'. -(defalias 'fortran-indent-new-line 'reindent-then-newline-and-indent) - (defun fortran-indent-subprogram () "Properly indent the Fortran subprogram containing point." (interactive "*") @@ -1926,9 +1922,6 @@ If ALL is nil, only match comments that start in column > 0." ;; Result. (nth 3 parse-state)))))) -;; From old version. -(defalias 'fortran-auto-fill-mode 'auto-fill-mode) - (defun fortran-fill () "Fill the current line at an appropriate point(s)." (let* ((auto-fill-function #'fortran-auto-fill) @@ -2215,6 +2208,9 @@ arg DO-SPACE prevents stripping the whitespace." :active (not (lookup-key (current-local-map) [menu-bar index])) :help "Add an index menu to the menu-bar"])) +(define-obsolete-function-alias 'fortran-indent-new-line #'reindent-then-newline-and-indent "29.1") +(define-obsolete-function-alias 'fortran-auto-fill-mode #'auto-fill-mode "29.1") + (provide 'fortran) ;;; fortran.el ends here commit 4abeb61fc966fe708b26abcad13fc229ed44bc5d Author: Stefan Kangas Date: Tue Aug 9 12:16:15 2022 +0200 * lisp/isearch.el (isearch-mode-help): Make compat alias obsolete. diff --git a/lisp/isearch.el b/lisp/isearch.el index 336c5f1bde..31fcf01949 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -537,8 +537,6 @@ This is like `describe-bindings', but displays only Isearch keys." (describe-function 'isearch-forward)) (when isearch-mode (isearch-update))) -(defalias 'isearch-mode-help 'isearch-describe-mode) - ;; Define isearch-mode keymap. @@ -4636,6 +4634,8 @@ CASE-FOLD non-nil means the search was case-insensitive." (replace-regexp-in-string "\"" "[\"“”]"))))) (buffer-local-restore-state isearch-fold-quotes-mode--state))) +(define-obsolete-function-alias 'isearch-mode-help #'isearch-describe-mode "29.1") + (provide 'isearch) ;;; isearch.el ends here commit 5c3c18816e1cc75f5f343423c0084c709bcd5080 Author: Stefan Kangas Date: Tue Aug 9 03:24:55 2022 +0200 ; * lisp/hex-util.el: Mention ash instead of lsh. diff --git a/lisp/hex-util.el b/lisp/hex-util.el index 0858e46ec5..101c8be7b4 100644 --- a/lisp/hex-util.el +++ b/lisp/hex-util.el @@ -41,8 +41,8 @@ (dst (make-string (/ len 2) 0)) (idx 0)(pos 0)) (while (< pos len) - ;; logior and lsh are not byte-coded. - ;; (aset dst idx (logior (lsh (hex-char-to-num (aref string pos)) 4) + ;; logior and ash are not byte-coded. + ;; (aset dst idx (logior (ash (hex-char-to-num (aref string pos)) 4) ;; (hex-char-to-num (aref string (1+ pos))))) (aset dst idx (+ (* (hex-char-to-num (aref string pos)) 16) (hex-char-to-num (aref string (1+ pos))))) @@ -56,8 +56,8 @@ (dst (make-string (* len 2) 0)) (idx 0)(pos 0)) (while (< pos len) - ;; logand and lsh are not byte-coded. - ;; (aset dst idx (num-to-hex-char (logand (lsh (aref string pos) -4) 15))) + ;; logand and ash are not byte-coded. + ;; (aset dst idx (num-to-hex-char (logand (ash (aref string pos) -4) 15))) (aset dst idx (num-to-hex-char (/ (aref string pos) 16))) (setq idx (1+ idx)) ;; (aset dst idx (num-to-hex-char (logand (aref string pos) 15))) commit 7497aeff644f9d1ce542de12d8301fd13a85e90a Author: Alan Mackenzie Date: Tue Aug 9 10:46:21 2022 +0000 CC Mode: Allow the insertion of long strings of letters in reasonable time This fix allows M-: (insert (make-string 1000000 ?y)) to work fast when inserted between C++ raw string delimiters after (setq long-line-threshold nil). * lisp/progmodes/cc-langs.el (c-symbol-key): Replace a "*" by "\\{,1000\\}" in a regexp. diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index c5964165c8..75f1660f22 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -850,7 +850,7 @@ This is of the form that fits inside [ ] in a regexp." "Regexp matching identifiers and keywords (with submatch 0). Assumed to match if `c-symbol-start' matches on the same position." t (concat (c-lang-const c-symbol-start) - "[" (c-lang-const c-symbol-chars) "]*") + "[" (c-lang-const c-symbol-chars) "]\\{,1000\\}") pike (concat ;; Use the value from C here since the operator backquote is ;; covered by the other alternative. commit 97a54d132732131fb7635d91a45cf2088e98b60b Author: Po Lu Date: Tue Aug 9 16:30:45 2022 +0800 ; * src/xterm.c (xi_disable_devices): Fix portability typo. diff --git a/src/xterm.c b/src/xterm.c index ea0ddcd3be..806933fd07 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -12905,7 +12905,9 @@ xi_disable_devices (struct x_display_info *dpyinfo, } devices[ndevices++] = dpyinfo->devices[i]; + out: + continue; } } commit 1dc3ecc6c3cd20d758010ce480a8d6467cbe107f Author: Po Lu Date: Tue Aug 9 15:43:30 2022 +0800 Factor out some duplicate code from handle_one_xevent * src/xterm.c (xi_disable_devices): New function. (handle_one_xevent): Use that to disable an array of device IDs instead of copypasting the same block of code over and over again. diff --git a/src/xterm.c b/src/xterm.c index 7b90f8b481..ea0ddcd3be 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -12850,6 +12850,72 @@ xi_handle_device_changed (struct x_display_info *dpyinfo, #endif } +/* Remove the client-side record of every device in TO_DISABLE. + Called while processing XI_HierarchyChanged events. We batch up + multiple disabled devices because it is more efficient to disable + them at once. */ + +static void +xi_disable_devices (struct x_display_info *dpyinfo, + int *to_disable, int n_disabled) +{ + struct xi_device_t *devices; + int ndevices, i, j; +#ifdef HAVE_XINPUT2_2 + struct xi_touch_point_t *tem, *last; +#endif + + /* Don't pointlessly copy dpyinfo->devices if there are no devices + to disable. */ + if (!n_disabled) + return; + + ndevices = 0; + devices = xzalloc (sizeof *devices * dpyinfo->num_devices); + + /* Loop through every device currently in DPYINFO, and copy it to + DEVICES if it is not in TO_DISABLE. Note that this function + should be called with input blocked, since xfree can otherwise + call GC, which will call mark_xterm with invalid state. */ + for (i = 0; i < dpyinfo->num_devices; ++i) + { + for (j = 0; j < n_disabled; ++j) + { + if (to_disable[j] == dpyinfo->devices[i].device_id) + { + /* Free any scroll valuators that might be on this + device. */ +#ifdef HAVE_XINPUT2_1 + xfree (dpyinfo->devices[i].valuators); +#endif + + /* Free any currently active touch points on this + device. */ +#ifdef HAVE_XINPUT2_2 + tem = dpyinfo->devices[i].touchpoints; + while (tem) + { + last = tem; + tem = tem->next; + xfree (last); + } +#endif + + goto out; + } + + devices[ndevices++] = dpyinfo->devices[i]; + out: + } + } + + /* Free the old devices array and replace it with ndevices. */ + xfree (dpyinfo->devices); + + dpyinfo->devices = devices; + dpyinfo->num_devices = ndevices; +} + #endif /* The focus may have changed. Figure out if it is a real focus change, @@ -22361,11 +22427,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, { XIHierarchyEvent *hev = (XIHierarchyEvent *) xi_event; XIDeviceInfo *info; - int i, j, ndevices, n_disabled, *disabled; - struct xi_device_t *device, *devices; -#ifdef HAVE_XINPUT2_2 - struct xi_touch_point_t *tem, *last; -#endif + int i, ndevices, n_disabled, *disabled; + struct xi_device_t *device; disabled = SAFE_ALLOCA (sizeof *disabled * hev->num_info); n_disabled = 0; @@ -22376,45 +22439,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, { /* Handle all disabled devices now, to prevent things happening out-of-order later. */ - if (n_disabled) - { - ndevices = 0; - devices = xzalloc (sizeof *devices * dpyinfo->num_devices); - - for (i = 0; i < dpyinfo->num_devices; ++i) - { - for (j = 0; j < n_disabled; ++j) - { - if (disabled[j] == dpyinfo->devices[i].device_id) - { -#ifdef HAVE_XINPUT2_1 - xfree (dpyinfo->devices[i].valuators); -#endif -#ifdef HAVE_XINPUT2_2 - tem = dpyinfo->devices[i].touchpoints; - while (tem) - { - last = tem; - tem = tem->next; - xfree (last); - } -#endif - goto continue_detachment; - } - } - - devices[ndevices++] = dpyinfo->devices[i]; - - continue_detachment: - continue; - } - - xfree (dpyinfo->devices); - dpyinfo->devices = devices; - dpyinfo->num_devices = ndevices; - - n_disabled = 0; - } + xi_disable_devices (dpyinfo, disabled, n_disabled); + n_disabled = 0; x_catch_errors (dpyinfo->display); info = XIQueryDevice (dpyinfo->display, hev->info[i].deviceid, @@ -22461,43 +22487,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, } } - if (n_disabled) - { - ndevices = 0; - devices = xzalloc (sizeof *devices * dpyinfo->num_devices); - - for (i = 0; i < dpyinfo->num_devices; ++i) - { - for (j = 0; j < n_disabled; ++j) - { - if (disabled[j] == dpyinfo->devices[i].device_id) - { -#ifdef HAVE_XINPUT2_1 - xfree (dpyinfo->devices[i].valuators); -#endif -#ifdef HAVE_XINPUT2_2 - tem = dpyinfo->devices[i].touchpoints; - while (tem) - { - last = tem; - tem = tem->next; - xfree (last); - } -#endif - goto break_detachment; - } - } - - devices[ndevices++] = dpyinfo->devices[i]; - - break_detachment: - continue; - } - - xfree (dpyinfo->devices); - dpyinfo->devices = devices; - dpyinfo->num_devices = ndevices; - } + /* Delete all devices that were disabled by this + event. */ + xi_disable_devices (dpyinfo, disabled, n_disabled); /* Now that the device hierarchy has been changed, recompute focus. */ commit 85de996bbbf0d6d65728a807429263e3f14698d8 Author: Stefan Kangas Date: Mon Aug 8 21:44:01 2022 +0200 * lisp/vc/diff-mode.el: Don't mention XEmacs. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index f366261ae0..322074106f 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -27,8 +27,8 @@ ;; to the corresponding source file. ;; Inspired by Pavel Machek's patch-mode.el () -;; Some efforts were spent to have it somewhat compatible with XEmacs's -;; diff-mode as well as with compilation-minor-mode +;; Some efforts were spent to have it somewhat compatible with +;; `compilation-minor-mode'. ;; Bugs: