Po Lu [Mon, 14 Mar 2022 06:48:34 +0000 (06:48 +0000)]
Clean up some Haiku toolkit code
* src/haiku_io.c (haiku_read_with_timeout): Accept `bigtime_t'
instead of `time_t' for values which are cast to bigtime_t
anyway.
* src/haiku_support.cc (BMenu_run): Read all help events instead
of just one.
* src/haiku_support.h: Update prototypes.
Po Lu [Mon, 14 Mar 2022 02:45:55 +0000 (02:45 +0000)]
Fix extraneous overscroll activation on Haiku
* src/haiku_support.cc (class EmacsScrollBar): New field
`maybe_overscroll'.
(MouseDown): Set that field.
(MouseUp): Clear that field.
(MouseMoved): Also test `maybe_overscroll' to ensure that a grab
started inside the scroll bar.
Use a dedicated stack for bytecode, instead of using the C stack.
Stack frames are managed explicitly and we stay in the same
exec_byte_code activation throughout bytecode function calls and
returns. In other words, exec_byte_code no longer uses recursion
for calling bytecode functions.
This results in better performance, and bytecode recursion is no
longer limited by the size of the C stack. The bytecode stack is
currently of fixed size but overflow is handled gracefully by
signalling a Lisp error instead of the hard crash that we get now.
In addition, GC marking of the stack is now faster and more precise.
Full precision could be attained if desired.
Pass the function object and encoded arity, not the other components.
This speeds up several call paths and is necessary for improvements to
come.
* src/bytecode.c (Fbyte_code): Make a new byte code object for
execution. This is slower but performance isn't critical here.
(exec_byte_code): Retrieve components from the passed function.
* src/eval.c (fetch_and_exec_byte_code):
* src/lisp.h (exec_byte_code): Update signature.
* test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-pipeline):
Add pattern matching output when killing a process on macOS (and
possibly other BSDs).
Visuwesh [Sun, 13 Mar 2022 05:46:38 +0000 (11:16 +0530)]
Follow contemporary practices in the Tamil input methods
* lisp/language/ind-util.el (indian-tml-base-digits-table): New table
to translate digits.
(indian-tml-base-table): Don't translate digits.
(indian-tml-itrans-digits-v5-hash): Hashtable that translates digits.
* lisp/leim/quail/indian.el (quail-tamil-itrans-compute-signs-table)
(quail-tamil-itrans-various-signs-table)
(quail-tamil-itrans-various-signs-and-digits-table): Separate out the
digits from the signs table using the function
'quail-tamil-itrans-compute-signs-table'.
(tamil-itrans-digits, tamil-inscript-digits): New input methods that
translates digits.
(tamil-itrans, tamil-inscript): Fix table inclusion.
Po Lu [Sun, 13 Mar 2022 07:22:59 +0000 (07:22 +0000)]
Improve overscrolling support on Haiku
* src/haiku_support.cc (class EmacsScrollBar): New field
`real_max_value'.
(MessageReceived): Set real max value.
(MouseMoved): Get rid of magic numbers by using real max value
instead.
Po Lu [Sun, 13 Mar 2022 06:41:58 +0000 (06:41 +0000)]
Allow dragging scroll bar for overscroll on Haiku
* src/haiku_support.cc (class EmacsScrollBar): New fields
`in_overscroll', `can_overscroll', `last_overscroll',
`last_reported_overscroll_value' and `max_value'.
(ValueChanged): Make very sure extraneous value are not
generated.
(MouseUp): Clear overscroll if enabled.
(MouseMoved): If overscroll is enabled and dragging downwards
fails to dislodge the maximum value, enable overscrolling.
(BView_scroll_bar_update): New parameter `can_overscroll'
* src/haiku_support.h: Update prototypes.
* src/haikuterm.c (haiku_set_scroll_bar_thumb)
(haiku_set_horizontal_scroll_bar_thumb): Adjust parameters to
scroll bar update functions.
(haiku_read_socket): Take ceiling of bar position if
horizontal.
Stefan Monnier [Sun, 13 Mar 2022 04:51:22 +0000 (23:51 -0500)]
Flocate_file_internal: Protect from `.eln` remapping
Don't use `openp`s functionality to remap `.elc` files to `.eln` files
since `locate-file` is not specific to ELisp files.
This should be not just simpler but more robust than the current
hack which tries to undo the damage after the fact.
Po Lu [Sun, 13 Mar 2022 01:28:58 +0000 (09:28 +0800)]
Improve reliaibility of scroll bar dimensions adjustment on GTK 3
* src/gtkutil.c (xg_scroll_bar_size_allocate_cb): New function.
(xg_finish_scroll_bar_creation): Attach new signal.
(xg_update_scrollbar_pos)
(xg_update_horizontal_scrollbar_pos): Also set window dimensions
for the event box.
* src/xterm.c (x_scroll_bar_configure): New function.
* src/xterm.h: Update prototypes.
Colin Woodbury [Sat, 12 Mar 2022 17:46:55 +0000 (18:46 +0100)]
* lisp/progmodes/python.el: Account for new keywords.
* lisp/progmodes/python.el (python-font-lock-keywords-level-2): As
of Python 3.10, Python has structured pattern matching. This adds
two new keywords which need to be highlighted (bug#54345).
* src/bytecode.c (BYTE_CODES, enum byte_code_op, exec_byte_code):
Don't display custom messages in debug mode for Bscan_buffer and
Bset_mark which were removed long ago.
* src/bytecode.c (FETCH2):
Use `|` instead of `+` to combine the bytes forming a 16-bit immediate
argument so that GCC (prior to version 12) recognises the idiom and
generates a 16-bit load. This applies for little-endian machines with
cheap unaligned accesses such as x86[-64], arm64 and power64le.
This 1-character change results in a measurable speed gain on many
kinds of Lisp code, as 16-bit immediates are used by all jump
instructions.
Clang performs this optimisation for both `+` and `|` from version 10.
* src/eval.c (grow_specpdl_allocation): Make non-static.
(grow_specpdl, record_in_backtrace): Move from here...
* src/lisp.h (grow_specpdl, record_in_backtrace): ... to here,
and declare inline.
Po Lu [Sat, 12 Mar 2022 12:33:18 +0000 (20:33 +0800)]
Try really hard to make GTK 3 scroll bars fit
* src/gtkutil.c (xg_get_widget_from_map): New argument DISPLAY.
All callers changed.
(find_scrollbar_cb): New function.
(xg_finish_scroll_bar_creation, xg_remove_scroll_bar)
(xg_update_scrollbar_pos, xg_update_horizontal_scrollbar_pos)
(xg_set_toolkit_scroll_bar_thumb)
(xg_set_toolkit_horizontal_scroll_bar_thumb, xg_initialize):
Stop using id_to_widget_map on X builds with GTK 3 and set the
event box as the x_window instead.
* src/xterm.c (x_window_to_scroll_bar): Don't look for ID on GTK
3.
(handle_one_xevent): If a ConfigureNotify event is found for a
scroll bar and the dimensions are wrong, resize the X window to
the right ones.
Eli Zaretskii [Sat, 12 Mar 2022 08:28:45 +0000 (03:28 -0500)]
; Fix data structures in authors.el
* admin/authors.el (authors-aliases, authors-renamed-files-alist):
Update and correct the databases.
(authors-renamed-files-alist): Add commentary explaining how to
add entries for renamed/moved files.
(authors-canonical-file-name): Clarify the semantics of the
arguments.
Po Lu [Sat, 12 Mar 2022 00:46:39 +0000 (00:46 +0000)]
Slightly improve scrollbar position accounting on Haiku
* src/haiku_support.cc (MessageReceived): Use floats for
calculating portion and subtract proportion directly.
* src/haikuterm.c (haiku_set_scroll_bar_thumb): Take ceiling of
value instead of rounding it.
Po Lu [Fri, 11 Mar 2022 10:44:33 +0000 (10:44 +0000)]
Improve scroll bar treatment on Haiku
* src/haiku_support.cc (MessageReceived): Subtract portion from
range of scroll bar.
* src/haikuterm.c (BE_SB_MAX): Adjust values for better
rounding.
(haiku_set_scroll_bar_thumb): Round values instead of
truncating them.
Po Lu [Fri, 11 Mar 2022 08:56:54 +0000 (08:56 +0000)]
Fix inconsistent thumb position on Haiku scroll bars
* src/haikuterm.c (haiku_set_scroll_bar_thumb): If
scroll_bar_adjust_thumb_portion is nil, directly calculate thumb
portions without setting page_size.
Po Lu [Fri, 11 Mar 2022 01:33:24 +0000 (01:33 +0000)]
Fix scroll bar portion on Haiku scroll bars
* src/haiku_support.cc (EmacsScrollBar): Set steps to
appropriate value.
(ValueChanged): Test new value against old value before sending
value event.
(MessageReceived): Handle portion and range.
(BView_scroll_bar_update): New argument for portion.
* src/haiku_support.h: Update prototypes.
* src/haikuterm.c (haiku_set_scroll_bar_thumb):
(haiku_set_horizontal_scroll_bar_thumb): New functions.
(haiku_set_horizontal_scroll_bar):
(haiku_set_vertical_scroll_bar): Use those functions to set
scroll bar values.
(haiku_read_socket): Handle new meanings of scroll bar values.
* src/haikuterm.h (struct scroll_bar):
Eli Zaretskii [Thu, 10 Mar 2022 18:26:13 +0000 (20:26 +0200)]
Fix regression in 'custom-prompt-customize-unsaved-options'
* lisp/cus-edit.el (custom-prompt-customize-unsaved-options):
Don't depend on the value returned by 'customize-unsaved'. Fix
the doc string. Patch by Sebastian Miele <iota@whxvd.name>.
(Bug#54329)
Michael Albinus [Thu, 10 Mar 2022 11:31:22 +0000 (12:31 +0100)]
Support remote home directories via connection property
* doc/misc/tramp.texi (Home directories): New section.
(Top, Usage): Add it to the menue.
(Predefined connection information): Mention "~".
(Multi-hops, File name syntax): Fix typos.
* lisp/net/tramp.el (tramp-handle-expand-file-name): Check for
remote home directory. (Bug#53847)
Po Lu [Thu, 10 Mar 2022 03:48:12 +0000 (11:48 +0800)]
Fix menu bar activation on PGTK
* src/gtkutil.c (menu_bar_button_pressed_cb): Only update menu
bar if no menu is active, and the event window is not the widget
window itself. Also make menu in use.
* src/pgtkmenu.c (popup_deactivate_callback): Make menu not in
use.
* src/xdisp.c (redisplay_internal): Return if popup_activated
also on PGTK.
Po Lu [Wed, 9 Mar 2022 13:29:17 +0000 (21:29 +0800)]
Make XInput 2 features work on GTK 2 builds
* src/xfns.c (setup_xi_event_mask): On GTK 2, select for
button, motion, entry/exit and key events.
* src/xmenu.c (create_and_show_popup_menu): Clear XI grab if
appropriate.
* src/xterm.c (handle_one_xevent): Pass some kinds of input
extension events to GTK manually on versions of GTK+ that don't
understand them.
Po Lu [Wed, 9 Mar 2022 03:21:36 +0000 (03:21 +0000)]
Improve handling of tooltips inside menus on Haiku
* src/haiku_support.cc (BMenu_run): Make
`process_pending_signals_function' return a struct timespec.
* src/haiku_support.h: Update prototypes.
* src/haikumenu.c (haiku_process_pending_signals_for_menu):
Return result of `timer_run'.
* src/haikuterm.c (haiku_flush): Flip buffers if frame is dirty.
Paul Eggert [Wed, 9 Mar 2022 02:46:47 +0000 (18:46 -0800)]
Decouple mod-test.c from Gnulib
mod-test.c should not use Gnulib code, as that creates
unnecessary coupling between Emacs internals and this test module.
Also Gnulib code is compiled without -fPIC whereas mod-test.c
needs -fPIC and recompiling Gnulib with -fPIC would be too painful.
* src/Makefile.in (LIB_NANOSLEEP): New macro.
(LIBES): Use it.
* test/Makefile.in (REPLACE_FREE, FREE_SOURCE_0, FREE_SOURCE_0):
Remove. All uses removed.
(LIB_CLOCK_GETTIME, LIB_NANOSLEEP): New macros.
(MODULE_CFLAGS): Do not -I from lib as that would include Gnulib
modifications to standard .h files (e.g., "#define nanosleep
rpl_nanosleep") and we don’t want the Gnulib replacements.
Instead, for gmp.h (on platforms lacking <gmp.h>) simply '-I.'
with a suitable gmp.h.
(gmp.h): New rule to create a suitable gmp.h.
($(test_module)): Depend on config.h since the code uses config.h.
Depend on gmp.h if we need to create a suitable one.
If compiling mini-gmp.h, compile the original one and not
the Emacs-specific one, to lessen coupling with Emacs internals.
Link with LIB_CLOCK_GETTIME and LIB_NANOSLEEP.
(clean): Remove gmp.h.
* test/src/emacs-module-resources/mod-test.c: Don’t include timespec.h.
All uses of timespec.h APIs changed to use system-supplied APIs.
Change _Static_assert to plain assert, so that we needn’t rely
on Gnulib’s _Static_assert.
(timespec_le) [CLOCK_REALTIME]: New function.
Change use of timespec_cmp changed to use this instead.
(Fmod_test_sleep_until, Fmod_test_nanoseconds):
Define these functions and their Lisp names mod-test-sleep-until
and mod-test-nanoseconds only if CLOCK_REALTIME,
since they now won’t work on platforms lacking CLOCK_REALTIME.
(Fmod_test_nanoseconds): Just use _Static_assert since it
should work on all platforms.
* test/src/emacs-module-tests.el (mod-test-sleep-until)
(mod-test-nanoseconds, mod-test-double):
Skip test if the corresponding functione is not defined.
Paul Eggert [Wed, 9 Mar 2022 02:46:47 +0000 (18:46 -0800)]
Do not include <attribute.h> from <config.h>
This is because mod-test.c shouldn’t use source code from lib,
but it does need to include <config.h>.
* lib-src/ebrowse.c, lib-src/emacsclient.c, lib-src/etags.c:
* lib-src/make-docfile.c, lib-src/movemail.c:
* lib-src/seccomp-filter.c, src/dynlib.h, src/lisp.h:
* src/syssignal.h, src/sysstdio.h, src/systhread.h, src/tparam.h:
Include <attribute.h>.
* src/conf_post.h: Do not include <attribute.h>.
All uses of attribute.h macros replaced with their _GL_ equivalents.
* lisp/eshell/esh-var.el (eshell-parse-variable-ref): Use
'eshell-unescape-inner-double-quote' and improve robustness of quoted
variable name matching.
(eshell-parse-indices): Use 'eshell-unescape-inner-double-quote'.
* doc/misc/eshell.texi (Dollars Expansion): Improve wording of
subscript notation.