commit 928ea0fbf13671e17c9839791163d1da056df490 (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Sun Jul 24 10:43:52 2022 +0800 ; * lisp/x-dnd.el (x-dnd-init-frame): Ignore tip frames. diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el index ac78deaab6..a61905cfac 100644 --- a/lisp/x-dnd.el +++ b/lisp/x-dnd.el @@ -194,7 +194,8 @@ any protocol specific data.") (defun x-dnd-init-frame (&optional frame) "Setup drag and drop for FRAME (i.e. create appropriate properties)." - (when (eq 'x (window-system frame)) + (when (and (eq 'x (window-system frame)) + (not (frame-parameter frame 'tooltip))) (let ((x-fast-protocol-requests (not x-dnd-debug-errors))) (x-register-dnd-atom "DndProtocol" frame) (x-register-dnd-atom "_MOTIF_DRAG_AND_DROP_MESSAGE" frame) commit 235045f712ef5c0dea12c5005cc07118971f413f Author: Po Lu Date: Sun Jul 24 10:42:02 2022 +0800 Prevent exposing tooltip frames to Lisp code during drag-and-drop * src/xterm.c (x_dnd_compute_toplevels): Ignore tooltip frames. (x_tooltip_window_to_frame): Allow unrelated_tooltip_p to be NULL. (handle_one_xevent): Ignore DND events to tooltip frames. diff --git a/src/xterm.c b/src/xterm.c index 45a81a3fdb..67a7de4213 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2937,7 +2937,7 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo) Window *toplevels; int format, rc; unsigned long nitems, bytes_after; - unsigned long i; + unsigned long i, real_nitems; unsigned char *data = NULL; int frame_extents[4]; @@ -3001,6 +3001,16 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo) toplevels = (Window *) data; + for (i = 0, real_nitems = 0; i < nitems; ++i) + { + /* Some window managers with built in compositors end up putting + tooltips in the client list, which is silly. */ + if (!x_tooltip_window_to_frame (dpyinfo, toplevels[i], NULL)) + toplevels[real_nitems++] = toplevels[i]; + } + + nitems = real_nitems; + #ifdef USE_XCB USE_SAFE_ALLOCA; @@ -11072,7 +11082,8 @@ x_tooltip_window_to_frame (struct x_display_info *dpyinfo, GdkWindow *tooltip_window; #endif - *unrelated_tooltip_p = false; + if (unrelated_tooltip_p) + *unrelated_tooltip_p = false; FOR_EACH_FRAME (tail, frame) { @@ -11101,14 +11112,16 @@ x_tooltip_window_to_frame (struct x_display_info *dpyinfo, if (tooltip_window && (gdk_x11_window_get_xid (tooltip_window) == wdesc)) { - *unrelated_tooltip_p = true; + if (unrelated_tooltip_p) + *unrelated_tooltip_p = true; break; } #else if (tooltip_window && (GDK_WINDOW_XID (tooltip_window) == wdesc)) { - *unrelated_tooltip_p = true; + if (unrelated_tooltip_p) + *unrelated_tooltip_p = true; break; } #endif @@ -16972,7 +16985,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, xft_settings_event (dpyinfo, event); f = any; - if (!f) + /* We don't want to ever leak tooltip frames to Lisp code. */ + if (!f || FRAME_TOOLTIP_P (f)) goto OTHER; /* These values are always used initialized, but GCC doesn't commit 1b99f2908b7d2c17dc1231f83f499fe460ba926a Author: Dmitry Gutov Date: Sat Jul 23 21:13:17 2022 +0300 * lisp/progmodes/xref.el: Bump the version. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index edfb62ea7a..f3db971bcf 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1,7 +1,7 @@ ;;; xref.el --- Cross-referencing commands -*-lexical-binding:t-*- ;; Copyright (C) 2014-2022 Free Software Foundation, Inc. -;; Version: 1.4.1 +;; Version: 1.5.0 ;; Package-Requires: ((emacs "26.1")) ;; This is a GNU ELPA :core package. Avoid functionality that is not commit 96926fa6eb0f71f47586d50ac5532b57bff1ab54 Author: Mattias Engdegård Date: Sat Jul 23 18:42:11 2022 +0200 Fix `lsh` warning shortcomings (bug#56641) Reported by Basil Contovounesios. * etc/NEWS: Mention how to suppress the warning. * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): Amend doc string. * lisp/subr.el: Use `macroexp-warn-and-return` to delay the warning until codegen time (which makes it suppressible) and to prevent repeated warnings. * test/lisp/international/ccl-tests.el (shift): * test/src/data-tests.el (data-tests-ash-lsh): Suppress warning in tests of `lsh` itself. diff --git a/etc/NEWS b/etc/NEWS index 412a93bbf9..27046894ad 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2336,7 +2336,9 @@ It's been obsolete since Emacs-22.1, actually. ** Calling 'lsh' now elicits a byte-compiler warning. 'lsh' behaves in somewhat surprising and platform-dependent ways for negative arguments, and is generally slower than 'ash', which should be -used instead. +used instead. This warning can be suppressed by surrounding calls to +'lsh' with the construct '(with-suppressed-warnings ((suspicious lsh)) ...)', +but switching to `ash` is generally much preferable. --- ** Some functions and variables obsolete since Emacs 24 have been removed: diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index dd90bcf4d8..9370bd3a09 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -672,7 +672,7 @@ types. The types that can be suppressed with this macro are `suspicious'. For the `mapcar' case, only the `mapcar' function can be used in -the symbol list. For `suspicious', only `set-buffer' can be used." +the symbol list. For `suspicious', only `set-buffer' and `lsh' can be used." ;; Note: during compilation, this definition is overridden by the one in ;; byte-compile-initial-macro-environment. (declare (debug (sexp body)) (indent 1)) diff --git a/lisp/subr.el b/lisp/subr.el index 06da5e2873..a0ad967533 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -530,9 +530,8 @@ This function is provided for compatibility. In new code, use `ash' instead." (declare (compiler-macro (lambda (form) - (when (byte-compile-warning-enabled-p 'suspicious 'lsh) - (byte-compile-warn-x form "avoid `lsh'; use `ash' instead")) - form))) + (macroexp-warn-and-return "avoid `lsh'; use `ash' instead" + form '(suspicious lsh) t form)))) (when (and (< value 0) (< count 0)) (when (< value most-negative-fixnum) (signal 'args-out-of-range (list value count))) diff --git a/test/lisp/international/ccl-tests.el b/test/lisp/international/ccl-tests.el index 57ac74639b..cf472415c7 100644 --- a/test/lisp/international/ccl-tests.el +++ b/test/lisp/international/ccl-tests.el @@ -25,23 +25,25 @@ (ert-deftest shift () - ;; shift left +ve 5628 #x00000000000015fc - (should (= (ash 5628 8) 1440768)) ; #x000000000015fc00 - (should (= (lsh 5628 8) 1440768)) ; #x000000000015fc00 - - ;; shift left -ve -5628 #x3fffffffffffea04 - (should (= (ash -5628 8) -1440768)) ; #x3fffffffffea0400 - (should (= (lsh -5628 8) -1440768)) ; #x3fffffffffea0400 - - ;; shift right +ve 5628 #x00000000000015fc - (should (= (ash 5628 -8) 21)) ; #x0000000000000015 - (should (= (lsh 5628 -8) 21)) ; #x0000000000000015 - - ;; shift right -ve -5628 #x3fffffffffffea04 - (should (= (ash -5628 -8) -22)) ; #x3fffffffffffffea - (should (= (lsh -5628 -8) - (ash (- -5628 (ash most-negative-fixnum 1)) -8) - (ash (logand (ash -5628 -1) most-positive-fixnum) -7)))) + (with-suppressed-warnings ((suspicious lsh)) + + ;; shift left +ve 5628 #x00000000000015fc + (should (= (ash 5628 8) 1440768)) ; #x000000000015fc00 + (should (= (lsh 5628 8) 1440768)) ; #x000000000015fc00 + + ;; shift left -ve -5628 #x3fffffffffffea04 + (should (= (ash -5628 8) -1440768)) ; #x3fffffffffea0400 + (should (= (lsh -5628 8) -1440768)) ; #x3fffffffffea0400 + + ;; shift right +ve 5628 #x00000000000015fc + (should (= (ash 5628 -8) 21)) ; #x0000000000000015 + (should (= (lsh 5628 -8) 21)) ; #x0000000000000015 + + ;; shift right -ve -5628 #x3fffffffffffea04 + (should (= (ash -5628 -8) -22)) ; #x3fffffffffffffea + (should (= (lsh -5628 -8) + (ash (- -5628 (ash most-negative-fixnum 1)) -8) + (ash (logand (ash -5628 -1) most-positive-fixnum) -7))))) ;; CCl program from `pgg-parse-crc24' in lisp/obsolete/pgg-parse.el (defconst prog-pgg-source diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 7ce2995e56..0f84b2fb77 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -741,14 +741,15 @@ comparing the subr with a much slower Lisp implementation." (should (= (ash 1000 (* 2 most-negative-fixnum)) 0)) (should (= (ash -1000 (* 2 most-negative-fixnum)) -1)) (should (= (ash (* 2 most-negative-fixnum) (* 2 most-negative-fixnum)) -1)) - (should (= (lsh most-negative-fixnum 1) - (* most-negative-fixnum 2))) (should (= (ash (* 2 most-negative-fixnum) -1) most-negative-fixnum)) - (should (= (lsh most-positive-fixnum -1) (/ most-positive-fixnum 2))) - (should (= (lsh most-negative-fixnum -1) (lsh (- most-negative-fixnum) -1))) - (should (= (lsh -1 -1) most-positive-fixnum)) - (should-error (lsh (1- most-negative-fixnum) -1))) + (with-suppressed-warnings ((suspicious lsh)) + (should (= (lsh most-negative-fixnum 1) + (* most-negative-fixnum 2))) + (should (= (lsh most-positive-fixnum -1) (/ most-positive-fixnum 2))) + (should (= (lsh most-negative-fixnum -1) (lsh (- most-negative-fixnum) -1))) + (should (= (lsh -1 -1) most-positive-fixnum)) + (should-error (lsh (1- most-negative-fixnum) -1)))) (ert-deftest data-tests-make-local-forwarded-var () ;bug#34318 ;; Boy, this bug is tricky to trigger. You need to: commit 26f4bcc6d7cd541fab981836ee0b67259280ff4b Author: Basil L. Contovounesios Date: Sat Jul 23 14:22:09 2022 +0300 Update pdumper.c after recent long lines changes For discussion, see: https://lists.gnu.org/r/emacs-devel/2022-07/msg00761.html * src/pdumper.c (dump_buffer): Dump new field long_line_optimizations_p introduced in commit e7b5912b23 of 2022-07-16 "Improvements to long lines handling." (dump_buffer) [CHECK_STRUCTS]: Update hash accordingly for --enable-checking=structs. diff --git a/src/pdumper.c b/src/pdumper.c index af451920eb..33cb804dba 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -2701,7 +2701,7 @@ dump_hash_table (struct dump_context *ctx, static dump_off dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer) { -#if CHECK_STRUCTS && !defined HASH_buffer_F8FE65D42F +#if CHECK_STRUCTS && !defined HASH_buffer_AA373AEE10 # error "buffer changed. See CHECK_STRUCTS comment in config.h." #endif struct buffer munged_buffer = *in_buffer; @@ -2813,6 +2813,7 @@ dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer) DUMP_FIELD_COPY (out, buffer, prevent_redisplay_optimizations_p); DUMP_FIELD_COPY (out, buffer, clip_changed); DUMP_FIELD_COPY (out, buffer, inhibit_buffer_hooks); + DUMP_FIELD_COPY (out, buffer, long_line_optimizations_p); dump_field_lv_rawptr (ctx, out, buffer, &buffer->overlays_before, Lisp_Vectorlike, WEIGHT_NORMAL); commit aa28829eb7800f3e9df1ef1df36b07a4e9cb2cf2 Author: Mattias Engdegård Date: Sat Jul 23 14:55:54 2022 +0200 Correct symbol in error for failed CHECK_INTEGER (bug#56723) Reported by Jeronimo Pellegrini. * src/lisp.h (CHECK_INTEGER): Use integerp, not numberp. diff --git a/src/lisp.h b/src/lisp.h index 2afe135674..8fcc9b6e75 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3146,7 +3146,7 @@ CHECK_NUMBER (Lisp_Object x) INLINE void CHECK_INTEGER (Lisp_Object x) { - CHECK_TYPE (INTEGERP (x), Qnumberp, x); + CHECK_TYPE (INTEGERP (x), Qintegerp, x); } INLINE void commit 38d5e346df3e492a701801652d15b7209c394248 Author: Dmitry Gutov Date: Sat Jul 23 15:23:56 2022 +0300 Support new "binary file matches" format in Ripgrep 13 * lisp/progmodes/xref.el (xref-matches-in-files): Support new "binary file matches" format in Ripgrep 13 (bug#56624). diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 0213ab3cc5..edfb62ea7a 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1821,7 +1821,8 @@ to control which program to use when looking for matches." (when (and (/= (point-min) (point-max)) (not (looking-at grep-re)) ;; TODO: Show these matches as well somehow? - (not (looking-at "Binary file .* matches"))) + ;; Matching both Grep's and Ripgrep 13's messages. + (not (looking-at ".*[bB]inary file.* matches"))) (user-error "Search failed with status %d: %s" status (buffer-substring (point-min) (line-end-position)))) (while (re-search-forward grep-re nil t) commit cf83da0708fde16467570adb08ade90fbcefcd44 Author: Po Lu Date: Sat Jul 23 19:57:50 2022 +0800 Remove macOS region color code * lisp/faces.el (region): Remove macOS specific definition. Equivalent functionality is no longer available on free operating systems. diff --git a/lisp/faces.el b/lisp/faces.el index b2589c5c06..0418cd4c05 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2496,15 +2496,9 @@ default." "Basic face for highlighting." :group 'basic-faces) -;; Region face: under NS, default to the system-defined selection -;; color (optimized for the fixed white background of other apps), -;; if background is light. (defface region '((((class color) (min-colors 88) (background dark)) :background "blue3" :extend t) - (((class color) (min-colors 88) (background light) (type ns)) - :distant-foreground "ns_selection_fg_color" - :background "ns_selection_bg_color" :extend t) (((class color) (min-colors 88) (background light)) :background "lightgoldenrod2" :extend t) (((class color) (min-colors 16) (background dark)) commit 9171fa09332df615832240e98c247638019c0211 Author: Eli Zaretskii Date: Sat Jul 23 13:46:06 2022 +0300 ; * etc/NEWS: Fix wording and punctuation of 'comint-delete-old-input'. diff --git a/etc/NEWS b/etc/NEWS index 5b2e27ec25..412a93bbf9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1004,9 +1004,10 @@ The user option 'comint-terminfo-terminal' and the variable change the terminal used on a remote host. --- -*** New user option 'comint-delete-old-input' -When set to nil, this prevents comint from deleting the current input -when inserting previous input using ''. +*** New user option 'comint-delete-old-input'. +When nil, this prevents comint from deleting the current input when +inserting previous input using ''. The default is t, to +preserve past behavior. ** Mwheel commit 74152fe806b3ebe699669243eeb178e04f68b257 Author: Eli Zaretskii Date: Sat Jul 23 13:42:13 2022 +0300 ; * etc/NEWS: Fix typo. diff --git a/etc/NEWS b/etc/NEWS index 41036160b8..5b2e27ec25 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -168,7 +168,7 @@ of 'user-emacs-directory'. --- *** The Gtk selection face is no longer used for the region. -The combination of a Gtk-controlled background and a foreground colour +The combination of a Gtk-controlled background and a foreground color controlled by the internal Emacs machinery led to low-contrast faces in common default setups. Emacs now uses the same 'region' face on Gtk and non-Gtk setups. commit cc095d28738c8412417ed46e9c482fae8dd7a706 Author: Eli Zaretskii Date: Sat Jul 23 13:39:50 2022 +0300 ; * etc/NEWS: Move the 'lsh' item to its proper place. diff --git a/etc/NEWS b/etc/NEWS index a1fea5d6d6..41036160b8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2331,6 +2331,12 @@ This change is now applied in 'dired-insert-directory'. ** 'compilation-last-buffer' is (finally) declared obsolete. It's been obsolete since Emacs-22.1, actually. +--- +** Calling 'lsh' now elicits a byte-compiler warning. +'lsh' behaves in somewhat surprising and platform-dependent ways for +negative arguments, and is generally slower than 'ash', which should be +used instead. + --- ** Some functions and variables obsolete since Emacs 24 have been removed: 'Info-edit-map', 'allout-abbreviate-flattened-numbering', @@ -3230,12 +3236,6 @@ to preserve the old behavior, apply '(take N LIST)' returns the first N elements of LIST; 'ntake' does the same but works by modifying LIST destructively. ---- -** Calling 'lsh' now elicits a byte-compiler warning. -'lsh' behaves in somewhat surprising and platform-dependent ways for -negative arguments and is generally slower than 'ash' which should be -used instead. - * Changes in Emacs 29.1 on Non-Free Operating Systems commit 92892e5611c978f1473174f79b8a748d26ed37c6 Author: Mattias Engdegård Date: Sat Jul 23 12:29:35 2022 +0200 Use `ash` instead of `lsh` in verilog-mode (bug#56641) * lisp/progmodes/verilog-mode.el (verilog-simplify-range-expression): Use `ash`; the result will be the same because the first argument is nonnegative. diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index df3b28615f..f063fb5a7c 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -10880,10 +10880,10 @@ This repairs those mis-inserted by an AUTOARG." (setq out (replace-match (concat (match-string 1 out) (if (equal (match-string 3 out) ">>") - (int-to-string (lsh (string-to-number (match-string 2 out)) + (int-to-string (ash (string-to-number (match-string 2 out)) (* -1 (string-to-number (match-string 4 out)))))) (if (equal (match-string 3 out) "<<") - (int-to-string (lsh (string-to-number (match-string 2 out)) + (int-to-string (ash (string-to-number (match-string 2 out)) (string-to-number (match-string 4 out))))) (if (equal (match-string 3 out) ">>>") (int-to-string (ash (string-to-number (match-string 2 out)) commit 72a457e92e3b13b071b29afa8912a244843d04bc Author: Mattias Engdegård Date: Sat Jul 23 12:15:08 2022 +0200 Warn about calls to `lsh` (bug#56641) * lisp/subr.el (lsh): Warn when compiled; recommend `ash`. * etc/NEWS: Add note. diff --git a/etc/NEWS b/etc/NEWS index 780dbfa51e..a1fea5d6d6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3230,6 +3230,12 @@ to preserve the old behavior, apply '(take N LIST)' returns the first N elements of LIST; 'ntake' does the same but works by modifying LIST destructively. +--- +** Calling 'lsh' now elicits a byte-compiler warning. +'lsh' behaves in somewhat surprising and platform-dependent ways for +negative arguments and is generally slower than 'ash' which should be +used instead. + * Changes in Emacs 29.1 on Non-Free Operating Systems diff --git a/lisp/subr.el b/lisp/subr.el index 510a77dbc8..06da5e2873 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -528,6 +528,11 @@ i.e., subtract 2 * `most-negative-fixnum' from VALUE before shifting it. This function is provided for compatibility. In new code, use `ash' instead." + (declare (compiler-macro + (lambda (form) + (when (byte-compile-warning-enabled-p 'suspicious 'lsh) + (byte-compile-warn-x form "avoid `lsh'; use `ash' instead")) + form))) (when (and (< value 0) (< count 0)) (when (< value most-negative-fixnum) (signal 'args-out-of-range (list value count))) commit 3d6cfdf1c51794b8db39ed8dae7cad7c9263f601 Author: Mattias Engdegård Date: Sat Jul 23 11:04:28 2022 +0200 ; * lisp/emacs-lisp/bytecomp.el: comment cleanup diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 86681cf4dd..b4954eee9f 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -846,6 +846,8 @@ the unwind-action") (byte-defop 178 -1 byte-stack-set) ; Stack offset in following one byte. (byte-defop 179 -1 byte-stack-set2) ; Stack offset in following two bytes. +;; unused: 180-181 + ;; If (following one byte & 0x80) == 0 ;; discard (following one byte & 0x7F) stack entries ;; else @@ -2077,7 +2079,6 @@ value is `no-byte-compile'. See also `emacs-lisp-byte-compile-and-load'." (declare (advertised-calling-convention (filename) "28.1")) -;; (interactive "fByte compile file: \nP") (interactive (let ((file buffer-file-name) (file-dir nil)) @@ -3759,7 +3760,6 @@ If it is nil, then the handler is \"byte-compile-SYMBOL.\"" (put 'byte-insertN 'byte-opcode-invert 'insert) (byte-defop-compiler point 0) -;;(byte-defop-compiler mark 0) ;; obsolete (byte-defop-compiler point-max 0) (byte-defop-compiler point-min 0) (byte-defop-compiler following-char 0) @@ -3770,8 +3770,6 @@ If it is nil, then the handler is \"byte-compile-SYMBOL.\"" (byte-defop-compiler bolp 0) (byte-defop-compiler bobp 0) (byte-defop-compiler current-buffer 0) -;;(byte-defop-compiler read-char 0) ;; obsolete -;; (byte-defop-compiler interactive-p 0) ;; Obsolete. (byte-defop-compiler widen 0) (byte-defop-compiler end-of-line 0-1) (byte-defop-compiler forward-char 0-1) @@ -3792,7 +3790,6 @@ If it is nil, then the handler is \"byte-compile-SYMBOL.\"" (byte-defop-compiler goto-char 1) (byte-defop-compiler char-after 0-1) (byte-defop-compiler set-buffer 1) -;;(byte-defop-compiler set-mark 1) ;; obsolete (byte-defop-compiler forward-word 0-1) (byte-defop-compiler char-syntax 1) (byte-defop-compiler nreverse 1) @@ -3845,7 +3842,6 @@ If it is nil, then the handler is \"byte-compile-SYMBOL.\"" (byte-defop-compiler (+ byte-plus) byte-compile-variadic-numeric) (byte-defop-compiler (* byte-mult) byte-compile-variadic-numeric) -;;####(byte-defop-compiler move-to-column 1) (byte-defop-compiler-1 interactive byte-compile-noop) @@ -4800,8 +4796,6 @@ binding slots have been popped." (byte-defop-compiler-1 save-excursion) (byte-defop-compiler-1 save-current-buffer) (byte-defop-compiler-1 save-restriction) -;; (byte-defop-compiler-1 save-window-excursion) ;Obsolete: now a macro. -;; (byte-defop-compiler-1 with-output-to-temp-buffer) ;Obsolete: now a macro. (defun byte-compile-catch (form) (byte-compile-form (car (cdr form))) commit 49d16a7eb4932a83259f3c0db848e5181df5539d Author: Po Lu Date: Sat Jul 23 17:02:22 2022 +0800 Undo C parts of "Don't use the Gtk region face" This reverts commit a24f710395f9777cb9f8b000300e5e9c892d7794, apart from the change to faces.el and NEWS. diff --git a/src/gtkutil.c b/src/gtkutil.c index 87f166bf54..a6bba096a4 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -727,6 +727,88 @@ get_utf8_string (const char *str) return utf8_str; } +/* Check for special colors used in face spec for region face. + The colors are fetched from the Gtk+ theme. + Return true if color was found, false if not. */ + +bool +xg_check_special_colors (struct frame *f, + const char *color_name, + Emacs_Color *color) +{ + bool success_p; + bool get_bg; + bool get_fg; +#ifdef HAVE_GTK3 + GtkStyleContext *gsty; + GdkRGBA col; + char buf[sizeof "rgb://rrrr/gggg/bbbb"]; + int state; + GdkRGBA *c; + unsigned short r, g, b; +#else + GtkStyle *gsty; + GdkColor *grgb; +#endif + + get_bg = !strcmp ("gtk_selection_bg_color", color_name); + get_fg = !get_bg && !strcmp ("gtk_selection_fg_color", color_name); + success_p = false; + +#ifdef HAVE_PGTK + while (FRAME_PARENT_FRAME (f)) + f = FRAME_PARENT_FRAME (f); +#endif + + if (!FRAME_GTK_WIDGET (f) || !(get_bg || get_fg)) + return success_p; + + block_input (); +#ifdef HAVE_GTK3 + gsty = gtk_widget_get_style_context (FRAME_GTK_OUTER_WIDGET (f)); + state = GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED; + + if (get_fg) + gtk_style_context_get_color (gsty, state, &col); + else + { + /* FIXME: Retrieving the background color is deprecated in + GTK+ 3.16. New versions of GTK+ don't use the concept of a + single background color any more, so we shouldn't query for + it. */ + gtk_style_context_get (gsty, state, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c, + NULL); + col = *c; + gdk_rgba_free (c); + } + + r = col.red * 65535; + g = col.green * 65535; + b = col.blue * 65535; +#ifndef HAVE_PGTK + sprintf (buf, "rgb:%04x/%04x/%04x", r, g, b); + success_p = x_parse_color (f, buf, color) != 0; +#else + sprintf (buf, "#%04x%04x%04x", r, g, b); + success_p = pgtk_parse_color (f, buf, color) != 0; +#endif +#else + gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); + grgb = (get_bg ? &gsty->bg[GTK_STATE_SELECTED] + : &gsty->fg[GTK_STATE_SELECTED]); + + color->red = grgb->red; + color->green = grgb->green; + color->blue = grgb->blue; + color->pixel = grgb->pixel; + success_p = 1; +#endif + unblock_input (); + return success_p; +} + + /*********************************************************************** Tooltips diff --git a/src/gtkutil.h b/src/gtkutil.h index 32b1fedbaa..190d662831 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h @@ -179,6 +179,9 @@ extern GdkCursor * xg_create_default_cursor (GdkDisplay *gdpy); extern bool xg_create_frame_widgets (struct frame *f); extern void xg_free_frame_widgets (struct frame *f); extern void xg_set_background_color (struct frame *f, unsigned long bg); +extern bool xg_check_special_colors (struct frame *f, + const char *color_name, + Emacs_Color *color); #ifdef HAVE_PGTK extern void xg_create_frame_outer_widgets (struct frame *f); #endif diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 54e70255f4..b283cef7cd 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -6913,7 +6913,9 @@ pgtk_defined_color (struct frame *f, const char *name, int r; block_input (); - r = pgtk_parse_color (f, name, color_def); + r = xg_check_special_colors (f, name, color_def); + if (!r) + r = pgtk_parse_color (f, name, color_def); unblock_input (); return r; } diff --git a/src/xfns.c b/src/xfns.c index 7d394bd4f5..ce867c1619 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -670,7 +670,11 @@ x_defined_color (struct frame *f, const char *color_name, Colormap cmap = FRAME_X_COLORMAP (f); block_input (); - success_p = x_parse_color (f, color_name, color) != 0; +#ifdef USE_GTK + success_p = xg_check_special_colors (f, color_name, color); +#endif + if (!success_p) + success_p = x_parse_color (f, color_name, color) != 0; if (success_p && alloc_p) success_p = x_alloc_nearest_color (f, cmap, color); unblock_input (); commit a24f710395f9777cb9f8b000300e5e9c892d7794 Author: Lars Ingebrigtsen Date: Sat Jul 23 10:52:30 2022 +0200 Don't use the Gtk region face * lisp/faces.el (region): Don't use the Gtk region face, because it produces low contrast combinations (bug#46493). * src/gtkutil.h: * src/gtkutil.c (xg_check_special_colors): Remove. * src/xfns.c (x_defined_color): * src/pgtkterm.c (pgtk_defined_color): Don't call. diff --git a/etc/NEWS b/etc/NEWS index 666699e8c6..780dbfa51e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -166,6 +166,13 @@ of 'user-emacs-directory'. * Incompatible changes in Emacs 29.1 +--- +*** The Gtk selection face is no longer used for the region. +The combination of a Gtk-controlled background and a foreground colour +controlled by the internal Emacs machinery led to low-contrast faces +in common default setups. Emacs now uses the same 'region' face on +Gtk and non-Gtk setups. + ** Dired --- diff --git a/lisp/faces.el b/lisp/faces.el index f04ea9115e..b2589c5c06 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2502,9 +2502,6 @@ default." (defface region '((((class color) (min-colors 88) (background dark)) :background "blue3" :extend t) - (((class color) (min-colors 88) (background light) (type gtk)) - :distant-foreground "gtk_selection_fg_color" - :background "gtk_selection_bg_color" :extend t) (((class color) (min-colors 88) (background light) (type ns)) :distant-foreground "ns_selection_fg_color" :background "ns_selection_bg_color" :extend t) diff --git a/src/gtkutil.c b/src/gtkutil.c index a6bba096a4..87f166bf54 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -727,88 +727,6 @@ get_utf8_string (const char *str) return utf8_str; } -/* Check for special colors used in face spec for region face. - The colors are fetched from the Gtk+ theme. - Return true if color was found, false if not. */ - -bool -xg_check_special_colors (struct frame *f, - const char *color_name, - Emacs_Color *color) -{ - bool success_p; - bool get_bg; - bool get_fg; -#ifdef HAVE_GTK3 - GtkStyleContext *gsty; - GdkRGBA col; - char buf[sizeof "rgb://rrrr/gggg/bbbb"]; - int state; - GdkRGBA *c; - unsigned short r, g, b; -#else - GtkStyle *gsty; - GdkColor *grgb; -#endif - - get_bg = !strcmp ("gtk_selection_bg_color", color_name); - get_fg = !get_bg && !strcmp ("gtk_selection_fg_color", color_name); - success_p = false; - -#ifdef HAVE_PGTK - while (FRAME_PARENT_FRAME (f)) - f = FRAME_PARENT_FRAME (f); -#endif - - if (!FRAME_GTK_WIDGET (f) || !(get_bg || get_fg)) - return success_p; - - block_input (); -#ifdef HAVE_GTK3 - gsty = gtk_widget_get_style_context (FRAME_GTK_OUTER_WIDGET (f)); - state = GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED; - - if (get_fg) - gtk_style_context_get_color (gsty, state, &col); - else - { - /* FIXME: Retrieving the background color is deprecated in - GTK+ 3.16. New versions of GTK+ don't use the concept of a - single background color any more, so we shouldn't query for - it. */ - gtk_style_context_get (gsty, state, - GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c, - NULL); - col = *c; - gdk_rgba_free (c); - } - - r = col.red * 65535; - g = col.green * 65535; - b = col.blue * 65535; -#ifndef HAVE_PGTK - sprintf (buf, "rgb:%04x/%04x/%04x", r, g, b); - success_p = x_parse_color (f, buf, color) != 0; -#else - sprintf (buf, "#%04x%04x%04x", r, g, b); - success_p = pgtk_parse_color (f, buf, color) != 0; -#endif -#else - gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); - grgb = (get_bg ? &gsty->bg[GTK_STATE_SELECTED] - : &gsty->fg[GTK_STATE_SELECTED]); - - color->red = grgb->red; - color->green = grgb->green; - color->blue = grgb->blue; - color->pixel = grgb->pixel; - success_p = 1; -#endif - unblock_input (); - return success_p; -} - - /*********************************************************************** Tooltips diff --git a/src/gtkutil.h b/src/gtkutil.h index 190d662831..32b1fedbaa 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h @@ -179,9 +179,6 @@ extern GdkCursor * xg_create_default_cursor (GdkDisplay *gdpy); extern bool xg_create_frame_widgets (struct frame *f); extern void xg_free_frame_widgets (struct frame *f); extern void xg_set_background_color (struct frame *f, unsigned long bg); -extern bool xg_check_special_colors (struct frame *f, - const char *color_name, - Emacs_Color *color); #ifdef HAVE_PGTK extern void xg_create_frame_outer_widgets (struct frame *f); #endif diff --git a/src/pgtkterm.c b/src/pgtkterm.c index b283cef7cd..54e70255f4 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -6913,9 +6913,7 @@ pgtk_defined_color (struct frame *f, const char *name, int r; block_input (); - r = xg_check_special_colors (f, name, color_def); - if (!r) - r = pgtk_parse_color (f, name, color_def); + r = pgtk_parse_color (f, name, color_def); unblock_input (); return r; } diff --git a/src/xfns.c b/src/xfns.c index ce867c1619..7d394bd4f5 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -670,11 +670,7 @@ x_defined_color (struct frame *f, const char *color_name, Colormap cmap = FRAME_X_COLORMAP (f); block_input (); -#ifdef USE_GTK - success_p = xg_check_special_colors (f, color_name, color); -#endif - if (!success_p) - success_p = x_parse_color (f, color_name, color) != 0; + success_p = x_parse_color (f, color_name, color) != 0; if (success_p && alloc_p) success_p = x_alloc_nearest_color (f, cmap, color); unblock_input (); commit 09e433ec7f8b2c25d5be2cdb5aac5e089a6e4cea Author: kobarity Date: Sat Jul 23 10:26:33 2022 +0200 Fix Python navigation problem with a line continuation using backslash * lisp/progmodes/python.el (python-nav--beginning-of-defun): Fix line continuation using backslash in nested defun (bug#56615). diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index f31832fec9..ec7d657220 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1459,8 +1459,11 @@ With positive ARG search backwards, else search forwards." (current-indentation))) (body-indentation (and (> arg 0) - (or (and (python-info-looking-at-beginning-of-defun) - (+ (current-indentation) python-indent-offset)) + (or (and (python-info-looking-at-beginning-of-defun nil t) + (+ (save-excursion + (python-nav-beginning-of-statement) + (current-indentation)) + python-indent-offset)) (save-excursion (while (and diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index b2cccdd956..3b10bde23b 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -1995,6 +1995,32 @@ def c(): (beginning-of-line) (point)))))) +(ert-deftest python-nav-beginning-of-defun-5 () + (python-tests-with-temp-buffer + " +class C: + + def \\ + m(self): + pass +" + (python-tests-look-at "m(self):") + (should (= (save-excursion + (python-nav-beginning-of-defun) + (point)) + (save-excursion + (python-tests-look-at "def \\" -1) + (beginning-of-line) + (point)))) + (python-tests-look-at "class C:" -1) + (should (= (save-excursion + (python-nav-beginning-of-defun -1) + (point)) + (save-excursion + (python-tests-look-at "def \\") + (beginning-of-line) + (point)))))) + (ert-deftest python-nav-end-of-defun-1 () (python-tests-with-temp-buffer " commit df667e9f17a071a6471f629d994f6298c2ec0a9d Author: Lars Ingebrigtsen Date: Sat Jul 23 09:33:18 2022 +0200 Fix wdired entry when there are hidden subdirs * lisp/dired.el (dired--unhide): Allow `C-c C-q' to work when there are hidden inserted subdirs (bug#56698). diff --git a/lisp/dired.el b/lisp/dired.el index 59346a1901..7cdcc3438d 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2964,10 +2964,11 @@ See options: `dired-hide-details-hide-symlink-targets' and ;; approximate ("anywhere on the line is fine"). ;; FIXME: This also removes other invisible properties! (save-excursion - (remove-list-of-text-properties - (progn (goto-char start) (line-end-position)) - (progn (goto-char end) (line-end-position)) - '(invisible)))) + (let ((inhibit-read-only t)) + (remove-list-of-text-properties + (progn (goto-char start) (line-end-position)) + (progn (goto-char end) (line-end-position)) + '(invisible))))) ;;; Functions for finding the file name in a dired buffer line commit e5de76b72e75aaa04d83331ebc4d72dadd7eed77 Author: Visuwesh Date: Sat Jul 23 09:15:24 2022 +0200 New user option to disable deleting current input in comint mouse-2 * etc/NEWS: Announce the user option (bug#56646). * lisp/comint.el (comint-delete-old-input): New user option to disable deleting current input when insert an old input using mouse-2. (comint-insert-input): Use it. diff --git a/etc/NEWS b/etc/NEWS index a143550f03..666699e8c6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -996,6 +996,11 @@ The user option 'comint-terminfo-terminal' and the variable 'system-uses-terminfo' can now be set as connection-local variables to change the terminal used on a remote host. +--- +*** New user option 'comint-delete-old-input' +When set to nil, this prevents comint from deleting the current input +when inserting previous input using ''. + ** Mwheel --- diff --git a/lisp/comint.el b/lisp/comint.el index d52623c00a..3ed04f098c 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -905,6 +905,12 @@ series of processes in the same Comint buffer. The hook "Return non-nil if STR contains non-whitespace syntax." (not (string-match "\\`\\s *\\'" str))) +(defcustom comint-delete-old-input t + "When non-nil, delete old input on inserting previous input with \\\\[comint-insert-input]." + :type 'boolean + :group 'comint + :version "29.1") + (defun comint-insert-input (event) "In a Comint buffer, set the current input to the previous input at point. If there is no previous input at point, run the command specified @@ -936,10 +942,11 @@ by the global keymap (usually `mouse-yank-at-click')." ;; Otherwise, insert the previous input. (goto-char (point-max)) ;; First delete any old unsent input at the end - (delete-region - (or (marker-position comint-accum-marker) - (process-mark (get-buffer-process (current-buffer)))) - (point)) + (when comint-delete-old-input + (delete-region + (or (marker-position comint-accum-marker) + (process-mark (get-buffer-process (current-buffer)))) + (point))) ;; Insert the input at point (insert input))))) commit 97abe8511a829861f6efb865209ac2dd0e7ae129 Author: Lars Ingebrigtsen Date: Sat Jul 23 09:13:30 2022 +0200 Use special-mode in eldoc--doc-buffer * lisp/emacs-lisp/eldoc.el (eldoc--format-doc-buffer): Use `special-mode' to allow normal customizations of the buffer (bug#56659). diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index e5f055d032..8d7f182e0c 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -491,9 +491,9 @@ If INTERACTIVE, display it. Else, return said buffer." (setq-local eldoc--doc-buffer-docs docs) (let ((inhibit-read-only t) (things-reported-on)) - (erase-buffer) (setq buffer-read-only t) + (special-mode) + (erase-buffer) (setq-local nobreak-char-display nil) - (local-set-key "q" 'quit-window) (cl-loop for (docs . rest) on docs for (this-doc . plist) = docs for thing = (plist-get plist :thing)