* lisp/emacs-lisp/gv.el:
* lisp/emacs-lisp/macroexp.el (internal-macroexpand-for-load): Since
eager macro-expansion errors are no longer warnings, don't say so.
* lisp/emacs-lisp/rx.el: `>=` and `=` are much more likely functions
than RX constructs and the indentation machinery currently has
no way to tell them apart.
Suggested by Michael Herdeegen.
Stefan Kangas [Thu, 30 Jun 2022 11:47:59 +0000 (13:47 +0200)]
New hook save-place-after-find-file-hook
This is intended for use in Org mode, where we currently use advise.
* lisp/saveplace.el (save-place-after-find-file-hook): New hook.
(save-place-find-file-hook): Run new hook.
Make "eager macro-expansion" warning into an error
* doc/lispref/loading.texi (How Programs Do Loading): Update
documentation.
* lisp/emacs-lisp/macroexp.el:
(internal-macroexpand-for-load): We've been warning about eager
macro expansion for many years, so finally change that into an
error (bug#18154).
Michael Shields [Thu, 30 Jun 2022 10:10:45 +0000 (12:10 +0200)]
Don't ignore emacsclient's --frame-parameters option when -t
* lisp/server.el (server-process-filter): Add part of patch that
was mistakenly missed when the patch was applied (bug#24147).
This also fixes bug#56309.
Po Lu [Thu, 30 Jun 2022 08:41:58 +0000 (16:41 +0800)]
Disable unrelated drag-and-drop protocols during XDS drop
* doc/lispref/frames.texi (Drag and Drop): Document variables
used to control drag-and-drop protocols.
* lisp/x-dnd.el (x-dnd-do-direct-save): Disable irrelevant DND
protocols.
* src/xterm.c (x_dnd_get_target_window_1):
(x_dnd_get_target_window):
(handle_one_xevent): Respect new variable.
(syms_of_xterm): New variable `x-dnd-disable-motif-protocol'.
Po Lu [Thu, 30 Jun 2022 06:13:30 +0000 (14:13 +0800)]
Improve compliance with the XDS and XDND protocols
* lisp/select.el (xselect-convert-to-text-uri-list): Return a
type of `text/uri-list' instead of STRING or C_STRING.
* lisp/x-dnd.el (x-dnd-xds-performed): New defvar.
(x-dnd-handle-direct-save): Set it to t and handle URIs with
hostnames correctly. Also return errors correctly.
(x-dnd-handle-octet-stream): New function.
(x-dnd-do-direct-save): Handle application/octet-stream, check
results.
Po Lu [Thu, 30 Jun 2022 01:45:49 +0000 (09:45 +0800)]
Fix preservation of the original value of PRIMARY after dropping on xterm
* src/xselect.c (x_own_selection): New arg `dnd_data'. Record
it.
(x_get_local_selection, x_handle_selection_request)
(x_convert_selection): Convert the DND data instead if the
situation warrants.
(Fx_own_selection_internal, Fx_get_selection_internal)
(Fx_get_local_selection): Update calls to x_get_local_selection.
* src/xterm.c (x_dnd_do_unsupported_drop): If obtaining
selection ownership failed, return. Record DND value and
preserve the current value of PRIMARY, if it exists.
Eli Zaretskii [Wed, 29 Jun 2022 17:15:36 +0000 (20:15 +0300)]
Fix hscrolling of :align-to when display-line-numbers is in effect
* src/dispextern.h (struct it): Rename 'tab_offset' member to
'stretch_adjust'.
* src/xdisp.c (gui_produce_glyphs, produce_stretch_glyph)
(display_line): All users of 'tab_offset' changed.
(produce_stretch_glyph): Fix calculation of ':align-to' when
line numbers are displayed and the window is hscrolled.
(calc_pixel_width_or_height): Fix calculation of width of 'space'
display property when 'display-line-numbers' is turned on, but the
line number was not yet produced for the current glyph row.
(Bug#56176)
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Don't allow spaces in the file names, to avoid false matches.
Don't allow ad-hoc spaces preceding the program name either.
Complete transition to rx for compilation `gnu` pattern
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Change from a mixture of traditional regexp syntax and rx,
to make intentions clearer.
Po Lu [Wed, 29 Jun 2022 13:12:12 +0000 (21:12 +0800)]
Fix some bugs found while testing drag-and-drop
* lisp/x-dnd.el (x-dnd-get-drop-width-height):
(x-dnd-get-drop-x-y): Fix doc string.
(x-dnd-handle-xdnd): Don't set update rect if
`dnd-indicate-insertion-point'. Bug found testing with "JX
Application Framework".
Stefan Monnier [Wed, 29 Jun 2022 12:58:13 +0000 (08:58 -0400)]
(cl--generic-compiler): Revert last change
That change (introduced to circumvent an error now that `seq.el` is
preloaded) caused all dispatchers to be left uncompiled, which slows down
method dispatch very significantly. Fix the problem in the old way,
i.e. by adding an explicit call to `cl--generic-prefill-dispatchers`.
* lisp/emacs-lisp/cl-generic.el (cl--generic-compiler): Revert last change.
Add (cl--generic-prefill-dispatchers 1 integer) instead to handle
the new dispatchers needed for `seq.el`.
(cl--generic-prefill-generalizer-sample): New function.
(cl--generic-get-dispatcher): Use it to signal an error giving precise
instructions for what to do if we're about the load the byte-compiler
during the preload.
(cl--generic-oclosure-generalizer): Rename from
`cl-generic--oclosure-generalizer` for consistency with all
other generalizers.
Po Lu [Wed, 29 Jun 2022 12:10:25 +0000 (20:10 +0800)]
Implement starting X Direct Save (XDS) drops
* doc/lispref/frames.texi (Drag and Drop): Document new function
`dnd-direct-save'.
* etc/NEWS: Likewise.
* lisp/dnd.el (dnd-direct-save-remote-files): New defcustom.
(dnd-begin-file-drag): Implement defucstom.
(dnd-begin-drag-files): Add kill-emacs-hook after saving remote
file.
(dnd-direct-save): New function.
* lisp/x-dnd.el (x-dnd-known-types): Fix coding style.
(x-dnd-handle-drag-n-drop-event): Handle local value with
self-originating DND events.
(x-dnd-xds-current-file, x-dnd-xds-source-frame): New defvars.
(x-dnd-handle-direct-save, x-dnd-do-direct-save): New functions.
* src/xfns.c (Fx_begin_drag): Allow any atom to be used as a DND
action.
* src/xselect.c (symbol_to_x_atom): Make public.
* src/xterm.c (x_dnd_note_self_drop): Include selection local
value.
(x_ignore_errors_for_next_request): Don't assume x_error_message
is set.
* src/xterm.h: Update prototypes.
Stefan Kangas [Wed, 29 Jun 2022 11:29:27 +0000 (13:29 +0200)]
Make two text-property-search tests easier to read
* test/lisp/emacs-lisp/text-property-search-tests.el
(text-property-search-forward/point-at-beginning)
(text-property-search-backward/point-at-end): Rewrite to make tests
easier to read.
Ensure that In-Reply-To is saved in drafts in Message
* lisp/gnus/message.el (message-hidden-headers): Hide In-Reply-To
now that we pre-generate it.
(message-setup-1): Pre-generate In-Reply-To so that it'll be saved
in drafts (bug#47639).
lisp/progmodes/python.el (python-nav-end-of-block): Fix a bad
assumption that python-nav-end-of-statement always makes forward
progress by testing that it actually does. If this check is not made
then it is possible for python-nav-end-of-block to enter an infinite
loop. (bug#56271)
* src/xterm.c (x_clean_failable_requests): Avoid redundant
memcpy if first == last.
(x_ignore_errors_for_next_request): Fix check for last request.
(x_check_errors, x_had_errors_p): Clean up failable requests
here.
Po Lu [Wed, 29 Jun 2022 06:05:25 +0000 (06:05 +0000)]
Handle be:actions field in Haiku DND messages
* lisp/term/haiku-win.el (haiku-get-numeric-enum): New function.
(haiku-numeric-enum): New macro.
(haiku-select-encode-xstring, haiku-select-encode-utf-8-string):
Replace hard-coded numeric enumerators.
(haiku-parse-drag-actions): New function.
(haiku-drag-and-drop): Use action returned by that function.
(x-begin-drag): Replace hard-coded enumerator.
Po Lu [Wed, 29 Jun 2022 02:24:14 +0000 (10:24 +0800)]
Fix reported problem with drag-and-drop inside VirtualBox
* lisp/x-dnd.el (x-dnd-handle-old-kde, x-dnd-handle-offix)
(x-dnd-handle-motif): Select window before handling drop, like
on Xdnd.
(x-dnd-convert-to-offix, x-dnd-do-offix-drop)
(x-dnd-handle-unsupported-drop): Accept local selection data and
use that instead.
* src/keyboard.c (kbd_buffer_get_event): Call unsupported drop
function with local selection data as 8th arg.
* src/xselect.c (x_get_local_selection): Accept new arg
`local_value'. All callers changed.
(Fx_get_local_selection): New function.
(syms_of_xselect): Update defsubrs.
* src/xterm.c (x_dnd_lose_ownership): New function.
(x_dnd_begin_drag_and_drop): Unless new variable is true, disown
XdndSelection after returning. This supposedly makes
drag-and-drop from guest to host work in VirtualBox without
causing pointer motion to become choppy afterwards.
(syms_of_xterm): New variable `x_dnd_preserve_selection_data'
and update doc string of `x-dnd-unsupported-drop-function'.
* test/lisp/dnd-tests.el (dnd-tests-begin-text-drag)
(dnd-tests-begin-file-drag, dnd-tests-begin-drag-files): Set new
variable to nil during tests.
Juri Linkov [Tue, 28 Jun 2022 17:20:21 +0000 (20:20 +0300)]
* lisp/isearch.el (isearch-delete-char): Improve fix for bug#52248.
When reaching the top of the stack where isearch-other-end is nil,
still close unnecessary overlays for the previous position.
(isearch-close-unnecessary-overlays): Rename arg BEG for consistency.
* lisp/help-fns.el (help-fns--obsolete): Remove indentation and fill.
(help-fns--var-obsolete): Ditto.
(describe-function-1): Output the obsoletion info first since it's
vital information.
(describe-variable): Ditto (bug#56251).
* doc/lispref/hash.texi (Defining Hash): Explain more about what
sxhash-equal is for and what the caveats are.
* src/fns.c (Fsxhash_eql, Fsxhash_equal): Clarify doc string.
Michael Albinus [Tue, 28 Jun 2022 12:41:45 +0000 (14:41 +0200)]
Tramp shall not trap unrelated D-Bus errors
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector): Declare.
(tramp-gvfs-file-name-handler): Let-bind it.
(tramp-gvfs-dbus-event-vector): Fix docstring.
(tramp-gvfs-maybe-open-connection): Do not set it globally. (Bug#56162)
Jim Meyering [Mon, 27 Jun 2022 04:26:01 +0000 (21:26 -0700)]
Fix configure.ac quoting of AC_CHECK_LIB's 2nd arg
Running an autoconf-head-generated configure, would fail like this:
/emacs/configure: line 18002: syntax error near unexpected token `;;'
/emacs/configure: line 18002: ` ;;'
That is due to under-quoting of AC_CHECK_LIB's second argument, which led to
the comma in an embedded string being interpreted as paramater-delimiting.
* configure.ac: Quote the second arg of each AC_CHECK_LIB invocation.
(Bug#56272)
Eli Zaretskii [Mon, 27 Jun 2022 12:32:53 +0000 (15:32 +0300)]
Fix deletion of composed text
* lisp/composite.el (lgstring-glyph-boundary): New function.
* lisp/simple.el (delete-forward-char): Call
'lgstring-glyph-boundary' to find where to end the deletion inside
an automatic composition. (Bug#56237)
* lisp/subr.el (plistp): New type predicate (bug#47427). This
referred to in the error message from plist-put: "Debugger
entered--Lisp error: (wrong-type-argument plistp (a b c))".
* src/fns.c (plist_get):
(plist_put):
(plist_member): New functions (without optional third parameter)
to be used in C code.
* src/fns.c (Fplist_get, Fplist_put, Fplist_member): Take an
optional predicate parameter (bug#47425).
* src/lisp.h: Declare new plist_put, plist_get and plist_member
functions.
* test/lisp/json-tests.el (test-json-add-to-plist): Use plist-get.
* test/src/fns-tests.el (test-cycle-lax-plist-get):
(test-cycle-lax-plist-put):
(lax-plist-get/odd-number-of-elements):
(test-plist): Remove lax-plist tests, since semantics have changed
(they no longer error out on cycles).
Allen Li [Mon, 27 Jun 2022 07:46:27 +0000 (09:46 +0200)]
find-dired: Add find-dired-with-command
Add a command that runs and sets up the find-dired buffer with an
arbitrary find command. Also rewrite the existing find-dired commands
using it.
The set of commands possible with find-dired is limited; the new
command allows users to run the full set of commands, but also leaves
the responsibility to the user to construct the command manually.
* lisp/find-dired.el (find-command-history): New var.
(find-dired-with-command): New command.
(find-dired): Rewritten with new command.
Po Lu [Mon, 27 Jun 2022 06:16:52 +0000 (06:16 +0000)]
Implement stipples for images on Haiku
* src/haiku_draw_support.cc (be_draw_bitmap_with_mask): New
function.
* src/haiku_support.h: Add prototype.
* src/haikuterm.c (haiku_draw_image_glyph_string): Draw stipple
correctly.
(haiku_draw_glyph_string): Fix conditions under which
row->stipple_p is set.