Po Lu [Sat, 28 May 2022 01:37:29 +0000 (09:37 +0800)]
Fix frame destruction issues and misuse of x_get_atom_name
* src/frame.c (delete_frame): Prevent deleting the dnd frame
while waiting for finish as well.
* src/xselect.c (Fx_get_atom_name): Clean up code and fix
uninitialized use of need_sync.
* src/xterm.c (x_dnd_send_unsupported_drop, x_dnd_send_drop)
(handle_one_xevent): Clean up usage of x_get_atom_name.
(x_get_atom_name): Accept NULL for need_sync.
Po Lu [Sat, 28 May 2022 01:03:29 +0000 (09:03 +0800)]
Improve DND documentation
* doc/lispref/frames.texi (Drag and Drop):
* src/xfns.c (Fx_begin_drag): Document that x-begin-drag may
return immediately if no mouse buttons are held down.
Paul Eggert [Fri, 27 May 2022 18:27:08 +0000 (11:27 -0700)]
Add ATTRIBUTE_DEALLOC to extern functions
This can help static checking. It’s not as important for static
functions, where GCC can figure this stuff out own its own.
* src/sysstdio.h (emacs_fopen): Add ATTRIBUTE_DEALLOC (fclose, 1).
* src/tparam.h (tparam): Add ATTRIBUTE_DEALLOC_FREE.
Include stdlib.h so that ‘free’ is declared.
* src/xterm.h (x_get_atom_name): Add ATTRIBUTE_DEALLOC_FREE.
Juri Linkov [Fri, 27 May 2022 16:13:09 +0000 (19:13 +0300)]
Fix navigation in the *Completions* buffer and enable more tests (bug#54374)
* lisp/ido.el: Use first-completion instead of next-completion.
* lisp/minibuffer.el (completion--insert): Put completion--string
text property on prefix and suffix as well.
* lisp/simple.el (first-completion, last-completion): New commands.
(next-completion): Rewrite to fix many bugs reported in
bug#54374, bug#55289, bug#55430.
(choose-completion): Use the text property completion--string that
allows to select a completion when point is on its prefix or suffix.
(switch-to-completions): Use first-completion instead of next-completion,
and last-completion instead of previous-completion.
Eli Zaretskii [Fri, 27 May 2022 12:07:33 +0000 (15:07 +0300)]
Improve font selection on MS-Windows
The Arial Unicode MS font claims in its USB (Unicode Subset
Bitfields) values support for several scripts for which it
doesn't actually have glyphs. This sometimes caused Emacs to
decide to use Arial Unicode MS for some script, only to
discover later that there are no glyphs for that script's
characters. This change fixes the USB values according to
actual font coverage, as determined by BabelMap.
* src/w32font.c (add_font_entity_to_list): Fix USB values of Arial
Unicode MS font according to its actual coverage of scripts.
* lisp/language/indonesian.el ("Javanese"): New language environment.
Add composition rules for Javanese. Add sample text and input
method.
* lisp/international/fontset.el (script-representative-chars):
Support Javanese.
* lisp/leim/quail/indonesian.el ("javanese"): New input method.
* etc/NEWS: Announce the new language environment and its
input method.
Po Lu [Fri, 27 May 2022 01:40:40 +0000 (09:40 +0800)]
Improve lookup efficiency of color cache and prevent leaking
* src/xterm.c (x_parse_color): Move recently used colors to the
start of the cache and free unused entries when there are too
many.
(x_term_init, x_delete_display): Initialize and free new fields.
* src/xterm.h (struct x_display_info): New field
`color_names_length'.
Juri Linkov [Thu, 26 May 2022 16:26:10 +0000 (19:26 +0300)]
Test suite for Completions UI (bug#54374)
* test/lisp/minibuffer-tests.el (completing-read-with-minibuffer-setup):
New macro based on xdisp-tests--in-minibuffer.
(completion-auto-help-test, completion-auto-select-test)
(completion-auto-wrap-test, completions-header-format-test)
(completions-affixation-navigation-test): New tests.
Stefan Monnier [Wed, 25 May 2022 21:53:39 +0000 (17:53 -0400)]
eval.c: New functions `defvar-1` and `defconst-1` (bug#55156)
The bytecode interpreter can't directly call special forms, so
the byte-compiler usually converts special forms into some sequence of
byte codes (basically, providing a duplicate definition of the special
form). There are still two exceptions to this: `defconst` and `defvar`,
where the compiler instead generates a convoluted chunk of code like:
(funcall '(lambda (x) (defvar <sym> x <doc>)) <value>)
where the quote makes sure we keep the function non-compiled, so as
to end up running the special form at run time.
Get rid of this workaround by introducing `defvar-1` and `defconst-1`
which provide a *functional* interface to the functionality of the
corresponding special form.
* src/eval.c (defvar, Fdefvar_1, Fdefconst_1): New functions, extracted from
`Fdefvar` and `Fdefconst`.
(Fdefvar, Fdefconst): Use them.
(syms_of_eval): `defsubr` the new functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-tmp-var): Delete const.
(byte-compile-defvar): Simplify using the new functions.
* doc/lispref/variables.texi (Defining Variables): Adjust the doc of
`defvar` to reflect the actual semantics implemented.
* lisp/language/indonesian.el ("Balinese"): New language environment.
Add composition rules for Balinese. Add sample text and input
method.
* lisp/international/fontset.el (script-representative-chars)
(setup-default-fontset): Support Balinese.
* lisp/leim/quail/indonesian.el ("balinese"): New input method.
* lisp/loadup.el: Preload lisp/language/indonesian.el.
* etc/HELLO: Add a Balinese greeting.
* etc/NEWS: Announce the new language environment and its
input method.
Faster and less recursive byte-compile--first-symbol-with-pos
* lisp/emacs-lisp/bytecomp.el (byte-compile--first-symbol-with-pos)
(byte-compile--warning-source-offset):
Remove recursion for cdr-traversal of lists, and optimise (bug#55414).
Po Lu [Thu, 26 May 2022 13:00:17 +0000 (21:00 +0800)]
Handle alternate actions for Motif drop targets
* src/xterm.c (xm_side_effect_from_action): Handle
`XdndActionAsk'.
(xm_operations_from_actions): New function.
(xm_send_top_level_leave_message, x_dnd_cleanup_drag_and_drop)
(x_dnd_update_state, handle_one_xevent, x_connection_closed):
Use those actions when building a side effect.
(x_dnd_begin_drag_and_drop): Keep track of the set of
alternative drag-and-drop actions.
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.