]> git.eshelyaron.com Git - emacs.git/log
emacs.git
3 years agoMerge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Michael Albinus [Tue, 15 Feb 2022 15:16:50 +0000 (16:16 +0100)]
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs

3 years agoSome Tramp cleanup
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.

3 years ago; * etc/NEWS: Improve wording of savehist.el's entry.
Eli Zaretskii [Tue, 15 Feb 2022 14:33:42 +0000 (16:33 +0200)]
; * etc/NEWS: Improve wording of savehist.el's entry.

3 years agoDon't attempt to connect to a remote server during 'abbreviate-file-name'
Jim Porter [Mon, 14 Feb 2022 21:16:05 +0000 (13:16 -0800)]
Don't attempt to connect to a remote server during 'abbreviate-file-name'

* lisp/net/tramp.el (tramp-handle-abbreviate-file-name): Only use the
"home-directory" when a connection has been established.

3 years agoAllow savehist-additional-variables to truncate lists
Lars Ingebrigtsen [Tue, 15 Feb 2022 10:29:43 +0000 (11:29 +0100)]
Allow savehist-additional-variables to truncate lists

* lisp/savehist.el (savehist-save): Allow truncating values (bug#30943).

3 years agoAdjust files-test-file-size-human-readable test
Lars Ingebrigtsen [Tue, 15 Feb 2022 09:59:56 +0000 (10:59 +0100)]
Adjust files-test-file-size-human-readable test

* test/lisp/files-tests.el (files-test-file-size-human-readable):
Fix test after recent change.

3 years agoMake autoarg obsolete
Lars Ingebrigtsen [Tue, 15 Feb 2022 09:54:30 +0000 (10:54 +0100)]
Make autoarg obsolete

* lisp/obsolete/autoarg.el: Make obsolete.

3 years ago; Fix commit d6fba624e6
Arash Esbati [Tue, 15 Feb 2022 09:00:57 +0000 (10:00 +0100)]
; Fix commit d6fba624e6

* doc/misc/gnus.texi (Gravatars): Adjust vindex entries.

3 years agoFix parsing of some semibold font styles on Haiku
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>.

3 years agoDisable auto-lowering and raising on Haiku when a popup is active
Po Lu [Tue, 15 Feb 2022 07:21:18 +0000 (07:21 +0000)]
Disable auto-lowering and raising on Haiku when a popup is active

* src/haikuterm.c (haiku_new_focus_frame):
(haiku_read_socket): Don't raise or lower if popup is activated.

3 years agoReplace use of `DefaultRootWindow' with our recorded root window
Po Lu [Tue, 15 Feb 2022 05:41:52 +0000 (13:41 +0800)]
Replace use of `DefaultRootWindow' with our recorded root window

* src/xfns.c (x_relative_mouse_position):
(x_set_parent_frame):
(Fx_mouse_absolute_pixel_position):
(Fx_set_mouse_absolute_pixel_position):
* src/xterm.c (x_iconify_frame): Use dpyinfo->root_window
instead of DefaultRootWindow.

3 years agoImprove the help message for the pgtk configure option
Po Lu [Tue, 15 Feb 2022 04:52:30 +0000 (12:52 +0800)]
Improve the help message for the pgtk configure option

* configure.ac: Describe the purpose of PGTK better.

3 years ago; * doc/lispref/variables.texi (Setting Variables): Fix a typo.
Aleksandr Vityazev [Mon, 14 Feb 2022 20:30:58 +0000 (20:30 +0000)]
; * doc/lispref/variables.texi (Setting Variables): Fix a typo.

3 years ago* src/xterm.c (init_xterm): Use more reliable method to disable XI2.
Po Lu [Tue, 15 Feb 2022 02:23:49 +0000 (10:23 +0800)]
* src/xterm.c (init_xterm): Use more reliable method to disable XI2.

3 years agoBetter handle devices being enabled on XI2
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.

3 years agoFix docstring and init of Gnus search -remove-prefix options
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").

3 years agoFix manual documentation of Gnus tool bars
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".

3 years agoBe more explicit about the meaning of "remove prefix" in Gnus search
Eric Abrahamsen [Mon, 14 Feb 2022 23:20:06 +0000 (15:20 -0800)]
Be more explicit about the meaning of "remove prefix" in Gnus search

* doc/misc/gnus.texi (Search Engines): It's easy to get confused about
what we're removing and why.

3 years ago; * doc/lispref/variables.texi (Setting Variables): Fix markup.
Eli Zaretskii [Mon, 14 Feb 2022 17:47:44 +0000 (19:47 +0200)]
; * doc/lispref/variables.texi (Setting Variables): Fix markup.

3 years ago; Improve a recently added NEWS entry about 'command-query'.
Eli Zaretskii [Mon, 14 Feb 2022 17:38:56 +0000 (19:38 +0200)]
; Improve a recently added NEWS entry about 'command-query'.

3 years agoImprove recent addition to documentation of face remapping
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".

3 years agoImprove format of values returned by 'file-size-human-readable'
Eli Zaretskii [Mon, 14 Feb 2022 16:59:38 +0000 (18:59 +0200)]
Improve format of values returned by 'file-size-human-readable'

* lisp/files.el (file-size-human-readable): Emit one digit of the
fractional part of the size only if there's just one digit before
the decimal point.

3 years agoFix typo in Face Remapping
Lars Ingebrigtsen [Mon, 14 Feb 2022 14:16:42 +0000 (15:16 +0100)]
Fix typo in Face Remapping

* doc/lispref/display.texi (Face Remapping): Fix typo.

3 years agoDon't signal errors in abbrev-table-p
Lars Ingebrigtsen [Mon, 14 Feb 2022 11:00:22 +0000 (12:00 +0100)]
Don't signal errors in abbrev-table-p

* 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).

3 years agoImprove stability of message-hide-headers
Philip Kaludercic [Mon, 14 Feb 2022 10:51:06 +0000 (11:51 +0100)]
Improve stability of message-hide-headers

* message.el (message-hide-headers): Use a pointer instead of tracking
the "end-of-headers" point manually (bug#53991).

3 years agoPremultiply background color by alpha for images
Po Lu [Mon, 14 Feb 2022 10:39:56 +0000 (18:39 +0800)]
Premultiply background color by alpha for images

* src/xterm.c (x_query_frame_background_color): Premultiply
colors as X wants them when built without Cairo.

3 years agoFix typo in previous Face Remapping doc change
Lars Ingebrigtsen [Mon, 14 Feb 2022 10:39:55 +0000 (11:39 +0100)]
Fix typo in previous Face Remapping doc change

* doc/lispref/display.texi (Face Remapping): Fix typo.

3 years agoNote caveat about remapping basic faces
Lars Ingebrigtsen [Mon, 14 Feb 2022 10:38:11 +0000 (11:38 +0100)]
Note caveat about remapping basic faces

* doc/lispref/display.texi (Face Remapping): Note caveat about
basic faces (bug#53636).

3 years agoImprove Haiku selection handling
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.

3 years agoAdd a mechanism for querying before executing a command
Lars Ingebrigtsen [Mon, 14 Feb 2022 10:20:41 +0000 (11:20 +0100)]
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.

3 years agoHandle allocation failures of fringe bitmaps on Haiku
Po Lu [Mon, 14 Feb 2022 07:12:17 +0000 (07:12 +0000)]
Handle allocation failures of fringe bitmaps on Haiku

* src/haikuterm.c (haiku_define_fringe_bitmap): Handle
allocation failures.

3 years ago* etc/TODO: Update some entires related to macOS and NS.
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.

3 years agoEnsure bad values don't leak into scroll valuators after DeviceChange
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'.

3 years agoRestore valuator values after receiving a DeviceChanged event
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.

3 years agoImprove efficency of handling DeviceChanged events
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.

3 years agoTry to reduce empty areas on GTK when a frame is being resized
Po Lu [Mon, 14 Feb 2022 01:52:05 +0000 (09:52 +0800)]
Try to reduce empty areas on GTK when a frame is being resized

* src/xterm.c (x_fill_rectangle):
(x_clear_rectangle, x_draw_image_glyph_string):
(x_clear_area): Don't use picture if frame background is opaque.

3 years agoFix wide fringe bitmap processing on Haiku
Po Lu [Mon, 14 Feb 2022 01:34:09 +0000 (01:34 +0000)]
Fix wide fringe bitmap processing on Haiku

* src/haiku_support.cc (BBitmap_import_mono_bits): Rewrite to
use ImportBits.
(BBitmap_import_fringe_bitmap): New function.

* src/haiku_support.h: Update prototypes.

* src/haikuterm.c (haiku_define_fringe_bitmap): Pass entire
short array to BBitmap_import_fringe_bitmap instead.

3 years agoImprove Tramp's process-file implementations
Michael Albinus [Sun, 13 Feb 2022 19:50:51 +0000 (20:50 +0100)]
Improve Tramp's process-file implementations

* lisp/net/tramp-adb.el (tramp-adb-handle-process-file)
* lisp/net/tramp-sh.el (tramp-sh-handle-process-file):
* lisp/net/tramp-smb.el (tramp-smb-handle-process-file):
* lisp/net/tramp-sshfs.el (tramp-sshfs-handle-process-file):
Improve implementation.  (Bug#53854)

* test/lisp/net/tramp-tests.el (tramp-test28-process-file)
(tramp--test-check-files, tramp-test47-unload): Extend tests.

3 years ago* lisp/faces.el (read-face-name-sample-text): Add defconst (bug#53960).
Juri Linkov [Sun, 13 Feb 2022 18:44:14 +0000 (20:44 +0200)]
* lisp/faces.el (read-face-name-sample-text): Add defconst (bug#53960).

(read-face-name): Use it instead of hard-coded string.

3 years agoAdd a new macro `setopt'
Lars Ingebrigtsen [Sun, 13 Feb 2022 15:29:26 +0000 (16:29 +0100)]
Add a new macro `setopt'

* doc/emacs/custom.texi (Examining): Mention it.
(Init Syntax): Ditto.

* doc/emacs/windows.texi (Window Choice): Adjust example.

* doc/lispref/windows.texi (Choosing Window Options): Adjust examples.

* doc/lispref/variables.texi (Setting Variables): Document setopt.

* doc/misc/eudc.texi (Emacs-only Configuration): Adjust examples.

* lisp/cus-edit.el (setopt): New macro.

3 years ago; * lisp/simple.el (count-words): Doc fix.
Eli Zaretskii [Sun, 13 Feb 2022 13:05:13 +0000 (15:05 +0200)]
; * lisp/simple.el (count-words): Doc fix.

3 years ago* src/haikuterm.c (haiku_read_socket): Implement auto-lower.
Po Lu [Sun, 13 Feb 2022 12:15:21 +0000 (12:15 +0000)]
* src/haikuterm.c (haiku_read_socket): Implement auto-lower.

3 years agoOnly get rid of IC focus if focus is really gone
Po Lu [Sun, 13 Feb 2022 11:50:20 +0000 (19:50 +0800)]
Only get rid of IC focus if focus is really gone

* src/xterm.c (x_focus_changed): Only unset IC focus if the
focus state is empty.

3 years agoRemove the 'C-k' binding in ido-mode
Lars Ingebrigtsen [Sun, 13 Feb 2022 10:23:43 +0000 (11:23 +0100)]
Remove the 'C-k' binding in ido-mode

* lisp/ido.el (ido-file-completion-map): Remove the `C-k' binding,
because it's too dangerous and probably not very useful (bug#44556).

3 years agoPrevent crashes from illegal locale coding systems
Po Lu [Sun, 13 Feb 2022 10:19:51 +0000 (18:19 +0800)]
Prevent crashes from illegal locale coding systems

* src/xfns.c (xic_preedit_draw_callback):
* src/xterm.c (handle_one_xevent): Don't pass invalid coding
systems to `setup_coding_system'.

3 years agoMake `C-u M-x count-words' also give totals
Lars Ingebrigtsen [Sun, 13 Feb 2022 09:56:20 +0000 (10:56 +0100)]
Make `C-u M-x count-words' also give totals

* 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.

3 years agoNote meaning on nil HIST in Fread_from_minibuffer
Lars Ingebrigtsen [Sun, 13 Feb 2022 09:12:27 +0000 (10:12 +0100)]
Note meaning on nil HIST in Fread_from_minibuffer

* src/minibuf.c (Fread_from_minibuffer): Note the meaning of a nil
HIST parameter (bug#20063).

3 years agoFix mouse clicking in read-face-name
Lars Ingebrigtsen [Sun, 13 Feb 2022 08:35:55 +0000 (09:35 +0100)]
Fix mouse clicking in read-face-name

* lisp/faces.el (read-face-name): Put the data in the right
position so that clicking on completions work (bug#53960).

3 years agoFix ietf-drums-remove-whitespace unmatched " and (
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).

3 years ago* src/eval.c (specpdl_unrewind): Remove empty statement.
Andreas Schwab [Sun, 13 Feb 2022 08:10:25 +0000 (09:10 +0100)]
* src/eval.c (specpdl_unrewind): Remove empty statement.

3 years agoAvoid a compilation warning in eval.c
Lars Ingebrigtsen [Sun, 13 Feb 2022 07:26:55 +0000 (08:26 +0100)]
Avoid a compilation warning in eval.c

* src/eval.c (specpdl_unrewind): Avoid a compilation warning.

3 years agoFix integer overflow with 32-bit visual
Po Lu [Sun, 13 Feb 2022 05:26:41 +0000 (13:26 +0800)]
Fix integer overflow with 32-bit visual

* src/xfns.c (x_set_border_pixel):
(x_set_border_color): Use `unsigned long' for border color.

3 years agoWork around tooltip bug on new versions of WebKitGTK
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.

3 years agoStop quering for Xinerama inside x_get_monitor_attributes
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'.

3 years ago* src/pgtkfns.c (Fx_create_frame): Set `was_invisible' flag.
Po Lu [Sun, 13 Feb 2022 02:05:30 +0000 (10:05 +0800)]
* src/pgtkfns.c (Fx_create_frame): Set `was_invisible' flag.

3 years agoUse better GC for visible bell on colormapped visuals
Po Lu [Sun, 13 Feb 2022 01:34:12 +0000 (09:34 +0800)]
Use better GC for visible bell on colormapped visuals

* src/xterm.c (XTflash): Use normal_gc if the visual is not
TrueColor.

3 years agoFix the Haiku port
Po Lu [Sun, 13 Feb 2022 00:48:55 +0000 (00:48 +0000)]
Fix the Haiku port

* src/haiku_support.h [__cplusplus]: Define `specpdl_ref' type
on C++ since that code cannot include lisp.h.

3 years agoFix last change in xterm.c
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.

3 years ago* src/xterm.c (x_update_opaque_region): Avoid crash at startup in Lucid build
Stefan Monnier [Sat, 12 Feb 2022 22:47:21 +0000 (17:47 -0500)]
* src/xterm.c (x_update_opaque_region): Avoid crash at startup in Lucid build

3 years agoRewrite thread context switch code (bug#48990)
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/lisp.h (enum specbind_tag): Remove `saved_value` field.
(rebind_for_thread_switch, unbind_for_thread_switch): Delete decls.
(specpdl_unrewind): Declare function.

* 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".

3 years agoSpeed up `=` on fixnums in bytecode
Mattias Engdegård [Thu, 3 Feb 2022 09:26:27 +0000 (10:26 +0100)]
Speed up `=` on fixnums in bytecode

Now that EQ has become expensive, use BASE_EQ where possible.

* src/bytecode.c (exec_byte_code): Use cheaper operation for Beqlsign.

3 years ago; * src/xdisp.c (syms_of_xdisp): Fix formatting of last change.
Eli Zaretskii [Sat, 12 Feb 2022 18:45:06 +0000 (20:45 +0200)]
; * src/xdisp.c (syms_of_xdisp): Fix formatting of last change.

3 years agoOptionally allow point to enter composed character sequences
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'.

* etc/NEWS: Announce the new feature.

3 years agoCount bytes, not records, in specpdl_ref
Mattias Engdegård [Wed, 2 Feb 2022 16:42:07 +0000 (17:42 +0100)]
Count bytes, not records, in specpdl_ref

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.

3 years agoTurn specpdl_ref into a type of its own
Mattias Engdegård [Wed, 2 Feb 2022 15:51:43 +0000 (16:51 +0100)]
Turn specpdl_ref into a type of its own

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.

3 years agoReplace ptrdiff_t with new specpdl_ref type for specpdl references
Mattias Engdegård [Sat, 12 Feb 2022 15:05:17 +0000 (16:05 +0100)]
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.

* src/lisp.h (specpdl_ref, specpdl_count_to_ref, specpdl_ref_to_count)
(specpdl_ref_eq, specpdl_ref_lt, specpdl_ref_valid_p)
(make_invalid_specpdl_ref, specpdl_ref_add, specpdl_ref_to_ptr): New.
(SPECPDL_INDEX, struct handler, USE_SAFE_ALLOCA, safe_free)
(safe_free_unbind_to):
* src/alloc.c (run_finalizer_function, inhibit_garbage_collection)
(garbage_collect, Fgarbage_collect, which_symbols):
* src/bidi.c (bidi_at_paragraph_end, bidi_find_paragraph_start):
* src/buffer.c (Fkill_buffer, Fset_buffer_major_mode, Fmove_overlay)
(Fdelete_overlay):
* src/bytecode.c (exec_byte_code):
* src/callint.c (Ffuncall_interactively, Fcall_interactively):
* src/callproc.c (Fcall_process, call_process, create_temp_file)
(Fcall_process_region):
* src/charset.c (load_charset_map_from_file):
* src/coding.c (decode_coding_gap, decode_coding_object)
(encode_coding_object, Fread_coding_system):
* src/comp.c (emit_static_object, helper_unbind_n, load_comp_unit):
* src/composite.c (update_compositions, autocmp_chars):
* src/cygw32.c (conv_filename_to_w32_unicode)
(conv_filename_from_w32_unicode):
* src/data.c (notify_variable_watchers):
* src/decompress.c (Fzlib_decompress_region):
* src/dired.c (directory_files_internal, file_name_completion)
(file_attributes):
* src/dispnew.c (Fredisplay):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fsave_excursion, Fsave_current_buffer)
(Freplace_buffer_contents, Fsubst_char_in_region, Fsave_restriction)
(styled_format):
* src/emacs-module.c (Fmodule_load, funcall_module):
* src/emacs.c (init_cmdargs, Fdump_emacs):
* src/eval.c (call_debugger, do_debug_on_call, FletX, Flet)
(Ffuncall_with_delayed_message, Funwind_protect)
(internal_lisp_condition_case, signal_or_quit)
(load_with_autoload_queue, Feval, grow_specpdl_allocation)
(record_in_backtrace, eval_sub, Ffuncall, apply_lambda)
(funcall_lambda, clear_unwind_protect, set_unwind_protect)
(set_unwind_protect_ptr, unbind_to, Fbacktrace_eval):
* src/fileio.c (Fmake_temp_file_internal, Fcopy_file, Frename_file)
(Finsert_file_contents, write_region, Fdo_auto_save):
* src/fns.c (Fyes_or_no_p, Frequire, hash_table_user_defined_call):
* src/fringe.c (update_window_fringes):
* src/gtkutil.c (xg_dialog_run):
* src/haiku_io.c (c_specpdl_idx_from_cxx):
* src/haiku_support.cc (be_popup_file_dialog):
* src/haiku_support.h (c_specpdl_idx_from_cxx):
* src/haikufns.c (haiku_create_frame, haiku_create_tip_frame)
(haiku_hide_tip, Fx_show_tip, Fhaiku_read_file_name):
* src/haikumenu.c (haiku_popup_dialog, set_frame_menubar):
* src/image.c (slurp_file):
* src/indent.c (line_number_display_width, Fvertical_motion):
* src/insdel.c (signal_before_change, signal_after_change)
(Fcombine_after_change_execute):
* src/intervals.c (get_local_map):
* src/json.c (lisp_to_json_nonscalar_1, Fjson_serialize, Fjson_insert)
(Fjson_parse_string, Fjson_parse_buffer):
* src/keyboard.c (recursive_edit_1, Frecursive_edit, cmd_error)
(Finternal_track_mouse, command_loop_1, read_menu_command)
(safe_run_hooks, read_event_from_main_queue, read_char, timer_check_2)
(menu_item_eval_property, read_key_sequence, read_key_sequence_vs)
(Fsuspend_emacs):
* src/keymap.c (Fcurrent_active_maps, Fdescribe_vector)
(Fhelp__describe_vector):
* src/lread.c (Fload, save_match_data_load, readevalloop)
(Feval_buffer, Feval_region, grow_read_buffer, read_integer, read1):
* src/macros.c (Fexecute_kbd_macro):
* src/menu.c (x_popup_menu_1):
* src/minibuf.c (read_minibuf, set_minibuffer_mode)
(read_minibuf_unwind, Fread_string, Fread_buffer):
* src/nsfns.m (Fx_create_frame, Fx_show_tip):
* src/nsmenu.m (ns_update_menubar, ns_menu_show, ns_popup_dialog):
* src/pdumper.c (Fdump_emacs_portable):
* src/pgtkfns.c (Fx_create_frame, x_create_tip_frame, x_hide_tip)
(Fx_show_tip, Fpgtk_print_frames_dialog, Fx_file_dialog, Fx_select_font):
* src/pgtkmenu.c (set_frame_menubar, create_and_show_popup_menu)
(pgtk_menu_show, create_and_show_dialog, pgtk_dialog_show)
(pgtk_popup_dialog):
* src/pgtkterm.c (pgtk_cr_export_frames):
* src/print.c (PRINTPREPARE, temp_output_buffer_setup)
(Fprin1_to_string, print_vectorlike):
* src/process.c (Fmake_process, create_process, Fmake_pipe_process)
(Fmake_serial_process, connect_network_socket, Fmake_network_process)
(network_interface_info, server_accept_connection)
(wait_reading_process_output, read_process_output, exec_sentinel):
* src/regex-emacs.c (re_match_2_internal):
* src/search.c (looking_at_1, fast_looking_at, search_buffer_re):
* src/sound.c (Fplay_sound_internal):
* src/sysdep.c (system_process_attributes):
* src/term.c (tty_menu_show):
* src/textprop.c (Fnext_single_char_property_change)
(Fprevious_single_char_property_change, add_text_properties_1)
(set_text_properties, set_text_properties_1, Fremove_text_properties)
(Fremove_list_of_text_properties):
* src/thread.c (Fmutex_lock, invoke_thread_function):
* src/undo.c (truncate_undo_list):
* src/w32fns.c (Fx_create_frame, w32_create_tip_frame, w32_hide_tip)
(Fx_show_tip, Fx_file_dialog):
* src/w32font.c (Fx_select_font):
* src/w32menu.c (set_frame_menubar):
* src/window.c (window_list, next_window, window_list_1)
(run_window_configuration_change_hook, Frun_window_scroll_functions)
(run_window_change_functions, set_window_buffer)
(temp_output_buffer_show, window_scroll, scroll_command)
(Fscroll_other_window, Fscroll_other_window_down):
* src/xdisp.c (safe__call, handle_fontified_prop, handle_face_prop)
(handle_single_display_spec, Fbuffer_text_pixel_size)
(message_dolog, with_echo_area_buffer, setup_echo_area_for_printing)
(display_echo_area, set_message, clear_message, echo_area_display)
(gui_consider_frame_title, prepare_menu_bars, update_menu_bar)
(update_tab_bar, update_tool_bar, redisplay_internal)
(redisplay_preserve_echo_area, run_window_scroll_functions)
(redisplay_window, extend_face_to_end_of_line)
(display_count_lines_logically, display_count_lines_visually)
(display_mode_lines, display_mode_line, Fformat_mode_line)
(decode_mode_spec):
* src/xfns.c (Fx_create_frame, x_create_tip_frame, x_hide_tip)
(Fx_show_tip, Fx_file_dialog, Fx_select_font, Fx_print_frames_dialog):
* src/xmenu.c (set_frame_menubar, create_and_show_popup_menu)
(x_menu_show, create_and_show_dialog, x_dialog_show)
(xw_popup_dialog):
* src/xselect.c (x_get_local_selection, x_reply_selection_request)
(x_handle_selection_request, wait_for_property_change):
* src/xterm.c (x_cr_export_frames, x_connection_closed):
Replace ptrdiff_t with specpdl_ref for referencing specpdl and use the
corresponding functions instead of direct arithmetic.

3 years agoFix entry and exit events with XI2 grabs on X toolkit menus
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.

3 years agoClean up mode-line-* faces handling
Eli Zaretskii [Sat, 12 Feb 2022 11:43:36 +0000 (13:43 +0200)]
Clean up mode-line-* faces handling

* src/xfaces.c (realize_basic_faces):
* src/dispextern.h (enum face_id): Remove MODE_LINE_ID.

3 years agoAdd documentation on how to delete files from Trash
Lars Ingebrigtsen [Sat, 12 Feb 2022 08:04:14 +0000 (09:04 +0100)]
Add documentation on how to delete files from Trash

* doc/emacs/files.texi (Misc File Ops): Note trick to make `D'
work in Trash directories (bug#44059).

3 years agoImprove interaction between track-mouse and edebug
Lars Ingebrigtsen [Sat, 12 Feb 2022 07:40:30 +0000 (08:40 +0100)]
Improve interaction between track-mouse and edebug

* lisp/emacs-lisp/edebug.el (edebug--display-1): Work around
`track-mouse' oddity (bug#675).

3 years agoFix off-by-one file size formatting in ls-lisp
Lars Ingebrigtsen [Sat, 12 Feb 2022 07:07:42 +0000 (08:07 +0100)]
Fix off-by-one file size formatting in ls-lisp

* lisp/ls-lisp.el (ls-lisp-format, ls-lisp-format-file-size): The
human-readable file sizes can be 7 characters wide (e.g.,
"1016.1k") (bug#53937).

3 years agoCross-link message-expand-name-standard-ui-relevant doc strings
Lars Ingebrigtsen [Fri, 11 Feb 2022 06:22:52 +0000 (07:22 +0100)]
Cross-link message-expand-name-standard-ui-relevant doc strings

* lisp/gnus/message.el (message-expand-name-standard-ui): Mention
the other relevant variables in the doc string (bug#50667).

3 years agoImplement visual bell on Haiku like on X
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.

3 years agoFix compatibility with ancient versions of libXi
Po Lu [Sat, 12 Feb 2022 02:33:14 +0000 (10:33 +0800)]
Fix compatibility with ancient versions of libXi

* src/xmenu.c (popup_get_selection): Don't rely on xev->display
being non-NULL.

3 years agoBe less strict about which PointerEmulated button events to ignore
Po Lu [Sat, 12 Feb 2022 02:23:51 +0000 (10:23 +0800)]
Be less strict about which PointerEmulated button events to ignore

* src/xterm.c (handle_one_xevent): Ignore all PointerEmulated
button events.

3 years agoNever set opaque region without an alpha channel
Po Lu [Sat, 12 Feb 2022 01:20:53 +0000 (09:20 +0800)]
Never set opaque region without an alpha channel

* src/xfns.c (x_set_alpha_background): Don't modify opaque
region if the visual has no alpha channel.

3 years agoModernise byte-compilation chapters in manual
Mattias Engdegård [Fri, 11 Feb 2022 20:41:11 +0000 (21:41 +0100)]
Modernise byte-compilation chapters in manual

* 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.

3 years ago; * config.bat: Fix typo.
Po Lu [Fri, 11 Feb 2022 12:26:04 +0000 (20:26 +0800)]
; * config.bat: Fix typo.

3 years agoMerge remote-tracking branch 'origin/master'
Po Lu [Fri, 11 Feb 2022 12:20:50 +0000 (20:20 +0800)]
Merge remote-tracking branch 'origin/master'

3 years agoFix the DJGPP port
Po Lu [Fri, 11 Feb 2022 12:19:34 +0000 (20:19 +0800)]
Fix the DJGPP port

* config.bat:
* msdos/sed1v2.inp:
* msdos/sedlibmk.inp: Update for present Emacs.

* src/Makefile.in (MAKE_PDUMPER_FINGERPRINT): Fix indentation
to not confuse sed*.inp.
* src/conf_post.h [MSDOS]: Define some things gnulib wants.

3 years agoTolerate tilde in remote file names when needed
Michael Albinus [Fri, 11 Feb 2022 08:37:48 +0000 (09:37 +0100)]
Tolerate tilde in remote file names when needed

* lisp/net/tramp.el (tramp-tolerate-tilde): New defvar.
(tramp-handle-expand-file-name):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name):
Respect it.

* lisp/net/tramp-adb.el (tramp-adb-tolerate-tilde):
* lisp/net/tramp-sshfs.el (tramp-sshfs-tolerate-tilde): New defuns.
Advice `shell-mode' with them.
(tramp-methods) <sshfs>: Add "-t -t" to `tramp-login-args'.

3 years ago; * etc/DEVEL.HUMOR: Add a recent joke.
Eli Zaretskii [Fri, 11 Feb 2022 08:15:20 +0000 (10:15 +0200)]
; * etc/DEVEL.HUMOR: Add a recent joke.

3 years agoAllow searching of nnselect (search) groups
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.

3 years ago* etc/PROBLEMS: Document some limitations of Xwayland and PGTK.
Po Lu [Fri, 11 Feb 2022 06:46:25 +0000 (14:46 +0800)]
* etc/PROBLEMS: Document some limitations of Xwayland and PGTK.

3 years agoDon't make cursors affected by background alpha on PGTK
Po Lu [Fri, 11 Feb 2022 05:59:03 +0000 (13:59 +0800)]
Don't make cursors affected by background alpha on PGTK

* src/ftcrfont.c (ftcrfont_draw):
* src/pgtkterm.c (x_clear_glyph_string_rect): Make behavior on
PGTK consistent with X.

3 years agoSet _NET_WM_OPAQUE_REGION on non-GTK3 toolkits when using 32 bit visual
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.

3 years agoFix fallout from switch to 32-bit visuals
Po Lu [Fri, 11 Feb 2022 05:30:11 +0000 (13:30 +0800)]
Fix fallout from switch to 32-bit visuals

* src/xfns.c (x_decode_color): Make return type wide enough to
hold any pixel value.
* src/xterm.h (x_make_truecolor_pixel): Simplify.

3 years agoImprove reliability of selection ownership on Haiku
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.

3 years agoDisable nearest-color allocation on DirectColor visuals
Po Lu [Fri, 11 Feb 2022 01:26:45 +0000 (09:26 +0800)]
Disable nearest-color allocation on DirectColor visuals

* src/xterm.c (x_alloc_nearest_color_1): Disable such allocation
on DirectColor.  The method we use can't possibly work there.

3 years agoSilence macOS vfork deprecation warnings
Mattias Engdegård [Thu, 10 Feb 2022 21:59:26 +0000 (22:59 +0100)]
Silence macOS vfork deprecation warnings

The vfork system call exists and works in macOS 11.6 but the compiler
gives a deprecation message; silence it, because the performance is
still better than that of plain fork.  See discussion at
https://lists.gnu.org/archive/html/emacs-devel/2022-02/msg00260.html

* src/conf_post.h (VFORK): New #define.
* src/callproc.c (emacs_spawn):
* src/sysdep.c (sys_subshell): Use it.

3 years ago* lisp/mouse.el (context-menu-map): Select only unselected window (bug#53910)
Juri Linkov [Thu, 10 Feb 2022 18:57:42 +0000 (20:57 +0200)]
* lisp/mouse.el (context-menu-map): Select only unselected window (bug#53910)

3 years ago* lisp/tab-line.el (tab-line-format): Use mode-line-window-selected-p.
Juri Linkov [Thu, 10 Feb 2022 18:52:55 +0000 (20:52 +0200)]
* lisp/tab-line.el (tab-line-format): Use mode-line-window-selected-p.

Recently 'mode-line-window-selected-p' was added to
'tab-line-tab-name-format-default'.  Now add the same to another
place that handles the face 'tab-line-tab-current' (bug#53629).

3 years agoAutoload package-installed-p
Corwin Brust [Tue, 8 Feb 2022 23:48:14 +0000 (17:48 -0600)]
Autoload package-installed-p

* lisp/emacs-lisp/package.el (package-installed-p): Add autoload
cookie. (Bug#53885)

Copyright-paperwork-exempt: yes

3 years agoMerge from origin/emacs-28
Eli Zaretskii [Thu, 10 Feb 2022 17:12:19 +0000 (19:12 +0200)]
Merge from origin/emacs-28

# Conflicts:
# lisp/startup.el

3 years ago; * lisp/startup.el (normal-top-level): Fix byte-compilation warning.
Eli Zaretskii [Thu, 10 Feb 2022 17:05:41 +0000 (19:05 +0200)]
; * lisp/startup.el (normal-top-level): Fix byte-compilation warning.

3 years agoNote current buffer and restore it in c-force-redisplay.
Alan Mackenzie [Thu, 10 Feb 2022 17:03:50 +0000 (17:03 +0000)]
Note current buffer and restore it in c-force-redisplay.

This fixes bug #52709.

* lisp/progmodes/cc-fonts.el (c-force-redisplay): New parameter BUFFER.  Set
current buffer to this before fontifying.
(c-fontify-new-found-type): Give the current buffer as argument to
run-with-timer.

3 years agoRestore command-line--load-script messaging
Lars Ingebrigtsen [Thu, 10 Feb 2022 14:13:21 +0000 (15:13 +0100)]
Restore command-line--load-script messaging

* lisp/startup.el (command-line--load-script): Restore previous
non-messaging behaviour.

3 years ago* lisp/startup.el (normal-top-level): Disable native-comp if not available
Andrea Corallo [Thu, 10 Feb 2022 08:46:31 +0000 (09:46 +0100)]
* lisp/startup.el (normal-top-level): Disable native-comp if not available

3 years agoImprove handling of file modes in Tramp
Michael Albinus [Thu, 10 Feb 2022 13:14:06 +0000 (14:14 +0100)]
Improve handling of file modes in Tramp

* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-get-remote-uid)
(tramp-gvfs-handle-get-remote-gid): Do not assume that the default
location is owned be the remote uid/gid.
(tramp-gvfs-handle-file-executable-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-executable-p):
Check also for setuid/setgid bit.

* lisp/net/tramp.el (tramp-check-cached-permissions): Check also
for ?s access type.  Check whether remote uid/gid are unknown.

3 years agoDon't signal a backtrace on empty --script files
Lars Ingebrigtsen [Thu, 10 Feb 2022 12:44:55 +0000 (13:44 +0100)]
Don't signal a backtrace on empty --script files

* lisp/startup.el (command-line--load-script): New function that
avoids erroring out if it turns out there's no forms in the buffer
(bug#4616).

* lisp/subr.el (delete-line): New utility function.
* lisp/international/mule.el (load-with-code-conversion): Accept
an eval function.