commit 9bfe00dda6b59d9b93eb7a825f6e0868afa1cca3 (HEAD, refs/remotes/origin/master) Author: Stefan Monnier Date: Mon Oct 24 14:25:02 2022 -0400 * lisp/progmodes/compile.el (compilation-mode-line-errors): Use `defvar` This is not really a constant, e.g. it's modified in `grep.el`. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 6473b50778..18c996e899 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -175,7 +175,7 @@ and a string describing how the process finished.") (defvar compilation-num-warnings-found 0) (defvar compilation-num-infos-found 0) -(defconst compilation-mode-line-errors +(defvar compilation-mode-line-errors '(" [" (:propertize (:eval (int-to-string compilation-num-errors-found)) face compilation-error help-echo "Number of errors so far") commit 8f16578c45fc1d23aacecdb48111f816088c7b83 Author: Mattias Engdegård Date: Mon Oct 24 15:57:39 2022 +0200 ; * doc/lispref/searching.texi (Rx Constructs): Copy-edit. diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 5a1f44402f..04f9297ec4 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1059,8 +1059,8 @@ subform. These are all valid arguments to the @code{rx} macro. All forms are defined by their described semantics; the corresponding string regexps -is provided for orientation, where @var{A}, @var{B}, @dots{} denote -(suitably bracketed) string regexp subexpressions. +are provided for ease of understanding only. @var{A}, @var{B}, @dots{} +denote (suitably bracketed) string regexp subexpressions therein. @subsubheading Literals commit 0c9d31812f91fcddb1d6626c26313cd45a661b5f Author: Eli Zaretskii Date: Mon Oct 24 16:43:47 2022 +0300 Unbreak the build broken by tab-bar.el changes Without this change, compiling tab-bar.el errors out: In tab-bar--load-buttons: tab-bar.el:161:18: Warning: reference to free variable `tab-bar-new' tab-bar.el:174:6: Error: `define-icon' defined after use in (define-icon tab-bar-close nil (cons (cons 'image (cons "tabs/close.xpm" (cons :margin (cons tab-bar-button-margin '(:ascent center))))) '((text " x"))) "Icon for closing the clicked tab." :version "29.1" :help-echo "Click to close tab") (missing `require' of a library file?) tab-bar.el:174:18: Warning: reference to free variable `tab-bar-close' * lisp/tab-bar.el (eval-when-compile): Require 'icons. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index ea615b92a2..9c746b8978 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -33,7 +33,8 @@ (eval-when-compile (require 'cl-lib) - (require 'seq)) + (require 'seq) + (require 'icons)) (defgroup tab-bar nil @@ -156,7 +157,6 @@ For easier selection of tabs by their numbers, consider customizing (defun tab-bar--load-buttons () "Load the icons for the tab buttons." (require 'icons) - (unless (iconp 'tab-bar-new) (define-icon tab-bar-new nil `((image "tabs/new.xpm" commit 366169450392c7025665f6477e5062be72c7280f Author: Mattias Engdegård Date: Mon Oct 24 14:46:24 2022 +0200 * doc/lispref/searching.texi (Rx Constructs): Elaborate intent. Suggested by Michael Heerdegen (bug#58727). diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 88b3b83f8e..5a1f44402f 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1057,10 +1057,10 @@ means zero or more @code{rx} forms and, unless stated otherwise, matches these forms in sequence as if wrapped in a @code{(seq @dots{})} subform. -These are all valid arguments to -the @code{rx} macro. Where the corresponding string -regexp syntax is given, @var{A}, @var{B}, @dots{} are string regexp -subexpressions. +These are all valid arguments to the @code{rx} macro. All forms are +defined by their described semantics; the corresponding string regexps +is provided for orientation, where @var{A}, @var{B}, @dots{} denote +(suitably bracketed) string regexp subexpressions. @subsubheading Literals commit eb3f8d1b648d0aa5e5fcaec66d9003817f00ce42 Author: Po Lu Date: Mon Oct 24 19:18:17 2022 +0800 Fix focus stealing in the Emacs server for old window managers * src/xterm.c (x_focus_frame): Apply focus stealing preference to non-EWMH focus as well. Otherwise frames get raised but not focused. diff --git a/src/xterm.c b/src/xterm.c index 06c84e2b53..205c948c46 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -27348,6 +27348,7 @@ static void x_focus_frame (struct frame *f, bool noactivate) { struct x_display_info *dpyinfo; + Time time; dpyinfo = FRAME_DISPLAY_INFO (f); @@ -27373,16 +27374,25 @@ x_focus_frame (struct frame *f, bool noactivate) /* Ignore any BadMatch error this request might result in. */ x_ignore_errors_for_next_request (dpyinfo); if (NILP (Vx_no_window_manager)) - XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), - /* It is invalid to use CurrentTime according to - the ICCCM: - - Clients that use a SetInputFocus request must - set the time field to the timestamp of the - event that caused them to make the - attempt. [...] Note that clients must not use - CurrentTime in the time field. */ - RevertToParent, dpyinfo->last_user_time); + { + /* Use the last user time. It is invalid to use CurrentTime + according to the ICCCM: + + Clients that use a SetInputFocus request must set the + time field to the timestamp of the event that caused + them to make the attempt. [...] Note that clients must + not use CurrentTime in the time field. */ + time = dpyinfo->last_user_time; + + /* Unless the focus doesn't belong to Emacs anymore and + `x-allow-focus-stealing' is set to Qnewer_time. */ + if (EQ (Vx_allow_focus_stealing, Qnewer_time) + && !dpyinfo->x_focus_frame) + time = x_get_server_time (f); + + XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), + RevertToParent, time); + } else XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), /* But when no window manager is in use, we @@ -31049,10 +31059,16 @@ connection setup. */); Some window managers prevent `x-focus-frame' from activating the given frame when Emacs is in the background, which is especially prone to -cause problems when the Emacs server wants to activate itself. This -variable specifies the strategy used to activate frames when that is -the case, and has several valid values (any other value means to not -bypass window manager focus stealing prevention): +cause problems when the Emacs server wants to activate itself. + +In addition, when an old-fashioned (pre-EWMH) window manager is being +run and `x-no-window-manager' is nil, the X server will not let Emacs +focus itself if another program was focused after the last time Emacs +obtained the input focus. + +This variable specifies the strategy used to activate frames when that +is the case, and has several valid values (any other value means to +not bypass window manager focus stealing prevention): - The symbol `imitate-pager', which means to pretend that Emacs is a pager. commit d083075b458ac532e114e6af09e990fba422d0ed Author: Mattias Engdegård Date: Mon Oct 24 12:35:47 2022 +0200 Clarify RX... semantics in manual (bug#58727) Suggested by Michael Heerdegen. * doc/lispref/searching.texi (Rx Constructs): Explain implicit concatenation of `RX...`. diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 5ee139a11d..88b3b83f8e 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1052,8 +1052,12 @@ customization. @subsubsection Constructs in @code{rx} regexps The various forms in @code{rx} regexps are described below. The -shorthand @var{rx} represents any @code{rx} form, and @var{rx}@dots{} -means zero or more @code{rx} forms. These are all valid arguments to +shorthand @var{rx} represents any @code{rx} form. @var{rx}@dots{} +means zero or more @code{rx} forms and, unless stated otherwise, +matches these forms in sequence as if wrapped in a @code{(seq @dots{})} +subform. + +These are all valid arguments to the @code{rx} macro. Where the corresponding string regexp syntax is given, @var{A}, @var{B}, @dots{} are string regexp subexpressions. commit aa793512d04c53e423563530f64c1d42d7d0accd Author: Martin Jerabek Date: Mon Oct 24 12:02:20 2022 +0200 Repair nXML handling of URIs with hex escapes (bug#58718) Copyright-paperwork-exempt: yes * lisp/nxml/rng-uri.el (rng-uri-file-name-1): Add missing backslashes. (rng-uri-unescape-unibyte, rng-uri-unescape-unibyte-match): Convert hex-encoded character to string. diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el index 77fed8c32d..59e696e2cc 100644 --- a/lisp/nxml/rng-uri.el +++ b/lisp/nxml/rng-uri.el @@ -68,7 +68,7 @@ Signal an error if URI is not a valid file URL." ;; pattern is either nil or match or replace (defun rng-uri-file-name-1 (uri pattern) - (unless (string-match "\\`\\(?:[^%]\\|%[[:xdigit:]]{2}\\)*\\'" uri) + (unless (string-match "\\`\\(?:[^%]\\|%[[:xdigit:]]\\{2\\}\\)*\\'" uri) (rng-uri-error "Bad escapes in URI `%s'" uri)) (setq uri (rng-uri-unescape-multibyte uri)) (let* ((components @@ -312,7 +312,7 @@ Both FULL and BASE must be absolute URIs." (defun rng-uri-unescape-unibyte (str) (replace-regexp-in-string "%[0-7][[:xdigit:]]" (lambda (h) - (string-to-number (substring h 1) 16)) + (string (string-to-number (substring h 1) 16))) str t t)) @@ -325,8 +325,8 @@ Both FULL and BASE must be absolute URIs." (regexp-quote (if (= (length match) 1) match - (string-to-number (substring match 1) - 16))))) + (string (string-to-number (substring match 1) + 16)))))) str t t)) commit 36f5a1a7e74442272796413575f85ba9bd18cb53 Author: Mattias Engdegård Date: Sun Oct 23 15:40:37 2022 +0200 Fix regexp matching with atomic strings and optimised backtracking This bug occurs when an atomic pattern is matched at the end of a string and the on-failure-keep-string-jump optimisation is in effect, as in: (string-match "\\'\\(?:ab\\)*\\'" "a") which succeeded but clearly should not (bug#58726). Reported by Michael Heerdegen. * src/regex-emacs.c (PREFETCH): Add reset parameter. (re_match_2_internal): Use it for proper atomic pattern treatment. * test/src/regex-emacs-tests.el (regexp-atomic-failure): New test. diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 9b2c14c413..626560911f 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c @@ -3446,14 +3446,18 @@ static bool bcmp_translate (re_char *, re_char *, ptrdiff_t, /* Call before fetching a character with *d. This switches over to string2 if necessary. + `reset' is executed before backtracking if there are no more characters. Check re_match_2_internal for a discussion of why end_match_2 might not be within string2 (but be equal to end_match_1 instead). */ -#define PREFETCH() \ +#define PREFETCH(reset) \ while (d == dend) \ { \ /* End of string2 => fail. */ \ if (dend == end_match_2) \ - goto fail; \ + { \ + reset; \ + goto fail; \ + } \ /* End of string1 => advance to string2. */ \ d = string2; \ dend = end_match_2; \ @@ -4252,7 +4256,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, int pat_charlen, buf_charlen; int pat_ch, buf_ch; - PREFETCH (); + PREFETCH (d = dfail); if (multibyte) pat_ch = string_char_and_length (p, &pat_charlen); else @@ -4280,7 +4284,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, int pat_charlen; int pat_ch, buf_ch; - PREFETCH (); + PREFETCH (d = dfail); if (multibyte) { pat_ch = string_char_and_length (p, &pat_charlen); @@ -4486,7 +4490,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, if (d2 == dend2) break; /* If necessary, advance to next segment in data. */ - PREFETCH (); + PREFETCH (d = dfail); /* How many characters left in this segment to match. */ dcnt = dend - d; diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el index ff0d6be3f5..b323f592dc 100644 --- a/test/src/regex-emacs-tests.el +++ b/test/src/regex-emacs-tests.el @@ -867,4 +867,9 @@ This evaluates the TESTS test cases from glibc." (should (equal (string-match "[[:lower:]]" "ẞ") 0)) (should (equal (string-match "[[:upper:]]" "ẞ") 0)))) +(ert-deftest regexp-atomic-failure () + "Bug#58726." + (should (equal (string-match "\\`\\(?:ab\\)*\\'" "a") nil)) + (should (equal (string-match "\\`a\\{2\\}*\\'" "a") nil))) + ;;; regex-emacs-tests.el ends here commit b5ada7aa6fcb14019df207259609d602150b03a4 Author: Robert Pluim Date: Fri Oct 21 09:48:00 2022 +0200 Remove erroneous @w in yank-media cross ref I added this by mistake, there's actually no need to keep the cross ref on the same line. * doc/emacs/killing.texi (Clipboard): Remove @w around @pxref. diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi index bb8d51158a..bac2f7ff78 100644 --- a/doc/emacs/killing.texi +++ b/doc/emacs/killing.texi @@ -570,8 +570,8 @@ change the variable @code{select-enable-clipboard} to @code{nil}. instance, a web browser will usually let you choose ``Copy Image'' on images, and this image will be put on the clipboard. On capable platforms, Emacs can yank these objects with the @code{yank-media} -command---but only in modes that have support for it (@w{@pxref{Yanking -Media,,, elisp, The Emacs Lisp Reference Manual}}). +command---but only in modes that have support for it (@pxref{Yanking +Media,,, elisp, The Emacs Lisp Reference Manual}). @cindex clipboard manager @vindex x-select-enable-clipboard-manager commit c06b5961ee447780fb5dc15ec8ed38d14c2398df Author: Juri Linkov Date: Mon Oct 24 10:33:41 2022 +0300 * lisp/tab-bar.el: Use customizable button icons (bug#51309, bug#51648) * lisp/tab-bar.el (tab-bar--load-buttons): Use 'define-icon' to define icons for tab-bar-new, tab-bar-close, tab-bar-menu-bar. Also set tab-bar-new-button, tab-bar-close-button, tab-bar-menu-bar-button to the specified icon-string. (tab-bar-history-mode): Use 'define-icon' to define icons for tab-bar-back, tab-bar-forward. Also set tab-bar-back-button, tab-bar-forward-button to the specified icon-string. * lisp/emacs-lisp/icons.el (icons--create): Allow to easy add new image props by using 'apply' on them. Add :margin. diff --git a/lisp/emacs-lisp/icons.el b/lisp/emacs-lisp/icons.el index a08ac7463c..86c4483030 100644 --- a/lisp/emacs-lisp/icons.el +++ b/lisp/emacs-lisp/icons.el @@ -196,18 +196,21 @@ present if the icon is represented by an image." (image-supported-file-p file) (propertize " " 'display - (if-let ((height (plist-get keywords :height))) - (create-image file - nil nil - :height (if (eq height 'line) + (let ((props + (append + (if-let ((height (plist-get keywords :height))) + (list :height (if (eq height 'line) (window-default-line-height) - height) - :scale 1 - :rotation (or (plist-get keywords :rotation) 0) - :ascent (if (plist-member keywords :ascent) - (plist-get keywords :ascent) - 'center)) - (create-image file)))))) + height))) + '(:scale 1) + (if-let ((rotation (plist-get keywords :rotation))) + (list :rotation rotation)) + (if-let ((margin (plist-get keywords :margin))) + (list :margin margin)) + (list :ascent (if (plist-member keywords :ascent) + (plist-get keywords :ascent) + 'center))))) + (apply 'create-image file nil nil props)))))) (cl-defmethod icons--create ((_type (eql 'emoji)) icon _keywords) (when-let ((font (and (display-multi-font-p) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index abefd996a8..ea615b92a2 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -155,25 +155,44 @@ For easier selection of tabs by their numbers, consider customizing (defun tab-bar--load-buttons () "Load the icons for the tab buttons." - (when (and tab-bar-new-button - (not (get-text-property 0 'display tab-bar-new-button))) - ;; This file is pre-loaded so only here we can use the right data-directory: - (add-text-properties 0 (length tab-bar-new-button) - `(display (image :type xpm - :file "tabs/new.xpm" - :margin ,tab-bar-button-margin - :ascent center)) - tab-bar-new-button)) - - (when (and tab-bar-close-button - (not (get-text-property 0 'display tab-bar-close-button))) - ;; This file is pre-loaded so only here we can use the right data-directory: - (add-text-properties 0 (length tab-bar-close-button) - `(display (image :type xpm - :file "tabs/close.xpm" - :margin ,tab-bar-button-margin - :ascent center)) - tab-bar-close-button))) + (require 'icons) + + (unless (iconp 'tab-bar-new) + (define-icon tab-bar-new nil + `((image "tabs/new.xpm" + :margin ,tab-bar-button-margin + :ascent center) + ;; (emoji "➕") + ;; (symbol "+") + (text " + ")) + "Icon for creating a new tab." + :version "29.1" + :help-echo "New tab")) + (setq tab-bar-new-button (icon-string 'tab-bar-new)) + + (unless (iconp 'tab-bar-close) + (define-icon tab-bar-close nil + `((image "tabs/close.xpm" + :margin ,tab-bar-button-margin + :ascent center) + ;; (emoji " ❌") + ;; (symbol "✕") ;; "ⓧ" + (text " x")) + "Icon for closing the clicked tab." + :version "29.1" + :help-echo "Click to close tab")) + (setq tab-bar-close-button (propertize (icon-string 'tab-bar-close) + 'close-tab t)) + + (unless (iconp 'tab-bar-menu-bar) + (define-icon tab-bar-menu-bar nil + '(;; (emoji "🍔") + (symbol "☰") + (text "Menu" :face tab-bar-tab-inactive)) + "Icon for for the menu bar." + :version "29.1" + :help-echo "Menu bar")) + (setq tab-bar-menu-bar-button (icon-string 'tab-bar-menu-bar))) (defun tab-bar--tab-bar-lines-for-frame (frame) "Determine and return the value of `tab-bar-lines' for FRAME. @@ -721,7 +740,7 @@ If a function returns nil, it doesn't directly affect the tab bar appearance, but can do that by some side-effect. If the list ends with `tab-bar-format-align-right' and `tab-bar-format-global', then after enabling `display-time-mode' -(or any other mode that uses `global-mode-string'), +\(or any other mode that uses `global-mode-string'), it will display time aligned to the right on the tab bar instead of the mode line. Replacing `tab-bar-format-tabs' with `tab-bar-format-tabs-groups' will group tabs on the tab bar." @@ -921,7 +940,7 @@ when the tab is current. Return the result as a keymap." (defun tab-bar-format-global () "Produce display of `global-mode-string' in the tab bar. When `tab-bar-format-global' is added to `tab-bar-format' -(possibly appended after `tab-bar-format-align-right'), +\(possibly appended after `tab-bar-format-align-right'), then modes that display information on the mode line using `global-mode-string' will display the same text on the tab bar instead." @@ -1916,22 +1935,27 @@ and can restore them." :global t :group 'tab-bar (if tab-bar-history-mode (progn - (when (and tab-bar-mode (not (get-text-property 0 'display tab-bar-back-button))) - ;; This file is pre-loaded so only here we can use the right data-directory: - (add-text-properties 0 (length tab-bar-back-button) - `(display (image :type xpm - :file "tabs/left-arrow.xpm" - :margin ,tab-bar-button-margin - :ascent center)) - tab-bar-back-button)) - (when (and tab-bar-mode (not (get-text-property 0 'display tab-bar-forward-button))) - ;; This file is pre-loaded so only here we can use the right data-directory: - (add-text-properties 0 (length tab-bar-forward-button) - `(display (image :type xpm - :file "tabs/right-arrow.xpm" - :margin ,tab-bar-button-margin - :ascent center)) - tab-bar-forward-button)) + (require 'icons) + + (unless (iconp 'tab-bar-back) + (define-icon tab-bar-back nil + `((image "tabs/left-arrow.xpm" + :margin ,tab-bar-button-margin + :ascent center) + (text " < ")) + "Icon for going back in tab history." + :version "29.1")) + (setq tab-bar-back-button (icon-string 'tab-bar-back)) + + (unless (iconp 'tab-bar-forward) + (define-icon tab-bar-forward nil + `((image "tabs/right-arrow.xpm" + :margin ,tab-bar-button-margin + :ascent center) + (text " > ")) + "Icon for going forward in tab history." + :version "29.1")) + (setq tab-bar-forward-button (icon-string 'tab-bar-forward)) (add-hook 'pre-command-hook 'tab-bar--history-pre-change) (add-hook 'window-configuration-change-hook 'tab-bar--history-change)) commit 590086339f4082d85d670893364677efebe44b02 Author: Juri Linkov Date: Mon Oct 24 10:22:37 2022 +0300 * lisp/minibuffer.el (completions-group-separator): Update :version. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index f193e9f9ac..a9f72d600d 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1239,7 +1239,7 @@ pair of a group title string and a list of group candidate strings." (defface completions-group-separator '((t :inherit shadow :underline t)) "Face used for the separator lines between the candidate groups." - :version "28.1") + :version "29.1") (defun completion--cycle-threshold (metadata) (let* ((cat (completion-metadata-get metadata 'category))