commit f29fd102d7531619a98acbf0f3e012fb0f6b233f (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Sun Apr 10 13:55:18 2022 +0800 Add missing details to filter event on XI2 * src/xterm.c (handle_one_xevent): Pass coordinates when translating XI2 key events to core key events. diff --git a/src/xterm.c b/src/xterm.c index 34b7c026be..9de46aba10 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -17279,6 +17279,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, xkey.state = ((xev->mods.effective & ~(1 << 13 | 1 << 14)) | (xev->group.effective << 13)); + xkey.x = lrint (xev->event_x); + xkey.y = lrint (xev->event_y); + xkey.x_root = lrint (xev->root_x); + xkey.y_root = lrint (xev->root_y); + /* Some input methods react differently depending on the buttons that are pressed. */ if (xev->buttons.mask_len) @@ -17672,6 +17677,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, xkey.time = xev->time; xkey.state = ((xev->mods.effective & ~(1 << 13 | 1 << 14)) | (xev->group.effective << 13)); + xkey.x = lrint (xev->event_x); + xkey.y = lrint (xev->event_y); + xkey.x_root = lrint (xev->root_x); + xkey.y_root = lrint (xev->root_y); /* Some input methods react differently depending on the buttons that are pressed. */ commit 75bdf15c2972e216a2c10a7562d96ad217192356 Author: Po Lu Date: Sun Apr 10 11:06:41 2022 +0800 Update XI2 device use on slave attachment and detachment * src/xterm.c (handle_one_xevent): Update whether device is a master device when it's detached or attached. diff --git a/src/xterm.c b/src/xterm.c index 14a1506604..34b7c026be 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -17741,6 +17741,26 @@ handle_one_xevent (struct x_display_info *dpyinfo, } else if (hev->info[i].flags & XIDeviceDisabled) disabled[n_disabled++] = hev->info[i].deviceid; + else if (hev->info[i].flags & XISlaveDetached + || hev->info[i].flags & XISlaveAttached) + { + device = xi_device_from_id (dpyinfo, hev->info[i].deviceid); + x_catch_errors (dpyinfo->display); + info = XIQueryDevice (dpyinfo->display, hev->info[i].deviceid, + &ndevices); + x_uncatch_errors (); + + if (info) + { + if (device && info->enabled) + device->master_p = (info->use == XIMasterKeyboard + || info->use == XIMasterPointer); + else if (device) + disabled[n_disabled++] = hev->info[i].deviceid; + + XIFreeDeviceInfo (info); + } + } } if (n_disabled) commit fea97e29895ebe7ca1cc17095766d7c30f9884ac Author: Po Lu Date: Sun Apr 10 09:31:24 2022 +0800 Try harder to own DND selections * src/xterm.c (x_dnd_do_unsupported_drop): Fix computation of local value. (x_dnd_begin_drag_and_drop): Try to own the selection if we do have a local value. diff --git a/src/xterm.c b/src/xterm.c index 0a2c3c5863..14a1506604 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2856,10 +2856,11 @@ x_dnd_do_unsupported_drop (struct x_display_info *dpyinfo, root_y = dest_y; } - x_own_selection (QPRIMARY, - assq_no_quit (QPRIMARY, - dpyinfo->terminal->Vselection_alist), - frame); + if (CONSP (value)) + x_own_selection (QPRIMARY, Fnth (make_fixnum (1), value), + frame); + else + x_own_selection (QPRIMARY, Qnil, frame); event.xbutton.window = child; event.xbutton.x = dest_x; @@ -9369,20 +9370,27 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, ptrdiff_t i, end, fill; XTextProperty prop; xm_drop_start_message dmsg; - Lisp_Object frame_object, x, y; + Lisp_Object frame_object, x, y, frame, local_value; if (!FRAME_VISIBLE_P (f)) error ("Frame is invisible"); + XSETFRAME (frame, f); + local_value = assq_no_quit (QXdndSelection, + FRAME_TERMINAL (f)->Vselection_alist); + if (x_dnd_in_progress || x_dnd_waiting_for_finish) error ("A drag-and-drop session is already in progress"); + if (CONSP (local_value)) + x_own_selection (QXdndSelection, + Fnth (make_fixnum (1), local_value), frame); + else + error ("No local value for XdndSelection"); + ltimestamp = x_timestamp_for_selection (FRAME_DISPLAY_INFO (f), QXdndSelection); - if (NILP (ltimestamp)) - error ("No local value for XdndSelection"); - if (BIGNUMP (ltimestamp)) x_dnd_selection_timestamp = bignum_to_intmax (ltimestamp); else commit b69e8bade635e73cf9be994879230c03248a8224 Author: Lars Ingebrigtsen Date: Sun Apr 10 03:15:03 2022 +0200 Fix mode-line doc string * lisp/faces.el (mode-line): Fix doc string. diff --git a/lisp/faces.el b/lisp/faces.el index 48a8222243..b4e1f03eef 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2657,8 +2657,9 @@ non-nil." :background "grey75" :foreground "black") (t :inverse-video t)) - "Face for the mode lines (for the selected window) as well as header lines. -See `mode-line-display' for the face used on mode lines." + "Face for the mode lines as well as header lines. +See `mode-line-active' and `mode-line-inactive' for the faces +used on mode lines." :version "21.1" :group 'mode-line-faces :group 'basic-faces) commit 0b5c959db550351c18d9b9602cae4273e92f770d Author: Vincent Belaïche Date: Sun Apr 10 00:26:33 2022 +0200 ses-test Prefix used symbols by ses-- * test/lisp/ses-tests.el: Rename cell symbols of renamed cells so that they are in the SES namespace, as recommended by Stefan. diff --git a/test/lisp/ses-tests.el b/test/lisp/ses-tests.el index 2322ea9d79..ea3f9d05d7 100644 --- a/test/lisp/ses-tests.el +++ b/test/lisp/ses-tests.el @@ -29,17 +29,17 @@ (with-suppressed-warnings ((lexical ses--cells) (lexical A2) (lexical A3) - (lexical foo) - (lexical bar) + (lexical ses--foo) + (lexical ses--bar) (lexical B2) - (lexical toto)) + (lexical ses--toto)) (defvar ses--cells) (defvar A2) (defvar A3) - (defvar foo) - (defvar bar) + (defvar ses--foo) + (defvar ses--bar) (defvar B2) - (defvar toto)) + (defvar ses--toto)) ;; PLAIN FORMULA TESTS ;; ====================================================================== @@ -71,7 +71,7 @@ equal to 2. This is done using interactive calls." ;; ====================================================================== (ert-deftest ses-tests-lowlevel-renamed-cell () - "Check that renaming A1 to `foo' and setting `foo' to 1 and A2 to (1+ foo), makes A2 value equal to 2. + "Check that renaming A1 to `ses--foo' and setting `ses--foo' to 1 and A2 to (1+ ses--foo), makes A2 value equal to 2. This is done using low level functions, `ses-rename-cell' is not called but instead we use text replacement in the buffer previously passed in text mode." @@ -85,63 +85,63 @@ previously passed in text mode." (text-mode) (goto-char (point-min)) (while (re-search-forward "\\" nil t) - (replace-match "foo" t t)) + (replace-match "ses--foo" t t)) (ses-mode) (should-not (local-variable-p 'A1)) - (should (eq foo 1)) - (should (equal (ses-cell-formula 1 0) '(ses-safe-formula (1+ foo)))) + (should (eq ses--foo 1)) + (should (equal (ses-cell-formula 1 0) '(ses-safe-formula (1+ ses--foo)))) (should (eq (bound-and-true-p A2) 2))))) (ert-deftest ses-tests-renamed-cell () - "Check that renaming A1 to `foo' and setting `foo' to 1 and A2 -to (1+ foo), makes A2 value equal to 2." + "Check that renaming A1 to `ses--foo' and setting `ses--foo' to 1 and A2 +to (1+ ses--foo), makes A2 value equal to 2." (let ((ses-initial-size '(2 . 1))) (with-temp-buffer (ses-mode) - (ses-rename-cell 'foo (ses-get-cell 0 0)) - (dolist (c '((0 0 1) (1 0 (1+ foo)))) + (ses-rename-cell 'ses--foo (ses-get-cell 0 0)) + (dolist (c '((0 0 1) (1 0 (1+ ses--foo)))) (apply 'funcall-interactively 'ses-edit-cell c)) (ses-command-hook) (should-not (local-variable-p 'A1)) - (should (eq foo 1)) - (should (equal (ses-cell-formula 1 0) '(1+ foo))) + (should (eq ses--foo 1)) + (should (equal (ses-cell-formula 1 0) '(1+ ses--foo))) (should (eq (bound-and-true-p A2) 2))))) (ert-deftest ses-tests-renamed-cell-after-setting () "Check that setting A1 to 1 and A2 to (1+ A1), and then -renaming A1 to `foo' makes `foo' value equal to 2." +renaming A1 to `ses--foo' makes `ses--foo' value equal to 2." (let ((ses-initial-size '(2 . 1))) (with-temp-buffer (ses-mode) (dolist (c '((0 0 1) (1 0 (1+ A1)))) (apply 'funcall-interactively 'ses-edit-cell c)) (ses-command-hook); deferred recalc - (ses-rename-cell 'foo (ses-get-cell 0 0)) + (ses-rename-cell 'ses--foo (ses-get-cell 0 0)) (should-not (local-variable-p 'A1)) - (should (eq foo 1)) - (should (equal (ses-cell-formula 1 0) '(1+ foo))) + (should (eq ses--foo 1)) + (should (equal (ses-cell-formula 1 0) '(1+ ses--foo))) (should (eq (bound-and-true-p A2) 2))))) (ert-deftest ses-tests-renaming-cell-with-one-symbol-formula () "Check that setting A1 to 1 and A2 to A1, and then renaming A1 -to `foo' makes `foo' value equal to 1. Then set A1 to 2 and check -that `foo' becomes 2." +to `ses--foo' makes `ses--foo' value equal to 1. Then set A1 to 2 and check +that `ses--foo' becomes 2." (let ((ses-initial-size '(3 . 1))) (with-temp-buffer (ses-mode) (dolist (c '((0 0 1) (1 0 A1))) (apply 'funcall-interactively 'ses-edit-cell c)) (ses-command-hook); deferred recalc - (ses-rename-cell 'foo (ses-get-cell 0 0)) + (ses-rename-cell 'ses--foo (ses-get-cell 0 0)) (ses-command-hook); deferred recalc (should-not (local-variable-p 'A1)) - (should (eq foo 1)) - (should (equal (ses-cell-formula 1 0) 'foo)) + (should (eq ses--foo 1)) + (should (equal (ses-cell-formula 1 0) 'ses--foo)) (should (eq (bound-and-true-p A2) 1)) (funcall-interactively 'ses-edit-cell 0 0 2) (ses-command-hook); deferred recalc (should (eq (bound-and-true-p A2) 2)) - (should (eq foo 2))))) + (should (eq ses--foo 2))))) ;; ROW INSERTION TESTS @@ -165,8 +165,8 @@ to A2 and inserting a row, makes A2 value empty, and A3 equal to (ert-deftest ses-tests-renamed-cells-row-insertion () - "Check that setting A1 to 1 and A2 to (1+ A1), and then renaming A1 to `foo' and A2 to `bar' jumping -to `bar' and inserting a row, makes A2 value empty, and `bar' equal to + "Check that setting A1 to 1 and A2 to (1+ A1), and then renaming A1 to `ses--foo' and A2 to `ses--bar' jumping +to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to 2." (let ((ses-initial-size '(2 . 1))) (with-temp-buffer @@ -174,16 +174,16 @@ to `bar' and inserting a row, makes A2 value empty, and `bar' equal to (dolist (c '((0 0 1) (1 0 (1+ A1)))) (apply 'funcall-interactively 'ses-edit-cell c)) (ses-command-hook) - (ses-rename-cell 'foo (ses-get-cell 0 0)) + (ses-rename-cell 'ses--foo (ses-get-cell 0 0)) (ses-command-hook) - (ses-rename-cell 'bar (ses-get-cell 1 0)) + (ses-rename-cell 'ses--bar (ses-get-cell 1 0)) (ses-command-hook) - (should (eq bar 2)) - (ses-jump 'bar) + (should (eq ses--bar 2)) + (ses-jump 'ses--bar) (ses-insert-row 1) (ses-command-hook) (should-not (bound-and-true-p A2)) - (should (eq bar 2))))) + (should (eq ses--bar 2))))) ;; JUMP tests @@ -231,15 +231,15 @@ to `bar' and inserting a row, makes A2 value empty, and `bar' equal to (should (eq (ses--cell-at-pos (point)) 'B2))))) (ert-deftest ses-jump-B2-renamed () - "Test jumping to cell B2 after renaming it `toto'." + "Test jumping to cell B2 after renaming it `ses--toto'." (let ((ses-initial-size '(3 . 3)) ses-after-entry-functions) (with-temp-buffer (ses-mode) - (ses-rename-cell 'toto (ses-get-cell 1 1)) - (ses-jump 'toto) + (ses-rename-cell 'ses--toto (ses-get-cell 1 1)) + (ses-jump 'ses--toto) (ses-command-hook) - (should (eq (ses--cell-at-pos (point)) 'toto))))) + (should (eq (ses--cell-at-pos (point)) 'ses--toto))))) (provide 'ses-tests) commit 8b3748c234e8be8c2b34c263cb216fef5a5f2279 Author: Lars Ingebrigtsen Date: Fri Apr 8 15:45:07 2022 +0200 Fix sql-mode comment-end parsing * lisp/progmodes/sql.el (sql-mode): Fix /* ... -*/ parsing (bug#54769). diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 69d16a4357..13fba0c705 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -4195,7 +4195,18 @@ must tell Emacs. Here's how to do that in your init file: nil))) ;; Propertize rules to not have /- and -* start comments. ("\\(/-\\)" (1 ".")) - ("\\(-\\*\\)" (1 ".")))) + ("\\(-\\*\\)" + (1 + (if (save-excursion + (not (ppss-comment-depth + (syntax-ppss (match-beginning 1))))) + ;; If we're outside a comment, we don't let -* + ;; start a comment. + (string-to-syntax ".") + ;; Inside a comment, ignore it to avoid -*/ not + ;; being intepreted as a comment end. + (forward-char -1) + nil))))) ;; Set syntax and font-face highlighting ;; Catch changes to sql-product and highlight accordingly (sql-set-product (or sql-product 'ansi)) ; Fixes bug#13591 commit 40c2bfdae198100a4be3a8b25e0722fd7c953516 Author: Po Lu Date: Sat Apr 9 18:25:22 2022 +0800 Avoid sync when allowing touch events in handle_one_xevent * src/xterm.c (handle_one_xevent): Don't catch errors around XIAllowTouchEvents. (x_error_handler): Ignore Device errors here instead. diff --git a/src/xterm.c b/src/xterm.c index f6138d5214..0a2c3c5863 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -17948,10 +17948,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (f && device->direct_p) { *finish = X_EVENT_DROP; - x_catch_errors (dpyinfo->display); if (x_input_grab_touch_events) XIAllowTouchEvents (dpyinfo->display, xev->deviceid, xev->detail, xev->event, XIAcceptTouch); + if (!x_had_errors_p (dpyinfo->display)) { xi_link_touch_point (device, xev->detail, xev->event_x, @@ -17967,17 +17967,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (source) inev.ie.device = source->name; } - x_uncatch_errors_after_check (); } #ifndef HAVE_GTK3 - else - { - x_catch_errors (dpyinfo->display); - if (x_input_grab_touch_events) - XIAllowTouchEvents (dpyinfo->display, xev->deviceid, - xev->detail, xev->event, XIRejectTouch); - x_uncatch_errors (); - } + else if (x_input_grab_touch_events) + XIAllowTouchEvents (dpyinfo->display, xev->deviceid, + xev->detail, xev->event, XIRejectTouch); #endif } else @@ -19377,11 +19371,15 @@ x_error_handler (Display *display, XErrorEvent *event) #ifdef HAVE_XINPUT2 dpyinfo = x_display_info_for_display (display); - /* 51 is X_XIGrabDevice and 52 is X_XIUngrabDevice. */ + /* 51 is X_XIGrabDevice and 52 is X_XIUngrabDevice. + + 53 is X_XIAllowEvents. We handle errors from that here to avoid + a sync in handle_one_xevent. */ if (dpyinfo && dpyinfo->supports_xi2 && event->request_code == dpyinfo->xi2_opcode && (event->minor_code == 51 - || event->minor_code == 52)) + || event->minor_code == 52 + || event->minor_code == 53)) return 0; #endif commit d327fd594da7d7207c2d47414a6c47ff0c0e2598 Author: Eli Zaretskii Date: Sat Apr 9 12:57:08 2022 +0300 ; * doc/emacs/trouble.texi (Memory Full): Minor copyedits. diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index f524a82022..8da96de1cb 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -296,20 +296,31 @@ editing in the same Emacs session. out of memory, because the Buffer Menu needs a fair amount of memory itself, and the reserve supply may not be enough. -@cindex memory trouble, GNU/Linux - On GNU/Linux systems, the system does not normally report running -out of memory to Emacs, and can instead randomly kill processes when -they run out of memory. We recommend that you turn this behavior off, -so that Emacs can respond correctly when it runs out of memory, by -becoming the super user, editing the file @code{/etc/sysctl.conf} to -contain the following lines, and then running the command @code{sysctl --p}: +@cindex out of memory killer, GNU/Linux +@cindex OOM killer + On GNU/Linux systems, Emacs does not normally get notified about +out-of-memory situations; instead, the OS can kill the Emacs process +when it runs out of memory. This feature is known as the +@dfn{out-of-memory killer}, or @dfn{@acronym{OOM} killer}. When this +behavior is in effect, Emacs is unable to detect the out-of-memory +situation in time, and won't be able to let you save your buffer as +described above. However, it is possible to turn off this behavior of +the OS, and thus allow Emacs a chance to handle the out-of-memory +situation in a more useful manner, before it is killed. To do that, +become the super user, edit the file @code{/etc/sysctl.conf} to +contain the lines shown below, and then invoke the command +@w{@kbd{sysctl -p}} from the shell prompt: @example vm.overcommit_memory=2 vm.overcommit_ratio=0 @end example +@noindent +Please note that the above setting affects all the processes on the +system, and in general the behavior of the system under memory +pressure, not just the Emacs process alone. + @node Crashing @subsection When Emacs Crashes