Po Lu [Fri, 14 Oct 2022 11:04:44 +0000 (19:04 +0800)]
Fix bug#56153
* src/nsterm.m (get_keysym_name)
(ns_draw_glyphless_glyph_string_foreground): Fix new Mac OS
deprecations.
([EmacsApp terminate:]): Use kbd_buffer_store_event instead
of emacs_event. (bug#56153)
([EmacsView windowDidChangeBackingProperties:]): Fix new Mac
OS deprecation.
Po Lu [Fri, 14 Oct 2022 07:52:16 +0000 (15:52 +0800)]
Avoid redundant creation of XRender pictures
* src/xterm.c (x_composite_image): Take arg DESTINATION. Do not
create a picture if it is set.
(x_draw_image_foreground, x_draw_image_foreground_1): Pass
destination where appropriate.
Fix misleading "File exists, but cannot be read" in browse-url-emacs
* src/fileio.c (Finsert_file_contents): Don't signal an error
about not being able to open the file when we're fetching things
via handlers -- in that case, modtime isn't necessarily set, and
if there's a handler, it should take care of this (bug#42431).
Stefan Monnier [Wed, 12 Oct 2022 21:06:33 +0000 (17:06 -0400)]
src/frame.c (do_switch_frame): Fix bug#58343
* src/frame.c (do_switch_frame): Move call to `get-mru-window` outside
of the "critical region" where (selected-window) != (frame-selected-window).
* src/minibuf.c (move_minibuffers_onto_frame): Add arg `frame`.
Use it instead of `selected_frame`. Adjust all callers.
* src/lisp.h (move_minibuffers_onto_frame): Adjust declaration.
Po Lu [Wed, 12 Oct 2022 12:40:03 +0000 (20:40 +0800)]
Improve makefile-imake-mode
* lisp/progmodes/make-mode.el
(makefile-imake-font-lock-keywords): Give Imake priority over
CPP keywords, and don't require comments to start at BOL.
(makefile-imake-mode): Set comment-start to some sensible value.
Po Lu [Wed, 12 Oct 2022 07:07:49 +0000 (15:07 +0800)]
Stop relying on Xt hack to set window manager hints
* src/widget.c (get_wm_shell): Return WMShellWidget.
(update_wm_hints, widget_update_wm_size_hints): Return whether
or not size hints changed.
* src/widget.h: Delete `size_switch'.
* src/widgetprv.h (EmacsFramePart): Likewise.
* src/xterm.c (x_wm_set_size_hint): Set size hints the usual way
if Xt did not set them. (bug#58412)
Eli Zaretskii [Tue, 11 Oct 2022 10:26:01 +0000 (13:26 +0300)]
Speed up scrolling when lines are very long and truncated
* src/window.c (window_scroll_for_long_lines): New function.
(window_scroll): Call 'window_scroll_for_long_lines' when lines
are very long and truncated on display. Also, disable
'fontification-functions' during scrolling in that case.
* src/xdisp.c (redisplay_window): When recentering the window's
display, go back to the centering position using a simplified
method, if lines in the buffer are very long and truncated on
display.
Po Lu [Tue, 11 Oct 2022 07:45:08 +0000 (15:45 +0800)]
Remove some more unnecessary calls to block_input
* src/xterm.c (x_update_opaque_region, show_back_buffer)
(XTbuffer_flipping_unblocked_hook, x_clear_under_internal_border)
(x_after_update_window_line): Remove and add calls to
block_input as required.
F. Jason Park [Sat, 8 Oct 2022 04:55:30 +0000 (21:55 -0700)]
Accommodate missing spec values in erc-format-message
* lisp/erc/erc.el (erc-format-message): Although not mentioned in its
log message, commit 5281946fbf6b3cdbec5ce82e0057c71849faf4d2 "Make
format-spec accept function substitutions" also fixed a bug involving
the `ignore-missing' parameter of `format-spec'. Until now, ERC has
been relying on the old behavior to gracefully handle malformed server
messages. This commit tries to regain that functionality.
* lisp/view.el (view-remove-frame-by-deleting): Remove variable
that hasn't been used since 2011 -- 357f93d245344 reworked the
code and stopped using it (bug#58413).
kobarity [Mon, 10 Oct 2022 13:24:17 +0000 (22:24 +0900)]
Fix Python completion failure under certain conditions
* lisp/progmodes/python.el (python-shell-send-string-no-output):
Save and restore `comint-last-prompt-overlay' or `comint-last-prompt'.
* test/lisp/progmodes/python-tests.el (python-tests-shell-wait-for-prompt):
New helper function.
(python-tests-with-temp-buffer-with-shell): New helper macro.
(python-shell-completion-1, python-shell-completion-native-1)
(python-shell-completion-native-with-ffap-1)
(python-shell-completion-native-with-eldoc-1): New tests (bug#58389).
* src/sqlite.c (sqlite_prepare_errmsg): New function.
(Fsqlite_execute): Use it to get the same error format for both
execute and select.
(Fsqlite_select): Factored out from here.
Paul Eggert [Mon, 10 Oct 2022 19:35:56 +0000 (12:35 -0700)]
Port bwrap/allows-stdout test to Ubuntu 22.04.1
Without this patch, Ubuntu 22.04.1 x86-64 "make check" reports a
failure in test/src/emacs-tests.el’s
emacs-tests/bwrap/allows-stdout. One can reproduce the bug
without using the Emacs executable, by running this script:
This script exits with status 159, because "cat" didn’t get
started (it got a SIGSYS signal early on).
The command "journalctl -g SECCOMP" indicated that rseq (syscall
334) was the problem. This syscall is issued by
/lib64/ld-linux-x86-64.so.2 before ‘main’ is called.
There’s another problem with the clone3 syscall, which is used by
pthread_create starting in glibc 2.34. pthread_create is called
by g_child_watch_source_new, which is called by
init_process_emacs.
* lib-src/seccomp-filter.c (main): Allow rseq, clone3. This
causes the test to pass. Perhaps a fancier, more accurate patch
could be written by someone who has the time.
Eli Zaretskii [Mon, 10 Oct 2022 08:05:18 +0000 (11:05 +0300)]
; Clarify correct use of 'xref-query-replace-in-results'
* lisp/progmodes/xref.el (xref--query-replace-1): Improve the
user-error message.
(xref-query-replace-in-results): Clarify restrictions in the doc
string.
* doc/emacs/maintaining.texi (Xref Commands, Identifier Search):
Clarify the correct usage of 'xref-query-replace-in-results'.
Try to speed up extended command shorthand computation
Discussed in Bug#51143.
* lisp/simple.el (execute-extended-command--shorter): Compute a
complete list of `commandp' symbols once. This significantly speeds
up complicated cases while the slowdown of simple cases is still
accetable.
Po Lu [Sun, 9 Oct 2022 11:58:07 +0000 (19:58 +0800)]
Fix user time handling bug on GNOME Shell and Metacity
* src/xfns.c (x_window): Avoid extraneous
XChangeWindowAttributes.
* src/xterm.c (x_display_set_last_user_time): New argument
SET_PROPERTY. Do not change the user time property if it is not
true. All callers changed.
(handle_one_xevent): Avoid setting the user time property on
LeaveNotify and XI_Leave events.
Binding it causes errors when some of the enclosed code ends up
loading a `.el` file, and it is unnecessary since the rest of
the code (in `url-file-asynch-callback`) is already careful to
use `insert-file-contents-literally`.
Restrict string-lessp vectorisation to safe architectures
* src/fns.c (HAVE_FAST_UNALIGNED_ACCESS): New.
(Fstring_lessp): Only use word operations where safe, because string
data from purespace may be unaligned.
* lisp/emacs-lisp/vtable.el (vtable-insert-object): Pass in the
correct ellipsis values (bug#58370).
(vtable--insert-line): Don't bug out on missing optional arguments.
* doc/lispref/files.texi (Truenames): Move the documentation of
'file-in-directory-p' from here...
(Contents of Directories): ...to here. Add index entries.
(Bug#58364)
Po Lu [Sat, 8 Oct 2022 08:38:30 +0000 (16:38 +0800)]
Stop passing CurrentTime to SetInputFocus
* src/xterm.c (xi_focus_handle_for_device, handle_one_xevent):
Set the last user time where required for focus to be handled
correctly.
(x_focus_frame): Do not perform actions prohibited by the ICCCM.
* lisp/language/misc-lang.el ("Coptic"): New language environment.
Add sample text and input method.
* lisp/international/fontset.el (script-representative-chars)
(setup-default-fontset): Support coptic.
* lisp/leim/quail/misc-lang.el ("coptic"): New input method.
* etc/HELLO: Add a Coptic greeting.
* etc/NEWS: Announce the new language environment.
Stefan Kangas [Fri, 7 Oct 2022 20:07:09 +0000 (22:07 +0200)]
Fix setting the wallpaper with "swaybg" and "wbg"
* lisp/image/wallpaper.el (wallpaper-setter): Add 'init-action'
and 'detach' fields to structure.
(wallpaper--init-action-kill): New helper function.
(wallpaper--default-setters): Use above new fields for "swaybg" and
"wbg", to start/restart the corresponding processes as needed.
(wallpaper-default-set-function): Call 'init-action' function if
there is one. If 'detach', use 'call-process' instead of
'start-process'. (Bug#57781)
Stefan Monnier [Fri, 7 Oct 2022 18:15:40 +0000 (14:15 -0400)]
subr.el (inhibit-point-motion-hooks): Mark it as obsolete
When Emacs-25 changed the default of `inhibit-point-motion-hooks` to t,
/etc/NEWS declared it as obsolete and so did its docstring, but
it was not marked as obsolete so as not to emit too many warnings
in code where it was impractical to remove the let-binding while
keeping backward compatibility with older Emacsen.
Those backward compatibility issues are not serious any more now that
Emacs-25 is itself considered old.
* lisp/subr.el (inhibit-point-motion-hooks): Mark it as obsolete.
* src/textprop.c (inhibit-point-motion-hooks): Don't mention it being
obsolete in the docstring any more.
* lisp/simple.el (line-move-1, line-move-finish): Silence warnings.
The let-binding was added back in 1997 (commit 79c7a4fa5f974a9d3b)
"because we might have to search inside invisible and intangible text".
So it's been redundant since Emacs-25 changed the default to t.
Keep binding it in Emacs<25 but not in Emacs≥25 (where such bindings
are redundant and the var is declared obsolete).
* lisp/progmodes/verilog-mode.el (verilog-save-buffer-state):
Don't bind `inhibit-point-motion-hooks` if Emacs≥25.
(verilog-save-font-no-change-functions): Same, and refrain from
binding `before/after-change-functions` as well while we're at it,
since `inhibit-modification-hooks` already covers it in Emacs≥25.
Stefan Monnier [Fri, 7 Oct 2022 16:51:14 +0000 (12:51 -0400)]
(line-move-1): Obey `inhibit-point-motion-hooks`
`line-move-1` was written back before `inhibit-point-motion-hooks`
was made obsolete and it's written under the assumption that its
value is nil, whereas since Emacs-25 it's t.
To work around problems linked to a nil value of
`inhibit-point-motion-hooks`, the code temporarily binds that var to
t while it moves around trying to find the final destination and then
later in a few key spots it binds it "back" to nil so as to run the
point-motion hooks according to the final destination, as if the
overall motion had been made "normally".
Change the code so that the "bind back" indeed binds the var back to
the value it had originally, rather than always to nil.
* lisp/simple.el (line-move-1): Obey `inhibit-point-motion-hooks`
(line-move-finish): New optional arg `not-ipmh`.
Stefan Monnier [Fri, 7 Oct 2022 16:29:56 +0000 (12:29 -0400)]
org.el: Improve bindings of `inhibit-*` vars
Remove binding of `inhibit-point-motion-hooks` (it's t by default
anyway and it's obsolete) and don't "manually" bind
`inhibit-modification-hooks`.
* lisp/org/org.el (org-unfontify-region): Use `with-silent-modifications`.
(org-display-inline-remove-overlay): Remove ineffective binding of
`inhibit-modification-hooks` around code which doesn't modify the
buffer anyway.
Stefan Monnier [Fri, 7 Oct 2022 16:25:09 +0000 (12:25 -0400)]
Remove aliases of `with-silent-modifications`
There were many reinventions of `with-silent-modifications` (tho
many of them weren't reinventions but copy&paste of code from
font-lock, IIUC). Now that those don't even need to let-bind
`inhibit-point-motion-hooks` they're really just obsolete.
Improve comparison speed when both arguments are multibyte strings,
at least one of them containing a non-ASCII character. (All-ASCII
multibyte strings are already fast.)
The speed-up is about 2× for strings of 10 chars, 10× for strings of
100 chars.
* src/fns.c (Fstring_lessp): Quickly skip the common prefix by
comparing words.
Miha Rihtaršič [Thu, 6 Oct 2022 18:22:39 +0000 (20:22 +0200)]
comint-fontify-input: Don't fontify output as input, different approach
* lisp/comint.el (comint-output-filter): Propertize process output
with field=output before inserting it into buffer to prevent
comint-fontify-input from fontifying it (bug#58169).