Po Lu [Fri, 21 Jan 2022 05:22:51 +0000 (13:22 +0800)]
Work around GTK changing window backgrounds on colormapped displays
* src/xterm.c (x_clear_window):
(x_clear_area): Fill the contents with the reverse GC instead of
using XClearArea and XClearWindow when not double buffered.
Po Lu [Fri, 21 Jan 2022 01:15:52 +0000 (09:15 +0800)]
Allow fractional values of `polling-period'
This allows C-g to be handled faster in the NS port at the cost
of some extra CPU time on slow machines.
* etc/NEWS: Announce new feature.
* src/keyboard.c (start_polling):
(bind_polling_period): Handle floating point values of
`polling-period'.
(syms_of_keyboard): Make `polling-period' a Lisp variable
instead of an int variable.
Po Lu [Sat, 15 Jan 2022 13:11:57 +0000 (21:11 +0800)]
Avoid FOCUS_IN_EVENTS not being sent on NS
* src/nsterm.m ([EmacsView windowDidBecomeKey]): Work around
emacs_event being NULL by storing focus in events directly
into the keyboard buffer. (bug#52376)
Alan Mackenzie [Thu, 20 Jan 2022 18:40:15 +0000 (18:40 +0000)]
In early bootstrap, use byte-compiled compiler to native compile first files
This speeds up a make bootstrap by around 15%.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): set a value specific to compile-first
which doesn't contain the setting of Emacs variable load-prefer-newer.
Add a new make hunk which byte-compiles (rather then native compiles) when the
environment variable ANCIENT is "yes". Set the date of the .elc files built
to 1971-01-01 to cause a second compilation of them later.
* src/Makefile.in: Add an extra invocation of directory lisp's MAKE with
target compile-first and the flag environment variable ANCIENT set to yes.
* src/verbose.mk.in: When ANCIENT is yes, output ELC, not ELC+ELN for
AM_V_ELC.
Eli Zaretskii [Thu, 20 Jan 2022 17:18:54 +0000 (19:18 +0200)]
Update documentation of 'clone-indirect-buffer-hook'
* doc/emacs/buffers.texi (Indirect Buffers):
* src/buffer.c (syms_of_buffer) <clone-indirect-buffer-hook>:
Update the documentation of 'clone-indirect-buffer-hook' due the
recent changes.
* etc/NEWS: Mention the change in where the hook is run.
* tabulated-list.el (tabulated-list-widen-current-column): Account
for the padding and the content width when calculating column
width (bug#53375).
Copyright-paperwork-exempt: yes
Andrew Hyatt [Thu, 20 Jan 2022 13:42:31 +0000 (14:42 +0100)]
Fix indirect font changes incorrectly affecting original buffer
* lisp/face-remap.el (face-attrs--make-indirect-safe):
(clone-indirect-buffer-hook): Set up a face remapping alist
(bug#53294).
* lisp/simple.el (clone-indirect-buffer): Move the point the hook
is run.
* src/buffer.c (Fmake_indirect_buffer, syms_of_buffer): Move the
place where the clone-indirect-buffer-hook variable is defined, so
that we can call it from C.
Jim Porter [Thu, 20 Jan 2022 13:37:54 +0000 (14:37 +0100)]
Consider subcommands when deciding to invoke Eshell command directly
When an Eshell command contains an asynchronous subcommand (such as
calling an external process), it must be evaluated iteratively. See
bug#30725.
* lisp/eshell/esh-cmd.el (eshell-invoke-command): Move most of the
logic from here...
(eshell--invoke-command-directly): ... to here. Also add checks for
subcommands.
* test/lisp/eshell/eshell-tests.el (eshell-test--max-subprocess-time):
New variable.
(eshell-wait-for-subprocess): New function.
(eshell-command-result-p): Use 'eshell-wait-for-subprocess'.
(eshell-test/interp-cmd-external): New test (bug#30725).
* lisp/help-fns.el (help-fns--insert-bindings): New function.
(help-fns--key-bindings): Split menu/key handling and output menu
bindings separately (bug#52870).
Po Lu [Thu, 20 Jan 2022 10:53:49 +0000 (10:53 +0000)]
Make system tooltips display in the menu bar on Haiku
* doc/emacs/haiku.texi (Haiku Basics): Update documentation.
* src/haiku_support.cc (Highlight): Apply the hack used for
regular menus to the menu bar as well.
* src/haikumenu.c (digest_menu_items): Set help text on menu bar
if `tooltip-mode' is t and system tooltips are used.
(syms_of_haikumenu): New symbol `tooltip-mode'.
Fchar_syntax did not convert unibyte characters to multibyte when the
current buffer was unibyte, in contrast to `char-syntax` in
byte-compiled code (bug#53260).
* src/bytecode.c (exec_byte_code): Call out to Fchar_syntax;
the dynamic frequency is too low to justify inlining here, and it
did lead to implementations diverging.
* src/syntax.c (Fchar_syntax): Convert non-ASCII unibyte values to
multibyte.
* test/src/syntax-tests.el (syntax-char-syntax): New test.
Jim Porter [Thu, 20 Jan 2022 09:35:38 +0000 (10:35 +0100)]
In Eshell, allow "-n" to suppress the trailing newline for "plain" echo
* doc/misc/eshell.texi (Built-in commands): Expand on the
documentation of echo (bug#27361).
* lisp/eshell/em-basic.el (eshell-echo): Respect OUTPUT-NEWLINE even
when 'eshell-plain-echo-behavior' is non-nil.
(eshell/echo): Add "-N" option and recommend its use over "-n" in
Lisp-friendly echo.
(eshell/printnl): Simplify; 'eshell-stringify' is equivalent to
calling 'eshell-echo' here.
Po Lu [Thu, 20 Jan 2022 09:55:07 +0000 (17:55 +0800)]
Make the undelete-frame-mode menu item a toggle
* lisp/menu-bar.el (menu-bar-file-menu): Make the undelete frame
mode option a toggle. (bug#53382)
Also enable some options that were disabled on NS, but should no
longer be since NS now supports the tab bar.
* lisp/international/textsec.el (textsec-domain-suspicious-p):
Ensure that we're not confusing the user if there's a directional
override in the string we're checking.
Make article--check-suspicious-addresses more resilient
* lisp/gnus/gnus-art.el (article--check-suspicious-addresses): Be
more resilient to junk in headers. (But all this should be rewritten
eventually, because the entire process is way too convoluted.)
Andrea Corallo [Wed, 19 Jan 2022 20:07:00 +0000 (21:07 +0100)]
Suspend temp .elc production when native compiling till when necessary
* lisp/emacs-lisp/bytecomp.el (byte-to-native-output-buffer-file):
Rename from `byte-to-native-output-file'.
(byte-write-target-file): Update.
(byte-compile-file): Write the temporary .elc only when not native
compiling.
(byte-compile-file): Kill the .elc buffer only when not native
compiling.
* lisp/emacs-lisp/comp.el (batch-byte+native-compile): Instead of just
renaming the temporary .elc make use of `byte-write-target-file' to
write it down and kill the temporary buffer.
* lisp/gnus/gnus-art.el (gnus-treat-suspicious-headers): New user
option.
(gnus-article-treat-suspicious-headers): New function.
(article-decode-encoded-words): Hook into the machinery to check
headers.
(article--check-suspicious-addresses): New function.
Mark whole-script confusables as suspicious domains
* lisp/international/textsec.el (textsec-domain-suspicious-p):
Consider domain names that are whole-script confusables with ASCII
to be suspicious. (I think this is what the Unicode standard is
recommending, but I'm not 100% sure.)
Split textsec-email-address-suspicious-p into two functions
* lisp/international/textsec.el
(textsec-email-address-suspicious-p): Made into its own function.
(textsec-email-suspicious-p): Use it and adjust doc strings.
Po Lu [Wed, 19 Jan 2022 11:06:53 +0000 (19:06 +0800)]
Port some X11 tooltip code to XCB
* configure.ac: Require `xcb-aux' to be present before using
XCB.
* src/xfns.c (x_sync):
(x_create_tip_frame):
(Fx_show_tip): Port window related code to XCB.
* lisp/international/textsec.el (textsec-name-suspicious-p):
(textsec-domain-suspicious-p):
(textsec-local-address-suspicious-p):
(textsec-name-suspicious-p):
(textsec-suspicious-nonspacing-p):
(textsec-email-suspicious-p): Suspiciosness isn't only about
homoglyphs, so don't claim so in the doc strings.
Po Lu [Wed, 19 Jan 2022 09:39:04 +0000 (17:39 +0800)]
Use Cairo XCB surfaces when XCB is available
This lets us get at goodies such as shm support, which aren't
available with the xlib surface. (bug#52120)
* configure.ac: Test for cairo-xcb if cairo is available on X.
* src/xterm.c (USE_CAIRO_XCB_SURFACE): New define.
(x_begin_cr_clip): Create XCB surfaces if available.
(x_try_cr_xlib_drawable):
(x_scroll_run): Handle XCB surfaces.
(x_term_init): Find XCB visualtype structure.
* src/xterm.h (struct x_display_info): New field `xcb_visual'.
* src/xwidget.c (x_draw_xwidget_glyph_string): Fix integer
overflow.
Eli Zaretskii [Wed, 19 Jan 2022 08:57:03 +0000 (10:57 +0200)]
Minor improvement in textsec diagnostics
* lisp/international/textsec.el (textsec-suspicious-nonspacing-p):
Clarify wording of the strings returned to explain the suspicious
use of nonspacing characters.
Po Lu [Wed, 19 Jan 2022 02:08:52 +0000 (02:08 +0000)]
Use more reliable timestamps for some kinds of events on Haiku
* src/haiku_support.cc (DispatchMessage):
(MouseMoved):
(MouseDown):
(MouseUp): Set `time' field of event structures to input server
time.
* src/haiku_support.h (struct haiku_key_event):
(struct haiku_mouse_motion_event):
(struct haiku_button_event): New field `time'.
* src/haikuterm.c (haiku_read_socket): Use input server time
if provided.
Stefan Monnier [Tue, 18 Jan 2022 21:40:32 +0000 (16:40 -0500)]
autoload.el: Fix corner case and avoid encoding issues
* lisp/emacs-lisp/autoload.el (autoload-print-form): Don't burp when
autoloading a `cl-defmethod`.
(autoload-rubric): Support non-UTF-8 chars and enforce Unix EOLs.
Add textsec functions for verifying email addresses
* lisp/international/characters.el (bidi-control-characters):
Rename from glyphless--bidi-control-characters for use in textsec,
and add LRM/RLM/ALM.
(update-glyphless-char-display): Adjust the code.
* lisp/international/textsec.el (textsec-local-address-suspicious-p)
(textsec-name-suspicious-p, textsec-suspicious-nonspacing-p)
(textsec-email-suspicious-p): New functions.
Po Lu [Tue, 18 Jan 2022 11:52:51 +0000 (19:52 +0800)]
Intern virtual modifier atoms the smart way on X
* src/xterm.c (x_find_modifier_meanings): Get rid of calls to
XInternAtom.
(x_term_init): Initialize atom refs for virtual modifiers and
make sure to only call `x_find_modifier_meanings' after they
are interned.
* src/xterm.h (struct x_display_info): New fields for virtual
modifier atoms.
Po Lu [Tue, 18 Jan 2022 08:25:02 +0000 (08:25 +0000)]
* src/haikuterm.c (haiku_read_socket): Add work for frame size bug.
BWindow::ResizeTo seems to have the same rounding issues that
BRect has, but I have no idea how to solve it there. As a
temporary workaround until a solution has been found, avoid
garbaging tooltip frames when FrameResized reports different
dimensions from what they were set to.
Po Lu [Tue, 18 Jan 2022 08:15:08 +0000 (08:15 +0000)]
Improve tooltip implementation on Haiku
This fixes several issues: tooltips having no right internal
border, reusing tooltips occasionally freezing Emacs, and
inconsistent behaviour when compared to X.
* src/haiku_support.cc (BWindow_resize): Revert a recent change.
(BView_move_frame):
(BWindow_set_avoid_focus): Stop sync'ing when locked. This
tends to cause lockups for an unknown reason.
* src/haikufns.c (initial_setup_back_buffer): New function.
(haiku_create_frame): Remove tooltip related code.
(haiku_set_internal_border_width): Handle cases where the face
cache is NULL and/or the window has not been created.
(haiku_set_inhibit_double_buffering): Likewise.
(haiku_create_tip_frame): New function.
(Fx_create_frame): Remove tooltip specific code.
(Fx_show_tip): Synchronize code with X.
* src/haikuterm.c (haiku_new_font): Don't adjust size on tooltip
frames.
(haiku_read_socket): Draw internal border on tooltip frames
during resize.
(haiku_clear_under_internal_border): Handle cases where the face
cache is NULL.
Po Lu [Tue, 18 Jan 2022 02:06:00 +0000 (02:06 +0000)]
Allow non-system tooltips to display above menus on Haiku
* doc/emacs/haiku.texi (Haiku Basics): Document that tooltips
can now be displayed above the menu bar.
* lisp/tooltip.el (tooltip-show-help): Only display help text in
the echo area if Haiku system tooltips are enabled.
* src/haiku_support.cc (FlipBuffers): Stop flushing view.
* src/haikufns.c (Fx_show_tip): Fix a sizing bug leading to
tooltips needing two redisplays to display correctly.
* src/haikuterm.c (haiku_read_socket): Ignore resize events on
tooltips.