Po Lu [Mon, 30 May 2022 07:54:22 +0000 (07:54 +0000)]
Update frame positions on Haiku after changing Z group
* src/haiku_support.cc (EmacsScreenChangeMonitor): Fix comment.
* src/haikufns.c (haiku_set_z_group): Ask for a position update,
since changing the Z group might change the feel of the window.
Po Lu [Mon, 30 May 2022 06:04:43 +0000 (14:04 +0800)]
Fix hangs when x-get-selection is called inside a popup menu
* src/xselect.c (wait_for_property_change):
(x_get_foreign_selection): Use `x_wait_for_cell_change' if input
is blocked. (bug#22214)
* src/xterm.c (x_wait_for_cell_change): New function.
* src/xterm.h: Update prototypes.
Po Lu [Mon, 30 May 2022 02:36:43 +0000 (10:36 +0800)]
Try to implement `dnd-indicate-insertion-point' on macOS
* lisp/term/ns-win.el (ns-handle-drag-motion): New function.
* src/nsterm.m ([EmacsView draggingUpdated:]): Call that
function instead.
(syms_of_nsterm): Clean up old style defvars and add new
defvar for the DND drag function.
Po Lu [Mon, 30 May 2022 01:25:03 +0000 (09:25 +0800)]
Further clean up DND target handling
* src/xfns.c (Fx_begin_drag): Alloca target list.
* src/xterm.c (x_set_dnd_targets): Copy the given targets list.
(x_dnd_begin_drag_and_drop): Record freeing the targets list on
the specpdl.
(handle_one_xevent, x_dnd_cleanup_drag_and_drop)
(x_connection_closed, x_delete_terminal): Stop calling
`x_set_dnd_targets' manually to free the targets list.
Paul Eggert [Sun, 29 May 2022 20:07:50 +0000 (13:07 -0700)]
ISO 8601 strings sans "Z" don’t specify DST flag
* lisp/calendar/iso8601.el (iso8601--zone-dst): New function.
(iso8601-parse, iso8601-parse-time): Use it.
(iso8601--decoded-time): Default dst to -1, not nil.
* test/lisp/calendar/iso8601-tests.el (test-iso8601-combined)
(standard-test-time-of-day-zone): Adjust to new behavior.
Stefan Monnier [Sun, 29 May 2022 17:37:44 +0000 (13:37 -0400)]
* lisp/shell.el (shell): Fix last change
Wrap the file-name prompt within `with-connection-local-variables` as
it was before the previous change.
While at it, make sure we set the `default-directory` of
the actual shell buffer after querying the user.
* lisp/language/indonesian.el ("Batak"): New language environment.
Add composition rules for Batak. Add sample text and input
method.
* lisp/international/fontset.el (script-representative-chars)
(setup-default-fontset): Support Batak.
* lisp/leim/quail/indonesian.el ("batak"): New input method.
Rename TITLE of balinese, javanese and sundanese in
("quail-define-package").
* etc/HELLO: Add a Batak greeting.
* etc/NEWS: Announce the new language environment and its
input method.
Traverse record literals in byte-compile--first-symbol-with-pos
* lisp/emacs-lisp/bytecomp.el (byte-compile--first-symbol-with-pos):
Traverse record literals as well as vectors. Either is rather
pointless but there were some strong feelings about it.
Manuel Giraud [Fri, 20 May 2022 11:52:28 +0000 (13:52 +0200)]
Make `count-words' count sentences.
* lisp/textmodes/paragraphs.el (count-sentences): New function.
* lisp/simple.el (count-words--format): Update format for showing
sentences.
(count-words): Also count sentences.
Po Lu [Sun, 29 May 2022 07:49:48 +0000 (15:49 +0800)]
Keep display mm width and height up to date after changes
* src/xfns.c (Fx_display_mm_width, Fx_display_mm_height): Use
new fields if they are set.
* src/xterm.c (handle_one_xevent): Set new fields on RRNotify if
the screen is correct.
* src/xterm.h (struct x_display_info): New fields
`screen_mm_width', `screen_mm_height'.
Po Lu [Sun, 29 May 2022 04:55:54 +0000 (12:55 +0800)]
Make DND target list lifecycle a little clearer
* src/xfns.c (Fx_begin_drag): Pass target atoms and ntargets to
x_dnd_begin_drag_and_drop instead.
* src/xterm.c (x_set_dnd_targets): Make static.
(x_clear_dnd_targets): Delete function.
(x_dnd_begin_drag_and_drop): Adjust to set targets here instead.
* src/xterm.h: Update prototypes.
Stefan Kangas [Sun, 29 May 2022 04:30:21 +0000 (06:30 +0200)]
Merge from origin/emacs-28
f9ee83bfb9 do_switch_frame: before leaving mini-window, check other (... 908e2e09d0 Fix commands used to produce on-line HTML docs fff770fb97 Fix a bad cross-reference in elisp.pdf ebea3415b0 Fix documentation of 'string-pad'
Move the bulk of the code of `with-connection-local-variables` into
a separate function, which both avoids duplicating that code but also
avoids duplicating the code passed as the body of
a `with-connection-local-variables`. Also makes it easier to
debug the code, or change the implementation of
`with-connection-local-variables` without having to recompile all
the users.
* lisp/files-x.el (with-connection-local-variables-1): New function,
extracted from `with-connection-local-variables`.
(with-connection-local-variables): Use it.
Alan Mackenzie [Sat, 28 May 2022 12:55:32 +0000 (12:55 +0000)]
do_switch_frame: before leaving mini-window, check other (mru) window is live
This fixes bug#55684. There, with a minibuffer-only frame at start up,
Emacs tried to switch to this frame, whose selected window was the
mini-window. There is no other active window in this frame, so the
attempt to swith to another window failed.
* src/frame.c (do_switch_frame): On switching to a frame whose selected
window is as above, before selecting the most recently used window, check
this ostensible window is an actual live window. Otherwise leave the
mini-window selected.
Eli Zaretskii [Sat, 28 May 2022 11:57:55 +0000 (14:57 +0300)]
Fix commands used to produce on-line HTML docs
* admin/admin.el (manual-meta-string): Only include the first
line, and move the rest...
(manual-links-string): ...to this new string.
(manual-html-fix-headers): Don't remove the '<meta name=' elements
produced by makeinfo, especially not the 'name="viewport"' one,
which is essential for viewing the docs on mobile devices.
Reported by "Facundo Lander via RT" <webmasters-comment@gnu.org>,
see gnu.org ticket #1840138.
* lisp/language/indonesian.el ("Sundanese"): New language environment.
Add composition rules for Sundanese. Add sample text and input
method.
Improve composition rules for Balinese and Javanese.
* lisp/international/fontset.el (script-representative-chars)
(setup-default-fontset): Support Sundanese.
* lisp/leim/quail/indonesian.el ("sundanese"): New input method.
* etc/HELLO: Add a Sundanese greeting.
* etc/NEWS: Announce the new language environment and its
input method.
Po Lu [Sat, 28 May 2022 08:48:49 +0000 (16:48 +0800)]
Fix dired drag-and-drop for certain Motif programs
* lisp/dired.el (dired-mouse-drag): Announce _DT_NETFILE in
targets list as well.
* lisp/select.el (xselect--encode-string): New arg
`prefer-string-to-c-string'.
(xselect-convert-to-filename): Convert to TEXT instead of
C_STRING, but use STRING if the type would otherwise be
C_STRING.
(xselect-dt-netfile-available-p, xselect-tt-net-file)
(xselect-convert-to-dt-netfile): New functions.
(selection-converter-alist): New selection converter.
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.