commit f2f13fa630bd2658ea3f90c4362fe6201d32e67e (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Wed Apr 10 12:12:33 2024 +0800 Recognize Android TLS certificates by default * lisp/net/gnutls.el (gnutls-trustfiles): Append directories holding system and user-provided certificates on Android. diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index b0c3dcb9a70..b5fb4d47d57 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el @@ -111,6 +111,10 @@ Security'." "/usr/local/share/certs/ca-root-nss.crt" ; FreeBSD "/etc/ssl/cert.pem" ; macOS, Dragora, Parabola "/etc/certs/ca-certificates.crt" ; OpenIndiana + "/system/etc/security/cacerts/*" ; Android system + "/system/etc/security/cacerts_supl/*" ; Android, supplementary + "/system/etc/security/cacerts_google/*" ; Android, Google + "/data/misc/user/0/cacerts-added/*" ; Android, user-specified (?) ) "List of CA bundle location filenames or a function returning said list. If a file path contains glob wildcards, they will be expanded. commit dd6b9c9426c5d7dde66974c5790815c3520a755b Author: Stefan Monnier Date: Tue Apr 9 18:33:01 2024 -0400 (cl--describe-class-slots): Avoid cryptic `t` type * lisp/emacs-lisp/cl-extra.el (cl--describe-class-slots): Use the empty string for the trivial `t` type. * lisp/emacs-lisp/cl-preloaded.el (cl-structure-class): Fix non-existing `bool` => `boolean`. diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 4660d94ea90..19429ce80df 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -917,11 +917,13 @@ Outputs to the current buffer." (lambda (slot) (list (cl-prin1-to-string (cl--slot-descriptor-name slot)) (let ((type (cl--slot-descriptor-type slot))) - (if (and type (symbolp type) (cl--find-class type)) - (make-text-button (symbol-name type) nil - 'type 'help-type - 'help-args (list type)) - (cl-prin1-to-string type))) + (cond + ((eq type t) "") + ((and type (symbolp type) (cl--find-class type)) + (make-text-button (symbol-name type) nil + 'type 'help-type + 'help-args (list type))) + (t (cl-prin1-to-string type)))) (cl-prin1-to-string (cl--slot-descriptor-initform slot)) (let ((doc (alist-get :documentation (cl--slot-descriptor-props slot)))) diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index d23ad3972a9..83d9e6ee220 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el @@ -224,8 +224,8 @@ (index-table nil :type hash-table) (tag nil :type symbol) ;Placed in cl-tag-slot. Holds the struct-class object. (type nil :type (memq (vector list))) - (named nil :type bool) - (print nil :type bool) + (named nil :type boolean) + (print nil :type boolean) (children-sym nil :type symbol) ;This sym's value holds the tags of children. ) commit 73bd48de3cf45de02c0f1caf5bd5196f4d4b08f5 Author: Dmitry Gutov Date: Tue Apr 9 22:40:14 2024 +0300 ; Minor copy edits diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index f6c4dbed1e2..68685fb6625 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -656,7 +656,7 @@ create a new comment." ;;; Flymake support (defcustom perl-flymake-command '("perl" "-w" "-c") "External tool used to check Perl source code. -This is a non empty list of strings, the checker tool possibly +This is a non-empty list of strings: the checker tool possibly followed by required arguments. Once launched it will receive the Perl source to be checked as its standard input." :version "26.1" diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 8279617b6e7..85279d3e84b 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -6610,7 +6610,7 @@ returned as is." (defcustom python-flymake-command '("pyflakes") "The external tool that will be used to perform the syntax check. -This is a non empty list of strings, the checker tool possibly followed by +This is a non-empty list of strings: the checker tool possibly followed by required arguments. Once launched it will receive the Python source to be checked as its standard input. To use `flake8' you would set this to (\"flake8\" \"-\"). commit ccced8c3e4323b9c3d24b2480fc7b8df946fce88 Author: Dmitry Gutov Date: Tue Apr 9 22:39:32 2024 +0300 Add Flymake backend to rust-ts-mode using Clippy * lisp/progmodes/rust-ts-mode.el (rust-ts-flymake-command): New option (bug#70260). (rust-ts--flymake-proc): New variable. (rust-ts-flymake--helper): New function. (rust-ts-flymake): New function. (rust-ts-mode): Add it to flymake-diagnostic-functions. diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index c67ac43e4d0..7112ceced57 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -48,6 +48,20 @@ :safe 'integerp :group 'rust) +(defcustom rust-ts-flymake-command '("clippy-driver" "-") + "The external tool that will be used to perform the check. +This is a non-empty list of strings: the checker tool possibly followed +by required arguments. Once launched it will receive the Rust source +to be checked as its standard input." + :version "30.1" + :type '(choice (const :tag "Clippy standalone" ("clippy-driver" "-")) + ;; TODO: Maybe add diagnostics filtering by file name, + ;; to limit non-project list to the current buffer. + ;; Or annotate them with file names, at least. + (const :tag "Clippy cargo" ("cargo" "clippy")) + (repeat :tag "Custom command" string)) + :group 'rust) + (defvar rust-ts-mode-prettify-symbols-alist '(("&&" . ?∧) ("||" . ?∨) ("<=" . ?≤) (">=" . ?≥) ("!=" . ?≠) @@ -417,6 +431,67 @@ See `prettify-symbols-compose-predicate'." "operator")) (_ t)))) +(defvar rust-ts--flymake-proc nil) + +(defun rust-ts-flymake--helper (process-name command parser-fn) + (when (process-live-p rust-ts--flymake-proc) + (kill-process rust-ts--flymake-proc)) + + (let ((source (current-buffer))) + (save-restriction + (widen) + (setq + rust-ts--flymake-proc + (make-process + :name process-name :noquery t :connection-type 'pipe + :buffer (generate-new-buffer (format " *%s*" process-name)) + :command command + :sentinel + (lambda (proc _event) + (when (and (eq 'exit (process-status proc)) (buffer-live-p source)) + (unwind-protect + (if (with-current-buffer source (eq proc rust-ts--flymake-proc)) + (with-current-buffer (process-buffer proc) + (funcall parser-fn proc source)) + (flymake-log :debug "Canceling obsolete check %s" + proc)) + (kill-buffer (process-buffer proc))))))) + (process-send-region rust-ts--flymake-proc (point-min) (point-max)) + (process-send-eof rust-ts--flymake-proc)))) + +(defun rust-ts-flymake (report-fn &rest _args) + "Rust backend for Flymake." + (unless (executable-find (car rust-ts-flymake-command)) + (error "Cannot find the rust flymake program: %s" (car rust-ts-flymake-command))) + + (rust-ts-flymake--helper + "rust-ts-flymake" + rust-ts-flymake-command + (lambda (_proc source) + (goto-char (point-min)) + (cl-loop + while (search-forward-regexp + (concat + "^\\(\\(?:warning\\|error\\|help\\).*\\)\n +--> [^:]+:" + "\\([0-9]+\\):\\([0-9]+\\)\\(\\(?:\n[^\n]+\\)*\\)\n\n") + nil t) + for msg1 = (match-string 1) + for msg2 = (match-string 4) + for (beg . end) = (flymake-diag-region + source + (string-to-number (match-string 2)) + (string-to-number (match-string 3))) + for type = (if (string-match "^warning" msg1) + :warning + :error) + collect (flymake-make-diagnostic source + beg + end + type + (concat msg1 msg2)) + into diags + finally (funcall report-fn diags))))) + ;;;###autoload (define-derived-mode rust-ts-mode prog-mode "Rust" "Major mode for editing Rust, powered by tree-sitter." @@ -460,10 +535,13 @@ See `prettify-symbols-compose-predicate'." (setq-local indent-tabs-mode nil treesit-simple-indent-rules rust-ts-mode--indent-rules) - ;; Electric + ;; Electric. (setq-local electric-indent-chars (append "{}():;,#" electric-indent-chars)) + ;; Flymake. + (add-hook 'flymake-diagnostic-functions #'rust-ts-flymake nil 'local) + ;; Navigation. (setq-local treesit-defun-type-regexp (regexp-opt '("enum_item" commit e3861aeb484c59c36b2448e17b54a37d779f6486 Author: Stefan Monnier Date: Tue Apr 9 11:01:36 2024 -0400 (test-replace-match-modification-hooks): Delete test * test/src/search-tests.el (test-replace-match-modification-hooks): Delete, this is testing a functionality we can't really support. diff --git a/test/src/search-tests.el b/test/src/search-tests.el index bab503f36bf..87d2f5bfa05 100644 --- a/test/src/search-tests.el +++ b/test/src/search-tests.el @@ -21,23 +21,25 @@ (require 'ert) -(ert-deftest test-replace-match-modification-hooks () - (let ((ov-set nil)) - (with-temp-buffer - (insert "1 abc") - (setq ov-set (make-overlay 3 5)) - (overlay-put - ov-set 'modification-hooks - (list (lambda (_o after &rest _args) - (when after - (let ((inhibit-modification-hooks t)) - (save-excursion - (goto-char 2) - (insert "234"))))))) - (goto-char 3) - (if (search-forward "bc") - (replace-match "bcd")) - (should (= (point) 10))))) +;; This test was bad: modification hooks should never modify +;; the buffer text, because it causes problems in too many places. +;;(ert-deftest test-replace-match-modification-hooks () ;bug#42424 +;; (let ((ov-set nil)) +;; (with-temp-buffer +;; (insert "1 abc") +;; (setq ov-set (make-overlay 3 5)) +;; (overlay-put +;; ov-set 'modification-hooks +;; (list (lambda (_o after &rest _args) +;; (when after +;; (let ((inhibit-modification-hooks t)) +;; (save-excursion +;; (goto-char 2) +;; (insert "234"))))))) +;; (goto-char 3) +;; (if (search-forward "bc") +;; (replace-match "bcd")) +;; (should (= (point) 10))))) (ert-deftest search-test--replace-match-update-data () (with-temp-buffer commit d0cf9f3601b88e4a87a0afd557110ea4c6834998 Merge: 7236010d2e1 e720ba62193 Author: Stefan Monnier Date: Tue Apr 9 10:28:05 2024 -0400 Merge branch 'mouse-wheel-buttons' commit e720ba6219394d275dd741c5f17feea1ee0bf9af Author: Stefan Monnier Date: Mon Jan 29 09:35:09 2024 -0500 (mouse-wheel-buttons): Map old-style wheel buttons to actual wheel events Change the handling of the old X11 convention that uses mouse-4/5/6/7 events to represent wheel events: instead of asking downstream packages to use the `mouse-wheel-*-event` variables to know which events represent wheel events, use new var `mouse-wheel-buttons` to directly convert those events into the standard `wheel-up/down/left/right` events used everywhere else. This will simplify the work of packages which can thus just bind their commands to `wheel-up/down/left/right`. * lisp/mouse.el (mouse-wheel-buttons): New custom variable. * src/keyboard.c (make_lispy_event): Adjust for "wheel-clicks" on the tab-bar. * src/xterm.c (x_construct_mouse_click): Add `xi2` argument and obey `mouse-wheel-buttons` variable. (handle_one_xevent): Adjust calls accordingly. (syms_of_xterm): Define the `mouse-wheel-buttons` and the `wheel-up/down/left/right`symbols. * lisp/xt-mouse.el: Don't require `mwheel` any more. (xterm-mouse--same-button-p): Delete function. (xterm-mouse--read-event-sequence): Use `mouse-wheel-buttons`. * lisp/mwheel.el (mouse-wheel-up-event, mouse-wheel-down-event) (mouse-wheel-left-event, mouse-wheel-right-event): Make obsolete. (mouse-wheel-obey-old-style-wheel-buttons): Delete variable. * lisp/completion-preview.el (completion-preview--mouse-map): * lisp/progmodes/flymake.el (flymake--mode-line-counter-map): * lisp/edmacro.el (edmacro-fix-menu-commands): Silence warnings. diff --git a/etc/NEWS b/etc/NEWS index 2654d9d7995..5decf6d1800 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -68,6 +68,15 @@ more details. * Incompatible Changes in Emacs 30.1 +** Mouse wheel events should now always be 'wheel-up/down/left/right'. +At those places where the old 'mouse-4/5/6/7' events could still occur +(i.e. X11 input in the absence of XInput2, and 'xterm-mouse-mode'), +we remap them to the corresponding 'wheel-up/down/left/right' event, +according to the new variable 'mouse-wheel-buttons'. +The old variables 'mouse-wheel-up-event', 'mouse-wheel-down-event', +'mouse-wheel-left-event', and 'mouse-wheel-right-event' are thereby +obsolete. + ** Tree-Sitter modes are now declared as submodes of the non-TS modes. In order to help the use of those Tree-Sitter modes, they are now declared to have the corresponding non-Tree-Sitter mode as an @@ -520,15 +529,15 @@ In batch mode, tracing now sends the trace to stdout. ** Mwheel The 'wheel-up/down/left/right' events are now bound unconditionally, and the 'mouse-wheel-up/down/left/right-event' variables are thus used -only to specify the 'mouse-4/5/6/7' events generated by older -configurations such as X11 when the X server does not support at least -version 2.1 of the X Input Extension, and 'xterm-mouse-mode'. +only to specify the 'mouse-4/5/6/7' events that might still +happen to be generated by some old packages (or if 'mouse-wheel-buttons' +has been set to nil). ** 'xterm-mouse-mode' This mode now emits 'wheel-up/down/right/left' events instead of 'mouse-4/5/6/7' events for the mouse wheel. -It uses the 'mouse-wheel-up/down/left/right-event' -variables to decide which button maps to which wheel event (if any). +It uses the new variable 'mouse-wheel-buttons' to decide which button +maps to which wheel event (if any). ** Info diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el index a86c1ba1cc9..a1e0abe2e14 100644 --- a/lisp/completion-preview.el +++ b/lisp/completion-preview.el @@ -139,9 +139,13 @@ If this option is nil, these commands do not display any message." ;; and vice versa!! "" #'completion-preview-prev-candidate "" #'completion-preview-next-candidate - (key-description (vector mouse-wheel-up-event)) + (key-description (with-suppressed-warnings + ((obsolete mouse-wheel-up-event)) + (vector mouse-wheel-up-event))) #'completion-preview-next-candidate - (key-description (vector mouse-wheel-down-event)) + (key-description (with-suppressed-warnings + ((obsolete mouse-wheel-down-event)) + (vector mouse-wheel-down-event))) #'completion-preview-prev-candidate) (defvar-local completion-preview--overlay nil) diff --git a/lisp/edmacro.el b/lisp/edmacro.el index abfc380d154..2694e097b86 100644 --- a/lisp/edmacro.el +++ b/lisp/edmacro.el @@ -744,9 +744,13 @@ This function assumes that the events can be stored in a string." ;; info is recorded in macros to make this possible. ((or (mouse-event-p ev) (mouse-movement-p ev) (memq (event-basic-type ev) - `( ,mouse-wheel-down-event ,mouse-wheel-up-event - ,mouse-wheel-right-event ,mouse-wheel-left-event - wheel-down wheel-up wheel-left wheel-right))) + (with-suppressed-warnings + ((obsolete + mouse-wheel-down-event mouse-wheel-right-event + mouse-wheel-up-event mouse-wheel-left-event)) + `( ,mouse-wheel-down-event ,mouse-wheel-up-event + ,mouse-wheel-right-event ,mouse-wheel-left-event + wheel-down wheel-up wheel-left wheel-right)))) nil) (noerror nil) (t diff --git a/lisp/mouse.el b/lisp/mouse.el index cef88dede8a..410e52b2ecb 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -133,6 +133,19 @@ or macOS)." :type 'boolean :version "29.1") +(defcustom mouse-wheel-buttons + '((4 . wheel-up) (5 . wheel-down) (6 . wheel-left) (7 . wheel-right)) + "How to remap mouse button numbers to wheel events. +This is an alist of (NUMBER . SYMBOL) used to remap old-style mouse wheel +events represented as mouse button events. It remaps mouse button +NUMBER to the event SYMBOL. SYMBOL must be one of `wheel-up', `wheel-down', +`wheel-left', or `wheel-right'. +This is used only for events that come from sources known to generate such +events, such as X11 events when XInput2 is not used, or events coming from +a text terminal." + :type '(alist) + :version "30.1") + (defvar mouse--last-down nil) (defun mouse--down-1-maybe-follows-link (&optional _prompt) diff --git a/lisp/mwheel.el b/lisp/mwheel.el index 66a1fa1a706..9fc922eebc9 100644 --- a/lisp/mwheel.el +++ b/lisp/mwheel.el @@ -56,20 +56,17 @@ (bound-and-true-p mouse-wheel-mode)) (mouse-wheel-mode 1))) -(defvar mouse-wheel-obey-old-style-wheel-buttons t - "If non-nil, treat mouse-4/5/6/7 events as mouse wheel events. -These are the event names used historically in X11 before XInput2. -They are sometimes generated by things like text-terminals as well.") +(make-obsolete-variable 'mouse-wheel-up-event 'mouse-wheel-buttons "30.1") +(make-obsolete-variable 'mouse-wheel-down-event 'mouse-wheel-buttons "30.1") +(make-obsolete-variable 'mouse-wheel-left-event 'mouse-wheel-buttons "30.1") +(make-obsolete-variable 'mouse-wheel-right-event 'mouse-wheel-buttons "30.1") -(defcustom mouse-wheel-down-event - (if mouse-wheel-obey-old-style-wheel-buttons 'mouse-4) +(defcustom mouse-wheel-down-event 'mouse-4 "Event used for scrolling down, beside `wheel-up', if any." :group 'mouse :type 'symbol :set #'mouse-wheel-change-button) - -(defcustom mouse-wheel-up-event - (if mouse-wheel-obey-old-style-wheel-buttons 'mouse-5) +(defcustom mouse-wheel-up-event 'mouse-5 "Event used for scrolling up, beside `wheel-down', if any." :group 'mouse :type 'symbol @@ -223,12 +220,10 @@ Also see `mouse-wheel-tilt-scroll'." (defvar mwheel-scroll-right-function 'scroll-right "Function that does the job of scrolling right.") -(defvar mouse-wheel-left-event - (if mouse-wheel-obey-old-style-wheel-buttons 'mouse-6) +(defvar mouse-wheel-left-event 'mouse-6 "Event used for scrolling left, beside `wheel-left', if any.") -(defvar mouse-wheel-right-event - (if mouse-wheel-obey-old-style-wheel-buttons 'mouse-7) +(defvar mouse-wheel-right-event 'mouse-7 "Event used for scrolling right, beside `wheel-right', if any.") (defun mouse-wheel--get-scroll-window (event) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 779c612f479..f2750a026ce 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1645,14 +1645,16 @@ correctly.") (let ((map (make-sparse-keymap))) ;; BEWARE: `mouse-wheel-UP-event' corresponds to `wheel-DOWN' events ;; and vice versa!! - (define-key map (vector 'mode-line mouse-wheel-down-event) - #'flymake--mode-line-counter-scroll-prev) - (define-key map [mode-line wheel-down] - #'flymake--mode-line-counter-scroll-next) - (define-key map (vector 'mode-line mouse-wheel-up-event) - #'flymake--mode-line-counter-scroll-next) - (define-key map [mode-line wheel-up] - #'flymake--mode-line-counter-scroll-prev) + (with-suppressed-warnings + ((obsolete mouse-wheel-up-event mouse-wheel-down-event)) + (define-key map (vector 'mode-line mouse-wheel-down-event) + #'flymake--mode-line-counter-scroll-prev) + (define-key map [mode-line wheel-down] + #'flymake--mode-line-counter-scroll-next) + (define-key map (vector 'mode-line mouse-wheel-up-event) + #'flymake--mode-line-counter-scroll-next) + (define-key map [mode-line wheel-up] + #'flymake--mode-line-counter-scroll-prev)) map)) (defun flymake--mode-line-counter-1 (type) diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 081b8f32456..c27dee7e249 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -40,8 +40,6 @@ ;;; Code: -(require 'mwheel) - (defvar xterm-mouse-debug-buffer nil) (defun xterm-mouse-translate (_event) @@ -195,12 +193,6 @@ single byte." (cons n c)) (cons (- (setq c (xterm-mouse--read-coordinate)) 32) c)))) -(defun xterm-mouse--button-p (event btn) - (and (symbolp event) - (string-prefix-p "mouse-" (symbol-name event)) - (eq btn (car (read-from-string (symbol-name event) - (length "mouse-")))))) - ;; XTerm reports mouse events as ;; in default mode, and ;; ";" ";" <"M" or "m"> in extended mode. @@ -246,14 +238,10 @@ single byte." (if meta "M-" "") (if shift "S-" "") (if down "down-" "") - (cond - ;; BEWARE: `mouse-wheel-UP-event' corresponds to - ;; `wheel-DOWN' events and vice versa!! - ((xterm-mouse--button-p mouse-wheel-down-event btn) "wheel-up") - ((xterm-mouse--button-p mouse-wheel-up-event btn) "wheel-down") - ((xterm-mouse--button-p mouse-wheel-left-event btn) "wheel-left") - ((xterm-mouse--button-p mouse-wheel-right-event btn) "wheel-right") - (t (format "mouse-%d" btn)))))))) + (let ((remap (alist-get btn mouse-wheel-buttons))) + (if remap + (symbol-name remap) + (format "mouse-%d" btn)))))))) (list sym (1- x) (1- y)))) (defun xterm-mouse--set-click-count (event click-count) diff --git a/src/keyboard.c b/src/keyboard.c index 91faf4582fa..a06c9116d24 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -6639,8 +6639,17 @@ make_lispy_event (struct input_event *event) if (CONSP (event->arg)) return list5 (head, position, make_fixnum (double_click_count), - XCAR (event->arg), Fcons (XCAR (XCDR (event->arg)), - XCAR (XCDR (XCDR (event->arg))))); + XCAR (event->arg), + /* FIXME: When a mouse-click on a tab-bar is + converted into a wheel-event we get here something + of an unexpected shape... */ + (CONSP (XCDR (event->arg)) + && CONSP (XCDR (XCDR (event->arg)))) + ? Fcons (XCAR (XCDR (event->arg)), + XCAR (XCDR (XCDR (event->arg)))) + /* ... not knowing what this "unexpected shape" means, + we just use nil. */ + : Qnil); else if (NUMBERP (event->arg)) return list4 (head, position, make_fixnum (double_click_count), event->arg); diff --git a/src/xterm.c b/src/xterm.c index c0aef65ab66..5e5eb6269e4 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -14551,18 +14551,19 @@ x_query_pointer (Display *dpy, Window w, Window *root_return, `x', `y', `x_root' and `y_root'. This function should not access any other fields in EVENT without also initializing the corresponding fields in `bv' under the XI_ButtonPress and - XI_ButtonRelease labels inside `handle_one_xevent'. */ + XI_ButtonRelease labels inside `handle_one_xevent'. + + XI2 indicates that this click comes from XInput2 rather than core + event. */ static Lisp_Object x_construct_mouse_click (struct input_event *result, const XButtonEvent *event, - struct frame *f) + struct frame *f, bool xi2) { int x = event->x; int y = event->y; - /* Make the event type NO_EVENT; we'll change that when we decide - otherwise. */ result->kind = MOUSE_CLICK_EVENT; result->code = event->button - Button1; result->timestamp = event->time; @@ -14572,6 +14573,29 @@ x_construct_mouse_click (struct input_event *result, ? up_modifier : down_modifier)); + /* Convert pre-XInput2 wheel events represented as mouse-clicks. */ + if (!xi2) + { + Lisp_Object base + = Fcdr_safe (Fassq (make_fixnum (result->code + 1), + Fsymbol_value (Qmouse_wheel_buttons))); + int wheel + = (NILP (base) ? -1 + : BASE_EQ (base, Qwheel_down) ? 0 + : BASE_EQ (base, Qwheel_up) ? 1 + : BASE_EQ (base, Qwheel_left) ? 2 + : BASE_EQ (base, Qwheel_right) ? 3 + : -1); + if (wheel >= 0) + { + result->kind = (event->type != ButtonRelease ? NO_EVENT + : wheel & 2 ? HORIZ_WHEEL_EVENT : WHEEL_EVENT); + result->code = 0; /* Not used. */ + result->modifiers &= ~(up_modifier || down_modifier); + result->modifiers |= wheel & 1 ? up_modifier : down_modifier; + } + } + /* If result->window is not the frame's edit widget (which can happen with GTK+ scroll bars, for example), translate the coordinates so they appear at the correct position. */ @@ -21881,13 +21905,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, && event->xbutton.time > ignore_next_mouse_click_timeout) { ignore_next_mouse_click_timeout = 0; - x_construct_mouse_click (&inev.ie, &event->xbutton, f); + x_construct_mouse_click (&inev.ie, &event->xbutton, + f, false); } if (event->type == ButtonRelease) ignore_next_mouse_click_timeout = 0; } else - x_construct_mouse_click (&inev.ie, &event->xbutton, f); + x_construct_mouse_click (&inev.ie, &event->xbutton, f, false); *finish = X_EVENT_DROP; goto OTHER; @@ -21957,13 +21982,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, && event->xbutton.time > ignore_next_mouse_click_timeout) { ignore_next_mouse_click_timeout = 0; - x_construct_mouse_click (&inev.ie, &event->xbutton, f); + x_construct_mouse_click (&inev.ie, &event->xbutton, + f, false); } if (event->type == ButtonRelease) ignore_next_mouse_click_timeout = 0; } else - x_construct_mouse_click (&inev.ie, &event->xbutton, f); + x_construct_mouse_click (&inev.ie, &event->xbutton, + f, false); if (!NILP (tab_bar_arg)) inev.ie.arg = tab_bar_arg; @@ -23740,13 +23767,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, && xev->time > ignore_next_mouse_click_timeout) { ignore_next_mouse_click_timeout = 0; - x_construct_mouse_click (&inev.ie, &bv, f); + x_construct_mouse_click (&inev.ie, &bv, f, true); } if (xev->evtype == XI_ButtonRelease) ignore_next_mouse_click_timeout = 0; } else - x_construct_mouse_click (&inev.ie, &bv, f); + x_construct_mouse_click (&inev.ie, &bv, f, true); if (!NILP (tab_bar_arg)) inev.ie.arg = tab_bar_arg; @@ -32452,6 +32479,12 @@ syms_of_xterm (void) DEFSYM (Qexpose, "expose"); DEFSYM (Qdont_save, "dont-save"); + DEFSYM (Qmouse_wheel_buttons, "mouse-wheel-buttons"); + DEFSYM (Qwheel_up, "wheel-up"); + DEFSYM (Qwheel_down, "wheel-down"); + DEFSYM (Qwheel_left, "wheel-left"); + DEFSYM (Qwheel_right, "wheel-right"); + #ifdef USE_GTK xg_default_icon_file = build_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg"); staticpro (&xg_default_icon_file); commit 7236010d2e1d3525943bb50598d29061a4c25b58 Author: Arash Esbati Date: Tue Apr 9 14:08:17 2024 +0200 Move over optional arguments in parentheses correctly * lisp/textmodes/reftex-parse.el (reftex-move-to-previous-arg): Recognize ')' as closing delimiter for optional argument. Fix docstring. (reftex-what-macro): Identify LaTeX macros with optional arguments in parentheses correctly. This is necessary to make `reftex-view-crossref' work with biblatex on entries like: \parencites(Glob.Pre)(Glob.Post)[Pre][Post]{key1}[Pre][Post]{key2} (bug#31132) diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el index 9694a1364d3..170d49be8c8 100644 --- a/lisp/textmodes/reftex-parse.el +++ b/lisp/textmodes/reftex-parse.el @@ -801,17 +801,17 @@ if the information is exact (t) or approximate (nil)." ) (defsubst reftex-move-to-previous-arg (&optional bound) - "Assuming that we are in front of a macro argument, -move backward to the closing parenthesis of the previous argument. -This function understands the splitting of macros over several lines -in TeX." + "Move backward to the closing parenthesis of the previous argument. +This happens under the assumption that we are in front of a macro +argument. This function understands the splitting of macros over +several lines in TeX." (cond ;; Just to be quick: - ((memq (preceding-char) '(?\] ?\}))) + ((memq (preceding-char) '(?\] ?\) ?\}))) ;; Do a search ((and reftex-allow-detached-macro-args (re-search-backward - "[]}][ \t]*[\n\r]?\\([ \t]*%[^\n\r]*[\n\r]\\)*[ \t]*\\=" bound t)) + "[])}][ \t]*[\n\r]?\\([ \t]*%[^\n\r]*[\n\r]\\)*[ \t]*\\=" bound t)) (goto-char (1+ (match-beginning 0))) t) (t nil))) @@ -860,13 +860,25 @@ considered an argument of macro \\macro." (while (and (reftex-move-to-previous-arg bound) (condition-case nil (let ((forward-sexp-function nil)) - (backward-sexp) t) + (if (eq (preceding-char) ?\)) + ;; '?\(' and '?\)' receive the + ;; punctuation syntax "." in + ;; `reftex-syntax-table', so we have + ;; to change it in order move back + ;; over the optional arg in + ;; parentheses correctly: + (let ((temp-table (make-syntax-table))) + (modify-syntax-entry ?\( "()" temp-table) + (modify-syntax-entry ?\) ")(" temp-table) + (with-syntax-table temp-table + (backward-sexp))) + (backward-sexp)) + t) (error nil))) - (if (eq (following-char) ?\[) (cl-incf cnt-opt)) + (if (memq (following-char) '(?\( ?\[)) (cl-incf cnt-opt)) (cl-incf cnt)) (setq pos (point)) - (when (and (or (= (following-char) ?\[) - (= (following-char) ?\{)) + (when (and (memq (following-char) '(?\[ ?\( ?\{)) (re-search-backward "\\\\[*a-zA-Z]+\\=" nil t)) (setq cmd (reftex-match-string 0)) (when (looking-at "\\\\begin{[^}]*}") commit cda5155c618d774810ce5e044efe1101846054ac Author: Mattias Engdegård Date: Mon Apr 8 19:07:19 2024 +0200 Inhibit flymake lexical cookie warning in *scratch* (bug#70068) Add a hack to prevent flymake from complaining about a missing lexical cookie when enabled in *scratch*. * lisp/emacs-lisp/bytecomp.el (bytecomp--inhibit-lexical-cookie-warning): New variable. (byte-compile-file): Use it to gate the warning. * lisp/progmodes/elisp-mode.el (elisp-flymake-byte-compile): Set the inhibitor when spawning a check in lisp-interaction-mode. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 5cff86784f0..fb3278c08ab 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2149,6 +2149,8 @@ If compilation is needed, this functions returns the result of (cons tempfile target-file)) (rename-file tempfile target-file t))))) +(defvar bytecomp--inhibit-lexical-cookie-warning nil) + ;;;###autoload (defun byte-compile-file (filename &optional load) "Compile a file of Lisp code named FILENAME into a file of byte code. @@ -2234,7 +2236,8 @@ See also `emacs-lisp-byte-compile-and-load'." (setq buffer-read-only nil filename buffer-file-name)) ;; Don't inherit lexical-binding from caller (bug#12938). - (unless (local-variable-p 'lexical-binding) + (unless (or (local-variable-p 'lexical-binding) + bytecomp--inhibit-lexical-cookie-warning) (let ((byte-compile-current-buffer (current-buffer))) (displaying-byte-compile-warnings (byte-compile-warn-x diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 8a713bd19a2..9b4c3f994cd 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -2169,6 +2169,8 @@ directory of the buffer being compiled, and nothing else.") (dolist (path x t) (unless (stringp path) (throw 'tag nil))))))) +(defvar bytecomp--inhibit-lexical-cookie-warning) + ;;;###autoload (defun elisp-flymake-byte-compile (report-fn &rest _args) "A Flymake backend for elisp byte compilation. @@ -2184,7 +2186,13 @@ current buffer state and calls REPORT-FN when done." (save-restriction (widen) (write-region (point-min) (point-max) temp-file nil 'nomessage)) - (let* ((output-buffer (generate-new-buffer " *elisp-flymake-byte-compile*"))) + (let* ((output-buffer (generate-new-buffer " *elisp-flymake-byte-compile*")) + ;; Hack: suppress warning about missing lexical cookie in + ;; *scratch* buffers. + (warning-suppression-opt + (and (derived-mode-p 'lisp-interaction-mode) + '("--eval" + "(setq bytecomp--inhibit-lexical-cookie-warning t)")))) (setq elisp-flymake--byte-compile-process (make-process @@ -2196,6 +2204,7 @@ current buffer state and calls REPORT-FN when done." ;; "--eval" "(setq load-prefer-newer t)" ; for testing ,@(mapcan (lambda (path) (list "-L" path)) elisp-flymake-byte-compile-load-path) + ,@warning-suppression-opt "-f" "elisp-flymake--batch-compile-for-flymake" ,temp-file) :connection-type 'pipe commit 2c6eb49fa2d62fc07ccecdd1c074235064bf5375 Author: Eli Zaretskii Date: Tue Apr 9 11:01:52 2024 +0300 ; Avoid byte-compiler warnings in 'ls-lisp-test-bug70271'. diff --git a/test/lisp/ls-lisp-tests.el b/test/lisp/ls-lisp-tests.el index beecac22afc..a9ae025ad81 100644 --- a/test/lisp/ls-lisp-tests.el +++ b/test/lisp/ls-lisp-tests.el @@ -29,6 +29,7 @@ (require 'ls-lisp) (require 'dired) +(defvar dired-find-subdir) (ert-deftest ls-lisp-test-bug70271 () "Test for https://debbugs.gnu.org/70271 ." (ert-with-temp-file @@ -37,7 +38,7 @@ (let* ((dir (file-name-directory fpath)) (attributes (file-attributes fpath)) (dired-find-subdir t) - ls-lisp-use-insert-directory-program buf ts) + ls-lisp-use-insert-directory-program buf ts str) (unwind-protect (progn (setq ts (file-attribute-access-time attributes)) commit 22386c5634ba72d4f7b321524509c1e3549fe4d2 Author: Po Lu Date: Tue Apr 9 15:24:30 2024 +0800 Fix misalignment of entries created by Dired file operations * lisp/dired.el (dired-insert-directory): Insert leading space if absent before calling dired-align-file. diff --git a/lisp/dired.el b/lisp/dired.el index f0113c002a4..28ec187e666 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1740,8 +1740,16 @@ see `dired-use-ls-dired' for more details.") (file-expand-wildcards (cdr dir-wildcard)))) (let ((beg (point))) (insert-directory f switches nil nil) - ;; Re-align fields, if necessary. - (dired-align-file beg (point)))))) + ;; `dired-align-file' doesn't fare well with dired + ;; implementations that don't indent entries by one + ;; column, which in all known implementations is + ;; equivalent to not supporting `--dired'. + (save-excursion + (goto-char beg) + (unless (looking-at " ") + (insert " "))) + ;; Re-align fields, if necessary. + (dired-align-file beg (point)))))) (t (insert-directory dir switches wildcard (not wildcard)))) ;; Quote certain characters, unless ls quoted them for us.