Michael Albinus [Wed, 16 Feb 2022 19:22:45 +0000 (20:22 +0100)]
Fix problem with file-modification-time in tramp-sshfs.el
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-handle-file-notify-add-watch',
`tramp-handle-file-notify-rm-watch' and
`tramp-handle-file-notify-valid-p'.
(tramp-sshfs-handle-write-region): Set file modification time.
(Bug#54016)
* test/lisp/net/tramp-tests.el (tramp--test-asynchronous-processes-p):
Filter out tramp-adb on multi-byte `default-directory'.
(tramp--test-hpux-p, tramp--test-macos-p): Protect against errors.
(tramp--test-check-files): Discriminate also tramp-sshfs.el.
Eli Zaretskii [Wed, 16 Feb 2022 15:07:58 +0000 (17:07 +0200)]
Add support for Tai Tham script
* lisp/international/fontset.el (setup-default-fontset)
(script-representative-chars): Add tai-tham.
* lisp/language/thai.el ("Northern Thai"): New language
environment. Patch by Richard Wordingham
<richard.wordingham@ntlworld.com>. Set
'composition-function-table' for the Tai Tham block. Original
code by Richard Wordingham <richard.wordingham@ntlworld.com>.
* etc/HELLO: Add Northern Thai greeting.
* etc/NEWS: Announce addition of Northern Thai language environment.
This function is used in many places to calculate the length of
a unibyte string converted to multibyte.
* src/character.c (count_size_as_multibyte): Move the overflow test
outside the loop, which makes it much faster. Standard compilers
will even vectorise it if asked to (-O2 in Clang, -O3 in GCC).
* test/src/emacs-module-tests.el (module/describe-function-1):
Prevent string mismatch caused by line breaks after filling;
the macOS dynamic library suffix (.dylib) is longer than on other
platforms.
Po Lu [Wed, 16 Feb 2022 07:40:39 +0000 (15:40 +0800)]
Fix frame focus handling with native input
* lisp/term/x-win.el (x-gtk-use-native-input-watcher): Stop
passing frame parameter to `x-internal-focus-input-context'.
* src/xfns.c (Fx_internal_focus_input_context): Focus all focus
frames from all displays.
Po Lu [Wed, 16 Feb 2022 02:10:13 +0000 (10:10 +0800)]
Don't decode text within XIM callbacks or handle_one_xevent
* src/keyboard.c (kbd_buffer_get_event_1):
(kbd_buffer_get_event_2): New functions.
(kbd_buffer_get_event): Accept a new meaning of
MULTIBYTE_CHAR_KEYSTROKE_EVENT where .arg can be a unibyte
string to be decoded in the locale coding system.
* src/termhooks.h (enum event_kind): Document new meaning of
.arg in a multibyte keystroke event.
* src/xfns.c (struct x_xim_text_conversion_data): New struct.
(x_xim_text_to_utf8_unix_1):
(x_xim_text_to_utf8_unix_2): New functions.
(x_xim_text_to_utf8_unix): Handle decode failure correctly.
(xic_preedit_draw_callback): Abort IM context if text could not
be decoded correctly.
* src/xterm.c (handle_one_xevent): Utilize new meaning of
MULTIBYTE_CHAR_KEYSTROKE_EVENT.
Michael Albinus [Tue, 15 Feb 2022 15:15:55 +0000 (16:15 +0100)]
Some Tramp cleanup
* doc/misc/tramp.texi (Remote processes): Add also tramp-sshfs.el.
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
Error-out for multi-byte `default-directory'.
* lisp/net/tramp.el (tramp-tolerate-tilde): Move it up.
(tramp-handle-abbreviate-file-name): Use it.
(tramp-read-passwd): Show literal passphrase prompt.
Po Lu [Tue, 15 Feb 2022 07:27:31 +0000 (07:27 +0000)]
Fix parsing of some semibold font styles on Haiku
* src/haiku_font_support.cc (font_style_to_flags): Accept
"Semibold" to mean SemiBold as well. Reported by
augiedoggie <augiedoggie@users.noreply.github.com>.
Po Lu [Tue, 15 Feb 2022 01:19:12 +0000 (09:19 +0800)]
Better handle devices being enabled on XI2
* src/xterm.c (handle_one_xevent): Don't abort on DeviceChanged
if the device couldn't be found, instead regenerating the device
hierarchy to see if it was enabled.
Eric Abrahamsen [Tue, 15 Feb 2022 00:06:14 +0000 (16:06 -0800)]
Fix docstring and init of Gnus search -remove-prefix options
* lisp/gnus/gnus-search.el (*-remove-prefix): For all engine defaults,
remove incorrect docs stating this is a regexp (it's a string). Also,
use `expand-file-name' to get the correct default value, not `concat'
and (getenv "HOME").
Eric Abrahamsen [Mon, 14 Feb 2022 23:11:37 +0000 (15:11 -0800)]
Fix manual documentation of Gnus tool bars
* doc/misc/gnus.texi: The options `gnus-use-toolbar',
`gnus-toolbar-thickness', and `gnus-summary-mail-toolbar' no longer
exist. Other options in this section have been renamed from "toolbar"
to "tool-bar".
Eli Zaretskii [Mon, 14 Feb 2022 17:23:28 +0000 (19:23 +0200)]
Improve recent addition to documentation of face remapping
* doc/lispref/display.texi (Basic Faces): Make the list of basic
faces more complete.
(Face Remapping): Improve wording of a recent addition; add
cross-reference to "Basic Faces".
* lisp/abbrev.el (abbrev-table-p): Ignore the error.
* src/lread.c (oblookup): Signal `wrong-type-argument' instead of
`error' if it turns out that we're not really in an obarray (bug#53988).
Po Lu [Mon, 14 Feb 2022 10:17:58 +0000 (10:17 +0000)]
Improve Haiku selection handling
* lisp/select.el (gui--selection-value-internal): Use X types on
Haiku as well.
* lisp/term/haiku-win.el (haiku--selection-type-to-mime): Update
types to correspond better with X.
* src/haikuselect.c (Fhaiku_selection_data):
(Fhaiku_selection_put): Remove a great deal of ad hoc code now
handled by the regular selection machinery.
Add a mechanism for querying before executing a command
* doc/emacs/custom.texi (Disabling): Document it.
* doc/lispref/commands.texi (Disabling Commands): Document the
low-level stuff.
* lisp/simple.el (command-execute): Respect the `(query ...)'
value for `disabled'.
(command-execute--query): New function.
(command-query): New function.
Po Lu [Mon, 14 Feb 2022 06:05:46 +0000 (14:05 +0800)]
* etc/TODO: Update some entires related to macOS and NS.
Xwidgets have worked on NS for a long time, "smooth scrolling"
is now available as `pixel-scroll-precision-mode' for all GUI
platforms, and some mouse gestures have been implemented on NS
and X.
Po Lu [Mon, 14 Feb 2022 05:13:13 +0000 (13:13 +0800)]
Ensure bad values don't leak into scroll valuators after DeviceChange
* src/xterm.c (xi_reset_scroll_valuators_for_device_id): New
argument `pending_only'.
(handle_one_xevent): Reset pending scroll valuators on XI_Enter
and mark valuators updated via DeviceChanged events as pending.
* src/xterm.h (struct xi_scroll_valuator_t): New field
`pending_enter_reset'.
Po Lu [Mon, 14 Feb 2022 03:51:22 +0000 (11:51 +0800)]
Restore valuator values after receiving a DeviceChanged event
* src/xterm.c (x_init_master_valuators): Generate valuators for
both master and slave devices.
(handle_one_xevent): Find current valuator info and use that to
populate scroll valuators after a device changed.
Po Lu [Mon, 14 Feb 2022 03:16:38 +0000 (11:16 +0800)]
Improve efficency of handling DeviceChanged events
* src/xterm.c (handle_one_xevent): Just update the device that
was changed on DeviceChanged and only do hierarchy recalculation
upon HierarchyChanged events.
* lisp/simple.el (count-words-region): Adjust callers.
(count-words): If given a prefix, give totals (bug#9959).
(count-words--buffer-format, count-words--format): Rename and
don't message, but return the string.
Bob Rogers [Sun, 13 Feb 2022 08:32:13 +0000 (09:32 +0100)]
Fix ietf-drums-remove-whitespace unmatched " and (
* lisp/mail/ietf-drums.el:
+ (ietf-drums-skip-comment): New helper function.
+ (ietf-drums-remove-comments): Use ietf-drums-skip-comment.
+ (ietf-drums-remove-whitespace): Handle unterminated quotes and
comments, as ietf-drums-remove-comments already does.
* test/lisp/mail/ietf-drums-tests.el:
+ Test unterminated quote and comment for
ietf-drums-remove-whitespace and ietf-drums-remove-comments (bug#53965).
Po Lu [Sun, 13 Feb 2022 03:29:44 +0000 (11:29 +0800)]
Work around tooltip bug on new versions of WebKitGTK
* src/xwidget.c (dummy_tooltip_string): New variable.
(xw_maybe_synthesize_crossing): Call `xg_prepare_tooltip' to
disable tooltips on WebKitGTK 2.34 or later.
(syms_of_xwidget): Make dummy string.
Po Lu [Sun, 13 Feb 2022 03:00:52 +0000 (11:00 +0800)]
Stop quering for Xinerama inside x_get_monitor_attributes
* src/xfns.c (x_get_monitor_attributes): Remove Xinerama check
and use xinerama_supported_p instead.
* src/xterm.c (x_term_init): Set `xinerama_supported_p'
* src/xterm.h (struct x_display_info): New field
`xinerama_supported_p'.
Po Lu [Sun, 13 Feb 2022 00:39:24 +0000 (08:39 +0800)]
Fix last change in xterm.c
* src/xterm.c (x_update_opaque_region): Remove check that f is
non-NULL.
(handle_one_xevent): If f is NULL and the configure event is for
any's edit widget, use that instead.
Stefan Monnier [Sat, 12 Feb 2022 20:25:53 +0000 (15:25 -0500)]
Rewrite thread context switch code (bug#48990)
Make the context switch code handle buffer-local variables more
correctly by reusing the code originally written for `backtrace-eval`.
This has the side benefit of making the `saved_value` field unused.
* src/eval.c (specpdl_saved_value): Delete function.
(specbind): Delete the code related to `saved_value`, and consolidate
common code between the different branches.
(rebind_for_thread_switch, -unbind_for_thread_switch): Move to `thread.c`.
(specpdl_unrewind): New function, extracted from `backtrace_eval_unrewind`.
Use `SET_INTERNAL_THREAD_SWITCH`. Skip the buffer & excursion unwinds
depending on new arg `vars_only`.
(backtrace_eval_unrewind): Use it.
(mark_specpdl): Don't mark `saved_value`.
* src/thread.c (rebind_for_thread_switch, unbind_for_thread_switch):
Move from `eval.c` and rewrite using `specpdl_unrewind`.
* test/src/thread-tests.el (threads-test-bug48990): New test.
* test/Makefile.in (test_template): Add a + as suggested by make:
"warning: jobserver unavailable: using -j1. Add '+' to parent make rule".
Eli Zaretskii [Sat, 12 Feb 2022 18:38:51 +0000 (20:38 +0200)]
Optionally allow point to enter composed character sequences
This changeset is based on code originally posted by
Kenichi Handa <handa@gnu.org> as part of discussing bug#20140,
with a few adjustments and changes, mainly to support R2L
text and provide a user option to control the feature.
* src/xdisp.c (compute_stop_pos, next_element_from_buffer)
(composition_reseat_it): Don't allow auto-composing characters
past point when 'composition-break-at-point' is non-nil.
(syms_of_xdisp) <composition-break-at-point>: New boolean variable.
(redisplay_internal, redisplay_window): Disable "just move the
cursor" optimizations when 'composition-break-at-point' is non-nil.
* src/keyboard.c (command_loop_1): Force redisplay when
'composition-break-at-point' is non-nil.
* lisp/cus-start.el (standard): Provide customization form for
'composition-break-at-point'.
SPECPDL_INDEX becomes much faster because the pointer subtraction,
expensive because of the inconveniently sized specpdl records, is now
gone. This translates to a useful speedup on a wide variety of code.
* src/lisp.h (specpdl_ref, wrap_specpdl_ref, unwrap_specpdl_ref):
Rename member.
(specpdl_count_to_ref, specpdl_ref_to_count)
(specpdl_ref_add, specpdl_ref_to_ptr, SPECPDL_INDEX):
Count offset in bytes rather than in records.
Wrap the specpdl_ref contents in a struct, which gives us some very
useful type checking to make sure that all code that assumed integral
specpdl refs has been converted.
We only do this on 64-bit platforms, since those tend to have modern
ABIs where small structs are optimised as scalars. In other words,
this change should not affect the compiled code.
* src/lisp.h (specpdl_ref): Now a struct on 64-bit platforms.
(wrap_specpdl_ref, unwrap_specpdl_ref): New.
(specpdl_count_to_ref, specpdl_ref_to_count)
(specpdl_ref_eq, specpdl_ref_lt)
(specpdl_ref_valid_p, make_invalid_specpdl_ref): Use new wrappers.
Replace ptrdiff_t with new specpdl_ref type for specpdl references
The specpdl_ref type is just an alias for ptrdiff_t; the compiled code
remains the same. All operations on specpdl_ref (arithmetic,
comparison etc) now go through inline functions.
The bulk of the change is almost completely mechanical. It is done to
prepare for a type-safe representation and subsequent performance
improvement.
Po Lu [Sat, 12 Feb 2022 12:25:00 +0000 (20:25 +0800)]
Fix entry and exit events with XI2 grabs on X toolkit menus
* src/xmenu.c (popup_get_selection): Only claim cookie if new
event will be generated.
(create_and_show_popup_menu): Ungrab XI2 device, then
immediately set core grab on the frame's edit widget window.
* src/xterm.c (handle_one_xevent): Use x_any_window_to_frame to
find exit event frame if a popup menu is active.
Po Lu [Sat, 12 Feb 2022 04:42:42 +0000 (04:42 +0000)]
Implement visual bell on Haiku like on X
* src/haiku_draw_support.cc
(BView_FillRectangleForVisibleBell): Delete function.
(BView_InvertRect): New function.
* src/haiku_support.cc (class EmacsView): Delete field
`visible_bell_color' and visible bell related methods.
(EmacsView_do_visible_bell): Delete function.
* src/haiku_support.h: Update prototypes.
* src/haikuterm.c (haiku_flash): Implement using
`BView_InvertRect'.
(haiku_beep): Use `haiku_flash' instead.
* doc/lispref/compile.texi (Speed of Byte-Code): More representative
numbers for byte code; the difference is much greater today.
(Compilation Functions, Disassembly): Example output for lexbind
bytecode.
Andrew G Cohen [Fri, 11 Feb 2022 07:09:46 +0000 (15:09 +0800)]
Allow searching of nnselect (search) groups
* lisp/gnus/gnus-group.el (gnus-group-make-search-group):
(gnus-group-read-ephemeral-search-group): Ensure the server is
correctly identified even for nnselect groups.
* lisp/gnus/gnus-search.el (gnus-search-nnselect): New function.
(gnus-search-default-engines): Use it.
(gnus-search-make-spec): Queries from nnselect should always be raw.
* lisp/gnus/nnselect.el (gnus-search): Silence the byte-compiler.
Po Lu [Fri, 11 Feb 2022 05:44:42 +0000 (13:44 +0800)]
Set _NET_WM_OPAQUE_REGION on non-GTK3 toolkits when using 32 bit visual
* src/xfns.c (x_set_alpha_background): Set opaque region if
opaque.
* src/xterm.c (x_update_opaque_region): New parameter
`configure'. All callers changed.
(handle_one_xevent): Call `x_update_opaque_region' on configure
events.
Po Lu [Fri, 11 Feb 2022 02:37:38 +0000 (02:37 +0000)]
Improve reliability of selection ownership on Haiku
* src/haiku_select.cc (count_clipboard, count_primary)
(count_secondary): Initialize to -1
(BClipboard_set_system_data)
(BClipboard_set_primary_selection_data)
(BClipboard_set_secondary_selection_data): Store count before
saving to the the clipboard.
(BClipboard_owns_clipboard, BClipboard_owns_primary)
(BClipboard_owns_secondary): Adjust tests accordingly.