commit 756373a772c2c096bad1b26d7e46fa6144086ce1 (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Sun Nov 13 15:34:16 2022 +0800 Fix warnings without XCB or XFixes * src/xterm.c (x_term_init): Don't USE_SAFE_ALLOCA or call SAFE_FREE outside of where it is actually used. For some reason the compiler still emitted warnings despite the ((void) SAFE_ALLOCA (0)) statement. diff --git a/src/xterm.c b/src/xterm.c index e50f669e67..48ddd17568 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -29120,10 +29120,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) #endif int i; +#if defined HAVE_XFIXES && defined USE_XCB USE_SAFE_ALLOCA; - - /* Avoid warnings when SAFE_ALLOCA is not actually used. */ - ((void) SAFE_ALLOCA (0)); +#endif block_input (); @@ -29277,7 +29276,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) unblock_input (); +#if defined HAVE_XFIXES && defined USE_XCB SAFE_FREE (); +#endif return 0; } @@ -29297,7 +29298,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) unblock_input (); +#if defined HAVE_XFIXES && defined USE_XCB SAFE_FREE (); +#endif return 0; } #endif @@ -30182,7 +30185,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) unblock_input (); +#if defined HAVE_XFIXES && defined USE_XCB SAFE_FREE (); +#endif return dpyinfo; } commit 695dbd3db41f6899f07b7afb48b2061b8a7cd189 Author: Eli Zaretskii Date: Sun Nov 13 08:56:35 2022 +0200 ; Improve documentation of text-scale adjust commands * lisp/face-remap.el (global-text-scale-adjust) (text-scale-adjust): Doc fixes. (Bug#59122) diff --git a/lisp/face-remap.el b/lisp/face-remap.el index 432385587b..f1530285fb 100644 --- a/lisp/face-remap.el +++ b/lisp/face-remap.el @@ -367,7 +367,7 @@ See `text-scale-increase' for more details." ;;;###autoload (defun text-scale-adjust (inc) "Adjust the font size in the current buffer by INC steps. -INC may be passed as a numeric prefix argument. +Interactively, INC is the prefix numeric argument, and defaults to 1. The actual adjustment made depends on the final component of the keybinding used to invoke the command, with all modifiers removed: @@ -377,13 +377,14 @@ keybinding used to invoke the command, with all modifiers removed: \\`0' Reset the font size to the global default After adjusting, continue to read input events and further adjust -the font size as long as the input event read -\(with all modifiers removed) is one of the above characters. +the font size as long as the input event (with all modifiers removed) +is one of the above characters. -Each step scales the height of the default face by the variable -`text-scale-mode-step' (a negative number of steps decreases the -height by the same amount). As a special case, an argument of 0 -will remove any scaling currently active. +Each step scales the height of the default face by the factor that +is the value of `text-scale-mode-step' (a negative number of steps +decreases the height by that factor). As a special case, an argument +of 0 will remove any scaling currently active, thus resetting the +font size to the original value. This command is a special-purpose wrapper around the `text-scale-increase' command which makes repetition convenient @@ -467,19 +468,22 @@ the `cdr' has the maximum font size, in units of 1/10 pt." ;;;###autoload (define-key ctl-x-map [(control meta ?0)] 'global-text-scale-adjust) ;;;###autoload (defun global-text-scale-adjust (increment) - "Globally adjust the font size by INCREMENT. + "Change (a.k.a. \"adjust\") the font size of all faces by INCREMENT. -Interactively, INCREMENT may be passed as a numeric prefix argument. +Interactively, INCREMENT is the prefix numeric argument, and defaults +to 1. Positive values of INCREMENT increase the font size, negative +values decrease it. -The adjustment made depends on the final component of the key binding -used to invoke the command, with all modifiers removed: +When you invoke this command, it performs the initial change of the +font size, and after that allows further changes by typing one of the +following keys immediately after invoking the command: \\`+', \\`=' Globally increase the height of the default face \\`-' Globally decrease the height of the default face \\`0' Globally reset the height of the default face -After adjusting, further adjust the font size as long as the key, -with all modifiers removed, is one of the above characters. +(The change of the font size produced by these keys depends on the +final component of the key sequence, with all modifiers removed.) Buffer-local face adjustments have higher priority than global face adjustments. commit 47b377f64bef8c3da519b3aa9c5c90b7199ba524 Author: Po Lu Date: Sun Nov 13 09:03:51 2022 +0800 Prevent non-local exits from ns-in-echo-area * src/nsterm.m (ns_in_echo_area_1): (ns_in_echo_area_2): (ns_in_echo_area): New functions. ([EmacsView firstRectForCharacterRange:]): Call them instead. (syms_of_nsterm): New defsym. diff --git a/src/nsterm.m b/src/nsterm.m index 17f40dc7e3..507f2a9e7d 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -7056,6 +7056,36 @@ - (void)unmarkText processingCompose = NO; } +static Lisp_Object +ns_in_echo_area_1 (void *ptr) +{ + Lisp_Object in_echo_area; + specpdl_ref count; + + count = SPECPDL_INDEX (); + specbind (Qinhibit_quit, Qt); + in_echo_area = safe_call (1, Qns_in_echo_area); + + return unbind_to (count, in_echo_area); +} + +static Lisp_Object +ns_in_echo_area_2 (enum nonlocal_exit exit, Lisp_Object error) +{ + return Qnil; +} + +static bool +ns_in_echo_area (void) +{ + Lisp_Object in_echo_area; + + in_echo_area + = internal_catch_all (ns_in_echo_area_1, NULL, + ns_in_echo_area_2); + + return !NILP (in_echo_area); +} /* Used to position char selection windows, etc. */ - (NSRect)firstRectForCharacterRange: (NSRange)theRange @@ -7069,7 +7099,7 @@ - (NSRect)firstRectForCharacterRange: (NSRange)theRange if (NS_KEYLOG) NSLog (@"firstRectForCharRange request"); - if (WINDOWP (echo_area_window) && ! NILP (call0 (intern ("ns-in-echo-area")))) + if (WINDOWP (echo_area_window) && ns_in_echo_area ()) win = XWINDOW (echo_area_window); else win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)); @@ -11012,6 +11042,7 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with DEFSYM (Qcondensed, "condensed"); DEFSYM (Qreverse_italic, "reverse-italic"); DEFSYM (Qexpanded, "expanded"); + DEFSYM (Qns_in_echo_area, "ns-in-echo-area"); #ifdef NS_IMPL_COCOA Fprovide (Qcocoa, Qnil); commit 9d334f558a1151ff12b7022a88c75ceb4f1fbdf4 Author: Michal Dubiel Date: Sun Oct 23 19:54:31 2022 +0200 eglot: Support signature labels without a function name * lisp/progmodes/eglot.el (eglot--sig-info): Support signature labels without a function name. (Bug#58777) Copyright-paperwork-exempt: yes diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index c59606a7cb..97c674f7aa 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2934,7 +2934,7 @@ for which LSP on-type-formatting should be requested." (let ((active-param (or activeParameter sig-help-active-param)) params-start params-end) ;; Ad-hoc attempt to parse label as () - (when (looking-at "\\([^(]+\\)(\\([^)]+\\))") + (when (looking-at "\\([^(]*\\)(\\([^)]+\\))") (setq params-start (match-beginning 2) params-end (match-end 2)) (add-face-text-property (match-beginning 1) (match-end 1) 'font-lock-function-name-face)) commit 4ccc385ab136e9794ba7f9ee61d8e4643331887d Author: Morgan J. Smith Date: Wed Nov 9 16:16:55 2022 -0500 vc-git: Ensure git doesn't try to colorize stashes * lisp/vc/vc-git.el (vc-git-stash-show): Add --color=never to git flags. (Bug#59158) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 74536309e2..a1ff03144b 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1883,7 +1883,8 @@ This command shares argument histories with \\[rgrep] and \\[grep]." "Show the contents of stash NAME." (interactive (list (vc-git-stash-read "Show stash: "))) (vc-setup-buffer "*vc-git-stash*") - (vc-git-command "*vc-git-stash*" 'async nil "stash" "show" "-p" name) + (vc-git-command "*vc-git-stash*" 'async nil + "stash" "show" "--color=never" "-p" name) (set-buffer "*vc-git-stash*") (setq buffer-read-only t) (diff-mode) commit d794f1d3f22af458c496978fc89bbb5be37f433e Author: Shohei YOSHIDA Date: Sat Nov 12 22:13:57 2022 +0900 Add cperl-mode to eglot-server-programs diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 63ebbe6cab..c59606a7cb 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -234,7 +234,7 @@ language-server/bin/php-language-server.php")) . ("clojure-lsp")) (csharp-mode . ("omnisharp" "-lsp")) (purescript-mode . ("purescript-language-server" "--stdio")) - (perl-mode . ("perl" "-MPerl::LanguageServer" "-e" "Perl::LanguageServer::run")) + ((perl-mode cperl-mode) . ("perl" "-MPerl::LanguageServer" "-e" "Perl::LanguageServer::run")) (markdown-mode . ("marksman" "server"))) "How the command `eglot' guesses the server to start. An association list of (MAJOR-MODE . CONTACT) pairs. MAJOR-MODE commit f8c11b5a92e78801d71e88cb4ac419e02d85953f Author: Alan Mackenzie Date: Sat Nov 12 15:30:38 2022 +0000 .dir-locals.el (C entry). Add NO_INLINE to c-noise-macro-names diff --git a/.dir-locals.el b/.dir-locals.el index f7c73031cc..a85769b534 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -9,7 +9,8 @@ (bug-reference-url-format . "https://debbugs.gnu.org/%s") (diff-add-log-use-relative-names . t))) (c-mode . ((c-file-style . "GNU") - (c-noise-macro-names . ("INLINE" "ATTRIBUTE_NO_SANITIZE_UNDEFINED" "UNINIT" "CALLBACK" "ALIGN_STACK")) + (c-noise-macro-names . ("INLINE" "NO_INLINE" "ATTRIBUTE_NO_SANITIZE_UNDEFINED" + "UNINIT" "CALLBACK" "ALIGN_STACK")) (electric-quote-comment . nil) (electric-quote-string . nil) (indent-tabs-mode . t) commit e7614cc9ac18995ef8ac353096a5c13e8cebddc9 Author: Po Lu Date: Sat Nov 12 13:11:00 2022 +0000 Correctly handle key map updates on Haiku * src/haiku_support.cc (MessageReceived): Handle B_KEY_MAP_LOADED by clearing the previous keymap. diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 0f8e26d0db..3a98285677 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -653,6 +653,24 @@ class Emacs : public BApplication Quit (); else if (msg->what == B_CLIPBOARD_CHANGED) haiku_write (CLIPBOARD_CHANGED_EVENT, &rq); + else if (msg->what == B_KEY_MAP_LOADED) + { + /* Install the new keymap. Or rather, clear key_map -- Emacs + will fetch it again from the main thread the next time it + is needed. */ + if (key_map_lock.Lock ()) + { + if (key_map) + free (key_map); + + if (key_chars) + free (key_chars); + + key_map = NULL; + key_chars = NULL; + key_map_lock.Unlock (); + } + } else BApplication::MessageReceived (msg); } commit 2bac9d469398c0453e8026430e0f84a74a7b602f Author: Po Lu Date: Sat Nov 12 18:52:36 2022 +0800 Handle request serial wraparound more correctly * src/xterm.c (X_COMPARE_SERIALS): Remove macro. (x_is_serial_more_than, x_is_serial_more_than_or_equal_to) (x_is_serial_less_than, x_is_serial_less_than_or_equal_to): New functions. (x_find_error_handler, x_request_can_fail) (x_clean_failable_requests, x_stop_ignoring_errors): Use those functions to perform request serial comparison. diff --git a/src/xterm.c b/src/xterm.c index b1e74199d7..e50f669e67 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -912,11 +912,6 @@ struct x_selection_request_event struct x_selection_request_event *pending_selection_requests; -/* Compare two request serials A and B with OP, handling - wraparound. */ -#define X_COMPARE_SERIALS(a, op ,b) \ - (((long) (a) - (long) (b)) op 0) - struct x_atom_ref { /* Atom name. */ @@ -25084,6 +25079,48 @@ static struct x_error_message_stack *x_error_message; /* The amount of items (depth) in that stack. */ int x_error_message_count; +/* Compare various request serials while handling wraparound. Treat a + difference of more than X_ULONG_MAX / 2 as wraparound. + + Note that these functions truncate serials to 32 bits before + comparison. */ + +static bool +x_is_serial_more_than (unsigned int a, unsigned int b) +{ + if (a > b) + return true; + + return (b - a > X_ULONG_MAX / 2); +} + +static bool +x_is_serial_more_than_or_equal_to (unsigned int a, unsigned int b) +{ + if (a >= b) + return true; + + return (b - a > X_ULONG_MAX / 2); +} + +static bool +x_is_serial_less_than (unsigned int a, unsigned int b) +{ + if (a < b) + return true; + + return (a - b > X_ULONG_MAX / 2); +} + +static bool +x_is_serial_less_than_or_equal_to (unsigned int a, unsigned int b) +{ + if (a <= b) + return true; + + return (a - b > X_ULONG_MAX / 2); +} + static struct x_error_message_stack * x_find_error_handler (Display *dpy, XErrorEvent *event) { @@ -25093,8 +25130,8 @@ x_find_error_handler (Display *dpy, XErrorEvent *event) while (stack) { - if (X_COMPARE_SERIALS (event->serial, >=, - stack->first_request) + if (x_is_serial_more_than_or_equal_to (event->serial, + stack->first_request) && dpy == stack->dpy) return stack; @@ -25197,11 +25234,11 @@ x_request_can_fail (struct x_display_info *dpyinfo, failable_requests < dpyinfo->next_failable_request; failable_requests++) { - if (X_COMPARE_SERIALS (request, >=, - failable_requests->start) + if (x_is_serial_more_than_or_equal_to (request, + failable_requests->start) && (!failable_requests->end - || X_COMPARE_SERIALS (request, <=, - failable_requests->end))) + || x_is_serial_less_than_or_equal_to (request, + failable_requests->end))) return failable_requests; } @@ -25219,11 +25256,11 @@ x_clean_failable_requests (struct x_display_info *dpyinfo) for (first = dpyinfo->failable_requests; first < last; first++) { - if (X_COMPARE_SERIALS (first->start, >, - LastKnownRequestProcessed (dpyinfo->display)) + if (x_is_serial_more_than (first->start, + LastKnownRequestProcessed (dpyinfo->display)) || !first->end - || X_COMPARE_SERIALS (first->end, >, - LastKnownRequestProcessed (dpyinfo->display))) + || x_is_serial_more_than (first->end, + LastKnownRequestProcessed (dpyinfo->display))) break; } @@ -25302,8 +25339,7 @@ x_stop_ignoring_errors (struct x_display_info *dpyinfo) /* Abort if no request was made since `x_ignore_errors_for_next_request'. */ - if (X_COMPARE_SERIALS (range->end, <, - range->start)) + if (x_is_serial_less_than (range->end, range->start)) emacs_abort (); #ifdef HAVE_GTK3 commit 505e8c5b295bf3ae3b84fab82e224fad3d93a610 Author: Po Lu Date: Sat Nov 12 15:51:02 2022 +0800 ; * src/xselect.c (x_handle_selection_request): Fix typo in last change. diff --git a/src/xselect.c b/src/xselect.c index b897894e8e..9480ac18c1 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -923,7 +923,7 @@ x_handle_selection_request (struct selection_input_event *event) the parameters to a MULTIPLE are ATOM_PAIRs. */ if (cs.type == XA_ATOM) - cs.type = dpyinfo->dpyinfo->Xatom_ATOM_PAIR; + cs.type = dpyinfo->Xatom_ATOM_PAIR; XChangeProperty (dpyinfo->display, requestor, property, cs.type, cs.format, PropModeReplace, commit 25c6bc7a3d3679b26406bbcac33954186db491f2 Author: Po Lu Date: Sat Nov 12 15:50:43 2022 +0800 Fix implementation of MULTIPLE * src/xselect.c (x_handle_selection_request): Make sure the type of a reply to a MULTIPLE request is ATOM_PAIR. diff --git a/src/xselect.c b/src/xselect.c index db5c7853e7..b897894e8e 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -918,6 +918,13 @@ x_handle_selection_request (struct selection_input_event *event) } /* Save conversion results */ lisp_data_to_selection_data (dpyinfo, multprop, &cs); + + /* If cs.type is ATOM, change it to ATOM_PAIR. This is because + the parameters to a MULTIPLE are ATOM_PAIRs. */ + + if (cs.type == XA_ATOM) + cs.type = dpyinfo->dpyinfo->Xatom_ATOM_PAIR; + XChangeProperty (dpyinfo->display, requestor, property, cs.type, cs.format, PropModeReplace, cs.data, cs.size); commit 75fb59c55e88c69f5dffc94947decdc2e0a9d48c Author: Stefan Kangas Date: Sat Nov 12 06:35:21 2022 +0100 * doc/lispref/intro.texi: Fix PDF output without VERSION. (Bug#59199) diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi index 975215d697..eccc8deb63 100644 --- a/doc/lispref/intro.texi +++ b/doc/lispref/intro.texi @@ -34,7 +34,9 @@ specifically to editing. This is @iftex +@ifset VERSION edition @value{VERSION} of +@end ifset @end iftex the @cite{GNU Emacs Lisp Reference Manual}, corresponding to Emacs version @value{EMACSVER}.