* src/sort.c (gallop_left, gallop_right): Don't test Lisp values for
being nonzero; it only made sense when `key` was a pointer that had to
be non-null.
* src/sort.c (tim_sort): If the sort predicate is a symbol, find the
corresponding function before starting the sort. This is especially
beneficial if the predicate was an alias (`string<`, for example).
Andrew G Cohen [Wed, 16 Mar 2022 14:06:49 +0000 (22:06 +0800)]
; Minor improvements to timsort
* src/fns.c (sort_list, sort_vector): Improve documentation and
variable names.
(merge): Replace function inorder with direct use of call2.
* src/lisp.h: Remove inorder prototype.
* src/sort.c:
(struct reloc): Document the order field.
(inorder): Uppercase INLINE.
(binarysort): Move type declaration.
(needmem): New INLINE function.
(merge_lo, merge_hi): Use it.
(merge_getmem): Remove unnecessary if.
(tim_sort): Remove unnecessary if.
(reverse_vector): Shift instead of integer divide by 2.
Add optional GC marking function to specpdl unwind_ptr record
Add a new `record_unwind_protect_ptr_mark` function for use with C data
structures that use the specpdl for clean-up but also contain possibly
unique references to Lisp objects.
* src/eval.c (record_unwind_protect_ptr_mark): New.
(record_unwind_protect_module, set_unwind_protect_ptr):
Set the mark function to NULL.
(mark_specpdl): Call the mark function if present.
* src/lisp.h (unwind_ptr): Add a mark function pointer to the
SPECPDL_UNWIND_PTR case.
Paul Eggert [Sat, 5 Mar 2022 03:21:38 +0000 (19:21 -0800)]
Fix process-attributes time precision on BSD
* src/sysdep.c (timeval_to_timespec) [__FreeBSD__ || DARWIN_OS]:
Remove; no longer needed.
(make_lisp_s_us) [__FreeBSD__ || DARWIN_OS || __OpenBSD__]:
New function.
(make_lisp_timeval) [__FreeBSD__ || DARWIN_OS || __OpenBSD__]:
Rework in terms of make_lisp_s_us.
(system_process_attributes) [__FreeBSD__ || DARWIN_OS ||
__OpenBSD__]: Simplify by using the above. This fixes some minor
problems where timestamps promised more precision than was
actually available.
Paul Eggert [Sat, 5 Mar 2022 03:21:38 +0000 (19:21 -0800)]
Fix process-attributes time precision on GNU/Linux
* src/sysdep.c [GNU_LINUX]:
(time_from_jiffies): Simplify by using time-convert. Change args
and result type. All uses changed.
(ltime_from_jiffies): Remove; call time_from_jiffies instead.
(put_jiffies): New function.
(get_up_time): Return Lisp_Object not struct timespec.
All uses changed. Simplify by using time-add.
(system_process_attributes): Simplify by using the above.
This fixes some minor problems where timestamps promised more
precision than was actually available. When info is not
available (e.g., sysconf fails) do not place it into the alist.
* src/timefns.c (float_time): Now extern.
Po Lu [Sat, 5 Mar 2022 02:44:26 +0000 (10:44 +0800)]
Remove render code in x_scroll_run and drop NoExpose events instead
* src/xterm.c (x_scroll_run): Stop avoiding NoExpose events
through XRenderComposite.
(handle_one_xevent): Drop NoExpose events to placate some code
in Athena widgets.
Dmitry Gutov [Sat, 5 Mar 2022 02:32:54 +0000 (04:32 +0200)]
project-shell: Ensure the resulting buffer is live
* lisp/progmodes/project.el (project-shell):
Make sure to recreate the shell if the buffer exists but not live
(https://lists.gnu.org/archive/html/emacs-devel/2022-03/msg00017.html).
Stefan Monnier [Fri, 4 Mar 2022 17:18:41 +0000 (12:18 -0500)]
trace.el: Preserve the line structure
Print newlines appearing inside values (i.e. inside strings) as \n
rather than actual newlines so as to avoid messing up the main
structure of the trace buffer.
* doc/misc/info.texi (Emacs Info Variables): Mention
Info--default-directory-list.
* lisp/info.el (Info-default-directory-list): Default to nil to
avoid statting directories on Emacs startup (bug#27933).
(Info--default-directory-list): Factored out into own function.
(Info-default-dirs): Append value of Info-default-directory-list
to the value returned from Info--default-directory-list.
Andrew G Cohen [Fri, 4 Mar 2022 08:20:01 +0000 (16:20 +0800)]
Turn expiry on for nnselect groups
Articles in (persistent) groups from the gnus/nnselect backend will
now be run through the expiry process upon exit, like other persistent
groups. Expiry is not on by default for ephemeral nnselect groups but
may be turned on with nnselect-allow-ephemeral-expiry set to t.
* lisp/gnus/nnselect.el (nnselect-request-expire-articles): Make
article expiry work.
(nnselect-allow-ephemeral-expiry): New variable.
* doc/misc/gnus.texi (Creating Search Groups): Document
nnselect-allow-ephemeral-expiry.
Po Lu [Fri, 4 Mar 2022 01:42:33 +0000 (09:42 +0800)]
Pass core scroll wheel events outside the edit widget to Emacs on GTK
* src/xterm.c (x_construct_mouse_click): Translate coordinates
if the event window is not the edit widget window.
(handle_one_xevent): Treat core scroll wheel events specially,
if mouse_or_wdesc_frame did not find the frame.
Po Lu [Fri, 4 Mar 2022 00:52:18 +0000 (00:52 +0000)]
Merge from origin/emacs-28
29ff903bb0 Avoid crashes when fringe bitmaps are defined in daemon mode 92e2d19fe7 One more fix of the BPA implementation cd51d9c7ab Fix handling of brackets in BPA
Eli Zaretskii [Thu, 3 Mar 2022 18:31:33 +0000 (20:31 +0200)]
Avoid crashes when fringe bitmaps are defined in daemon mode
* src/dispextern.h (gui_define_fringe_bitmap): Add prototype.
(max_used_fringe_bitmap): Add declaration.
* src/fringe.c (gui_define_fringe_bitmap): New function.
* src/w32term.c (w32_draw_fringe_bitmap):
* src/xterm.c (x_draw_fringe_bitmap) [USE_CAIRO]: Call
'gui_define_fringe_bitmap' if the terminal-specific bitmap data is
not available when a fringe bitmap is about to be drawn. Don't
try to draw a bitmap that is not known to fringe.c. (Bug#54183)
Jim Porter [Wed, 2 Mar 2022 02:36:08 +0000 (18:36 -0800)]
Fix parsing of indices in Eshell expansions
Previously, more-complex index expansions, like '$var[":" 0]' or
'$var[$(expr) 0]' failed to parse correctly.
* lisp/eshell/esh-var.el (Commentary): Clarify indexing and length
expansions.
(eshell-parse-indices): Expand docstring and support parsing inside
double-quotes.
(eshell-eval-indices): New function.
(eshell-parse-variable): Use it.
Jim Porter [Sun, 27 Feb 2022 04:55:22 +0000 (20:55 -0800)]
Add a new macro to simplify parsing temporary Eshell command strings
This abstracts out the somewhat-unusual "insert&delete" logic in
'eshell-parse-command' so that it can be used elsewhere, and also
ensures that the deletion occurs even if an an error occurs.
* lisp/eshell/esh-cmd.el (eshell-with-temp-command): New macro.
(eshell-parse-command): Use it.
Eli Zaretskii [Thu, 3 Mar 2022 13:53:04 +0000 (15:53 +0200)]
One more fix of the BPA implementation
* src/bidi.c (bidi_find_bracket_pairs): Disable BPA optimization
when there are no strong directional characters inside the
bracketed pair. (Bug#54219)
Eli Zaretskii [Thu, 3 Mar 2022 12:46:20 +0000 (14:46 +0200)]
Fix handling of brackets in BPA
* src/bidi.c (bidi_resolve_brackets): Fix implementation of UBA's
N0 rule when there are no strong directional characters inside the
bracketed pair. (Bug#54219)
Dmitry Gutov [Thu, 3 Mar 2022 03:23:26 +0000 (05:23 +0200)]
Cache the backend value together with the project root
* lisp/progmodes/project.el (project-try-vc):
Cache the backend value together with the root.
(project-root, project-files, project-ignores):
Update to access the new data structure.
Po Lu [Wed, 2 Mar 2022 11:00:21 +0000 (19:00 +0800)]
Fix reporting of imaginary key prefixes on toolkit tool and menu bars
* src/keyboard.c (make_lispy_position): Set imaginary prefix if
the terminal says what widget the position is on top of.
* src/termhooks.h (struct terminal): New field
`toolkit_position_hook'.
* src/xterm.c (x_toolkit_position): New function.
(x_create_terminal): Register hook.
Po Lu [Tue, 1 Mar 2022 11:15:46 +0000 (19:15 +0800)]
Fix crashes and other bugs on LessTif
* lwlib/lwlib-Xm.c (make_menu_in_widget): XmIsRowColumn is
broken on the latest LessTif release, so avoid that here.
* src/xfns.c (x_window): Add PropertyChangeMask which LessTif
doesn't do itself.
Po Lu [Tue, 1 Mar 2022 10:38:08 +0000 (18:38 +0800)]
Fix reporting of wheel events on top of GTK scroll bars
* src/gtkutil.c (xg_update_scrollbar_pos):
(xg_update_horizontal_scrollbar_pos): Stop ensuring the window
is native.
(xg_event_is_for_scrollbar): New variable `for_valuator'.
All callers changed.
* src/gtkutil.h: Update prototypes.
* src/xterm.c (handle_one_xevent): Drop all valuator change
events destined for scroll bars.
Po Lu [Tue, 1 Mar 2022 06:59:32 +0000 (14:59 +0800)]
Avoid duplicate wheel and button events on non-toolkit scroll bars
* src/xterm.c (x_scroll_bar_create): Set appropriate input
extension event mask.
(handle_one_xevent): Move some ifdefs around and handle input
extension button events on scroll bars.
Po Lu [Tue, 1 Mar 2022 06:44:02 +0000 (14:44 +0800)]
Fix old X menu on builds with XI2
* oldXMenu/Activate.c (XMenuActivateSetTranslateFunction): New
function.
(XMenuActivate): Handle generic events.
* oldXMenu/XMenu.h: New prototypes.
(Translate_func): New type.
* src/xmenu.c (x_menu_wait_translate_generic_event): New
function.
(x_menu_show): Set translate function.
Po Lu [Tue, 1 Mar 2022 05:48:36 +0000 (13:48 +0800)]
Fix C-g inside toolkit file dialogs with XI2
* src/xfns.c (Fx_file_dialog): Handle GenericEvents when looking
for quit character.
* src/xmenu.c (x_menu_wait_for_event): If data is non-nil, use
XPending.
Po Lu [Tue, 1 Mar 2022 03:31:37 +0000 (11:31 +0800)]
Intern server time property during terminal initialization
* src/xmenu.c (create_and_show_popup_menu): Use previously
interned atom.
* src/xterm.c (x_term_init): New atom `EMACS_SERVER_TIME_PROP'.
* src/xterm.h (struct x_display_info): New field
`Xatom_EMACS_SERVER_TIME_PROP'.
Po Lu [Tue, 1 Mar 2022 03:30:52 +0000 (11:30 +0800)]
Fix Motif menu help text in submenus
* lwlib/lwlib-Xm.c (xm_arm_callback):
(make_menu_in_widget):
(update_one_menu_entry):
(xm_update_one_widget):
(do_call): Pass instance to arm callback and use wv as user data
instead of call data.
Stefan Monnier [Mon, 28 Feb 2022 16:59:38 +0000 (11:59 -0500)]
ecomplete: Try and avoid losing data
* lisp/ecomplete.el (ecomplete-add-item): Make sure the database is
setup, so we don't risk overwriting it with a (mostly) empty one.
(ecomplete-save): Don't save an empty database.
Po Lu [Mon, 28 Feb 2022 06:35:01 +0000 (14:35 +0800)]
Better fix for bug#13476
* lisp/faces.el (face-spec-recalc): Apply scroll bar foreground
and background to the frame if changing the scroll-bar face.
(scroll-bar): Restore previous declaration. That way, the
default colors are used for toolkit scroll bars, instead of
black and white.