Po Lu [Thu, 26 May 2022 02:22:24 +0000 (10:22 +0800)]
Make X error checking more asynchronous
This makes some operations (such as x-get-atom-name and
x-change-window-property) up to 2600x faster by avoiding calls
to XSync when setting up an error handler, and when checking for
or uncatching errors if all requests were already processed.
* src/xterm.c (X_COMPARE_SERIALS): New macro.
(struct x_error_message_stack): Add new field `first_request'.
(x_find_error_handler): New function.
(x_error_catcher): New parameter `stack'. Use it instead.
(x_catch_errors_with_handler): Keep a record of the next
protocol request serial inside the stack entry.
(x_uncatch_errors, x_check_errors, x_had_errors_p, x_clear_errors)
(x_error_handler): Avoid XSync if all requests were processed by
the X server and look for the error handler matching the display
and request serial when processing errors.
* lisp/language/indian.el ("Limbu"): New language environment.
Add composition rules for Limbu. Add sample text and input
method.
* lisp/international/fontset.el (script-representative-chars)
(setup-default-fontset): Support Limbu.
* lisp/leim/quail/indian.el ("limbu"): New input method.
* etc/HELLO: Add a Limbu greeting.
* etc/NEWS: Announce the new language environment and its
input method.
Eli Zaretskii [Wed, 25 May 2022 17:57:59 +0000 (13:57 -0400)]
Merge from origin/emacs-28
86b49d5865 ; * etc/NEWS: Announce changes in 'desktop-kill'. (Bug#55... d5ccf2621a ; Fix last change f1c1fd7184 Improve documentation of mail-user-agent. b05d1e9b98 ; * lisp/desktop.el: Update the commentary. (Bug#55560) 139bfa1a08 More fixes in abbrev.el doc strings d80dea6036 Add note about Tramp completion to completion-styles doc s... 9e7c0cf57d Remove mention of removed nnimap-nov-is-evil variable 90aae0bca2 Improve documentation strings and prompts in abbrev.el dfa3e6f424 Restore the Fselect_window call in gui_consider_frame_title. de35e9728f Advise against settings in the MS-Windows system registry 3ffa3d3403 ; Minor addition to make-tarball.txt 7dc026f9ea Fix kmacro-keymap binding after previous change 4f0fd54bc4 Add glossary entries for "interactively" af1c05a3c4 Fix the name of a kmacro command.
Po Lu [Wed, 25 May 2022 12:29:38 +0000 (20:29 +0800)]
Lower the roundtrip overhead of x-get-atom-name by 50% for common atoms
* src/xselect.c (Fx_get_atom_name):
* src/xterm.c (x_dnd_begin_drag_and_drop): Use that instead. Don't
sync to handle errors if using `x_get_atom_name' resulted in no
protocol request being made.
(x_get_atom_name): New function.
* src/xterm.h: Update prototypes.
* doc/lispref/text.texi (Yanking): Adjust.
* lisp/simple.el (yank-transform-functions): Make into defvar
because it's not that useful as a user option.
Paul W. Rankin [Tue, 24 May 2022 22:19:57 +0000 (18:19 -0400)]
Change variable which-func-unknown to "n/a"
* lisp/progmodes/which-func.el (which-func-unknown): Change string
displayed in mode-line from "???" to "n/a"; the former appears to
indicate an error whereas the latter is more indicative that the
current function is not known.
F. Jason Park [Tue, 24 May 2022 13:41:40 +0000 (06:41 -0700)]
; Fix inevitable failure in erc-dcc test
* test/lisp/erc/erc-dcc-tests.el
(erc-dcc-tests--dcc-handle-ctcp-send): Shadow hook to prevent the
erc-button module from interfering with tests that use this helper.
Don't use `format-message' to make doc strings in erc-backend
* lisp/erc/erc-backend.el (define-erc-response-handler): Use
`format' here instead of `format-message' since Emacs will expand
the doc string later when the user asks for help about the symbols
defined.
Make byte compilation warn about wrong quoting in doc strings
* lisp/emacs-lisp/bytecomp.el
(byte-compile-docstring-length-warn): Made into obsolete alias.
(byte-compile-docstring-style-warn): Also warn about other
stylistic issues.
(byte-compile-file-form-autoload, byte-compile-file-form-defvar)
(byte-compile-file-form-defvar-function, byte-compile-lambda)
(byte-compile-defvar, byte-compile-file-form-defalias): Adjust callers.
Alan Mackenzie [Tue, 24 May 2022 16:33:20 +0000 (16:33 +0000)]
CC Mode: Fix interplay between string fences and electric-pair-mode.
This is an amendment to the fix for bug #55230.
* lisp/progmodes/cc-defs.el: (c-with-string-fences): Add an edebug spec.
* lisp/progmodes/cc-cmds.el: (c-electric-pound, c-electric-brace)
(c-electric-slash, c-electric-star, c-electric-semi&comma, c-electric-colon)
(c-electric-lt-gt, c-electric-paren): Put the final
c--call-post-self-insert-hook-more-safely outside of the functions'
c-with-string-fences.
(c-electric-brace, c-electric-lt-gt, c-electric-paren): Put the calls to
electric-pair-post-self-insert-function outside of c-with-string-fences.
Stefan Monnier [Tue, 24 May 2022 16:29:54 +0000 (12:29 -0400)]
Make `yank-transform-functions` a proper hook
* lisp/subr.el (insert-for-yank): Use `run-hook-wrapped` to run
`yank-transform-functions`.
* lisp/simple.el (yank-transform-functions): Adjust accordingly.
Add support for the Buhid and Tagbanwa scripts (bug#55610)
* lisp/language/philippine.el ("Buhid"): New language environment.
("Tagbanwa"): New language environment.
Add input methods for Buhid and Tagbanwa.
Add sample text for Tagbanwa.
* lisp/international/fontset.el (script-representative-chars)
(setup-default-fontset): Support Buhid and Tagbanwa.
* lisp/leim/quail/philippine.el ("buhid"): New input method.
("tagbanwa"): New input method.
* etc/HELLO: Add a Tagbanwa greeting.
* etc/NEWS: Announce the new language environments and their
input methods.
Po Lu [Tue, 24 May 2022 13:20:46 +0000 (21:20 +0800)]
Add more error checking to some X functions
* src/xfns.c (Fx_change_window_property, Fx_delete_window_property)
(Fx_window_property, Fx_window_property_attributes): Check for
errors in case the window is invalid. Also use better function
for interning prop names.
* src/xterm.c (struct x_atom_ref): New structure.
(x_atom_refs): New list. Extract from x_term_init.
(x_intern_cached_atom): New function. Use it in several places
to avoid interning common atoms.
(x_term_init): Adjust accordingly.
Jim Porter [Mon, 23 May 2022 00:27:48 +0000 (17:27 -0700)]
Keep subcommands in pipelines from clobbering the head/tail processes
* lisp/eshell/esh-cmd.el (eshell-execute-pipeline): Use 'make-symbol'
for headproc and tailproc.
(eshell-do-pipelines, eshell-do-pipelines-synchronously): Adapt to the
above.
* test/lisp/eshell/eshell-tests.el (eshell-test/pipe-subcommand)
(eshell-test/pipe-subcommand-with-pipe): New test.
* doc/misc/eshell.texi (Bugs and ideas): Remove item about piping to
process from loop; this commit fixes it (bug#55590).
Make the nativecomp test eln directory more reliably be removed
* lisp/startup.el (startup-redirect-eln-cache, normal-top-level):
Don't create the nativecomp directory here, because this led to
brittle deletions of the directory -- there would be several
instances of the directory left over after a test run.
* lisp/emacs-lisp/ert.el (ert-run-tests-batch-and-exit): Create
the nativecomp directory.
Po Lu [Tue, 24 May 2022 07:11:19 +0000 (15:11 +0800)]
Allow the user to fix `x-mouse-click-focus-ignore-position' on some systems
* src/xterm.c (handle_one_xevent): Apply that variable instead.
(syms_of_xterm): Update doc string and add new option to adjust
the focus click timeout.
Po Lu [Tue, 24 May 2022 02:09:59 +0000 (02:09 +0000)]
Minor fixes to cursor color handling on Haiku
* src/haikufns.c (haiku_decode_color): New function.
(haiku_set_foreground_color, haiku_set_background_color)
(haiku_set_cursor_color, haiku_set_mouse_color): Use that
function to decode colors instead. Also set cursor GC
foreground when setting background color.
* src/haikuterm.c (haiku_merge_cursor_foreground): Fix color
equality test.
Less wrong printed circular list tail index (bug#55395)
When printing a circular list and `print-circle` is nil, use a
somewhat more meaningful ". #N" tail index. The previous method for
calculating that index was based on Floyd circularity detection being
used so it had been broken ever since the change to Brent's algorithm.
The new index is correct with respect to the start of the list itself
which is what it used to be before being completely broken.
It does not take into account the nesting depth of the list context.
* src/print.c (struct print_stack_entry, print_object):
Keep track of the tortoise index (which is cheap) instead of trying
to derive it from the printed element index.
* test/src/print-tests.el (print-test-rho, print-circular):
New test.
Eli Zaretskii [Mon, 23 May 2022 13:32:47 +0000 (16:32 +0300)]
Fix saveplace.el when desktop.el restores non-ASCII buffers
* lisp/saveplace.el (load-save-place-alist-from-file): Bind
'coding-system-for-read' to nil, so that the 'coding:' cookie in
the save-place file takes effect. (Bug#55592)
* lisp/language/philippine.el ("Hanunoo"): New language environment.
Add composition rules for Hanunoo. Add sample text and input
method.
* lisp/international/fontset.el (script-representative-chars)
(setup-default-fontset): Support Hanunoo.
* lisp/leim/quail/philippine.el ("hanunoo"): New input method.
* etc/HELLO: Add a Hanunoo greeting.
* etc/NEWS: Announce the new language environment and its
input method.
Po Lu [Mon, 23 May 2022 10:23:43 +0000 (10:23 +0000)]
Implement monitor change functions on Haiku
* src/haiku_io.c (haiku_len): Handle new event type.
* src/haiku_support.cc (class EmacsScreenChangeMonitor): New
class.
(class Emacs, Emacs): Create new screen change monitor.
(DispatchMessage): Update fullscreen state if the screen
changed.
(SetFullscreen): Don't punt if fullscreen mode is identical.
* src/haiku_support.h (enum haiku_event_type): New event
`SCREEN_CHANGE_EVENT'.
(struct haiku_screen_changed_event): New struct.
* src/haikuterm.c (haiku_read_socket): Handle new event.
* lisp/dired.el (dired-mark): Skip dot files (bug#38729). This
makes `C-u 10 d' (etc) consistent with marking the next ten lines
with the mouse and then hitting `d'.
* lisp/abbrev.el (abbrev--possibly-save): Separated out from
`save-some-buffers'.
(save-some-buffers-functions): Add to the save function.
* lisp/files.el (save-some-buffers-functions): New variable.
(save-some-buffers): Use it.
(save-buffers-kill-emacs): Also use it to see if we have something
to save (bug#55579).
Po Lu [Mon, 23 May 2022 03:13:45 +0000 (11:13 +0800)]
Implement monitor change functions on GNUstep
* src/nsfns.m (Fns_display_monitor_attributes_list): Fix coding
style.
* src/nsterm.m (nstrace_leave, nstrace_restore_global_trace_state)
(nstrace_fullscreen_type_name): Fix coding style.
(ns_displays_reconfigured, ns_term_init): Make a record of the
previous display attributes list and avoid storing duplicate
events.
([EmacsApp init]): Listen for
NSApplicationDidChangeScreenParametersNotification.
([EmacsApp updateMonitors:]): New method.
(syms_of_nsterm): New staticpro.
Po Lu [Mon, 23 May 2022 01:22:28 +0000 (09:22 +0800)]
Use GDK for handling monitor changes when built with GTK
* src/xterm.c (x_monitors_changed_cb): New function.
(handle_one_xevent): Don't handle RRNotify and
RRScreenChangeNotify on GTK.
(x_term_init): Connect to GdkScreen::monitors-changed instead of
selecting for RRNotify events.
(mark_xterm): Also mark `last_monitor_attributes_list' on GTK.
* src/xterm.h (struct x_display_info): Enable
`last_monitor_attributes_list' on GTK builds as well.
F. Jason Park [Fri, 6 May 2022 04:13:47 +0000 (21:13 -0700)]
Recognize DCC SSEND when receiving files in erc-dcc
* lips/erc/erc-dcc.el (erc-dcc-open-network-stream): Use TLS
for new connections when :secure flag is set.
(erc-dcc-do-GET-command): Set secure flag when user explicitly passes
an "-s" option.
(erc-dcc-do-LIST-command): Show an "s" to indicate a secure connection
when applicable.
(erc-dcc-query-handler-alist): Add extra items for "SSEND", etc.
(erc-dcc-handle-ctcp-send): Set secure flag when a leading "S" appears
in the command type.
F. Jason Park [Sat, 30 Apr 2022 09:16:46 +0000 (02:16 -0700)]
Accommodate nonstandard turbo file senders in erc-dcc
* lisp/erc/erc-dcc.el (erc-dcc-list): Document optional :turbo item.
(erc-message-english-dcc-list-{head,line,item}): Adjust format strings
to make room for "(T)" turbo indicator.
(erc-dcc-do-GET-command): Optionally set :turbo in `erc-dcc-list'
entry when passed "-t" in the "/DCC GET" slash command. Also add
switch to command line in front-matter Commentary, but refrain from
publicizing further because our implementation is only defensive and
only for receiving.
(erc-dcc-do-LIST): Print message with new format specifier for turbo
status.
(erc-dcc-ctcp-query-send-regexp): Account for T- and S-prefixed
commands. Receiving from an SSEND-capable sender will be added in a
subsequent commit.
(erc-dcc-handle-ctcp-send): Set :turbo item in `erc-dcc-list' member
when new match group is nonempty.
(erc-dcc--X-send-final-turbo-ack): New internal variable and potential
future option for extreme corner cases involving maverick turbo
senders, like WeeChat, who don't use the TSEND command variant.
(erc-dcc-get-filter): Don't send when turbo is active.
* test/lisp/erc/erc-dcc-tests.el: Add new file.
(Bug#54458)
F. Jason Park [Sun, 10 Apr 2022 06:32:22 +0000 (23:32 -0700)]
Allow matching against string values in erc-dcc-member
* lisp/erc/erc-dcc.el (erc-dcc-member): Be more tolerant in the
catch-all case by testing for equality instead of identity.
(erc-dcc-do-GET-command): Pass file name when querying
`erc-dcc-member'. (Bug#54458)
F. Jason Park [Thu, 31 Mar 2022 00:16:11 +0000 (17:16 -0700)]
Summarize failed transfers in erc-dcc
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel): Display error when total
byte count received is lower than expected.
(erc-message-english-dcc-get-failed): Add `dcc-get-failed' to the
English messages catalog.
(erc-dcc-get-file): Tweak initialization of `erc-dcc-entry-data'.
(Bug#54458)
Juri Linkov [Sun, 22 May 2022 17:55:35 +0000 (20:55 +0300)]
Enable keys M-down, M-up, M-RET for in-buffer completion
* lisp/minibuffer.el (completion-in-region-mode-map): Add keybindings M-<up>
for minibuffer-previous-completion, M-<down> for minibuffer-next-completion,
M-RET for minibuffer-choose-completion.
(completion-in-region-mode): Set buffer-local
'minibuffer-completion-auto-choose' to nil.
(minibuffer-next-completion): Get the value of
'minibuffer-completion-auto-choose' from the minibuffer.
(minibuffer-previous-completion): Simplify by delegating to
'minibuffer-next-completion'.
Alan Mackenzie [Sun, 22 May 2022 16:55:05 +0000 (16:55 +0000)]
CC Mode: Restore string fence properties at each relevant external entry point
This fixes bug #55230.
* lisp/progmodes/cc-defs.el (c-string-fences-set-flag, c-with-string-fences):
New variable and macro.
* lisp/progmodes/cc-mode.el (c-called-from-text-property-change-p): Add
remove-text-properties to the list of accepted functions.
(c-clear-string-fences, c-restore-string-fences): Surround the functions'
innards with c-save-buffer-state to prevent text property changes causing
change functions to be called.
(c-before-change, c-after-change, c-font-lock-fontify-region): Replace the
explicit calls to c-restore-string-fences and c-clear-string-fences with
invocations of the new macro c-with-string-fences.
* lisp/progmodes/cc-awk.el (c-awk-extend-and-syntax-tablify-region)
(c-awk-end-of-defun)
* lisp/progmodes/cc-cmds.el (c-show-syntactic-information)
(c-electric-backspace, c-hungry-delete-backwards, c-electric-delete-forward)
(c-hungry-delete-forward, c-electric-pound, c-electric-brace)
(c-electric-slash, c-electric-star, c-electric-semi&comma, c-electric-colon)
(c-electric-lt-gt, c-electric-paren, c-beginning-of-defun, c-end-of-defun)
(c-display-defun-name, c-mark-function, c-beginning-of-statement)
(c-end-of-statement, c-indent-command, c-indent-exp, c-indent-defun)
(c-indent-line-or-region, c-fill-paragraph, c-indent-new-comment-line)
(c-context-line-break)
* lisp/progmodes/cc-guess.el (c-guess-region-no-install): These are all
"boundary" functions to CC Mode. Surround each by c-with-string-fences.