F. Jason Park [Sun, 13 Mar 2022 09:34:10 +0000 (01:34 -0800)]
Allow exemption from flood penalty in erc-backend
* lisp/erc/erc-backend (erc-server-send, erc-server-PING): Change name
of param `forcep' in `erc-server-send' to `force' and change its type
to the union of the symbol `no-penalty' and the set of all other
non-nil values. In `erc-server-PING', use this exemption when calling
`erc-server-send'. This fix was fast tracked and summarily
incorporated into bug#48598 because users of the soju bouncer are all
affected. See update #5 in the bug's email thread under the section
entitled "Riders" for an explanation.
F. Jason Park [Fri, 19 Nov 2021 07:39:54 +0000 (23:39 -0800)]
Customize displaying of ERC buffers on reconnect
* lisp/erc/erc-backend.el (erc--server-last-reconnect-count):
Add variable to record last reconnect tally.
* lisp/erc/erc.el (erc-reconnect-display): Add new option to specify
channel-buffer display behavior on reconnect.
(erc-setup-buffer): Use option `erc-reconnect-display' if warranted.
(erc-cmd-JOIN): Forget last reconnect count when issuing a manual
/JOIN command.
(erc-connection-established): Record reconnect count in internal var
before resetting.
(Bug#51753)
F. Jason Park [Wed, 6 Apr 2022 00:45:00 +0000 (17:45 -0700)]
Remove duplicate ERC prompt on reconnect
* lisp/erc/erc-backend.el (erc--unhide-prompt, erc--hide-prompt,
erc--unhide-prompt-on-self-insert): Add functions to ensure prompt is
hidden on disconnect and shown when a user types /reconnect in a
disconnected server buffer.
(erc-process-sentinel): Register aforementioned function with
`pre-command-hook' when prompt is deleted after disconnecting.
(erc-server-PRIVMSG): Ensure prompt is showing when a new message
arrives from target.
* lisp/erc/erc.el (erc-hide-prompt): Repurpose unused option by
changing meaning slightly to mean "selectively hide prompt when
disconnected." Also delete obsolete, commented-out code that at some
point used this option in its prior incarnation.
(erc-prompt-hidden): Add new option to specify look of prompt when
hidden.
(erc-unhide-query-prompt): Add option to force-reveal query prompts on
reconnect.
(erc-open): Augment earlier reconnect-detection semantics by
incorporating `erc--server-reconnecting'. In existing buffers, remove
prompt-related hooks and reveal prompt, if necessary.
(erc-cmd-RECONNECT): Allow a user to reconnect when already
connected (by first disconnecting).
(erc-connection-established): Possibly unhide query prompts.
(Bug#54826)
* test/lisp/erc/erc-tests.el (erc-tests--test-prep,
erc-tests--set-fake-server-process): Factor out some common
buffer-prep boilerplate involving user input and the server process.
Shared with bug#54536.
F. Jason Park [Sun, 3 Apr 2022 21:24:24 +0000 (14:24 -0700)]
Accept user keyword arg in ERC entry-point commands
* lisp/erc/erc-backend.el (erc-server-reconnect): Reuse the username
argument from the previous session's USER command when reconnecting.
Also pass the existing client certificate, fixing an issue related to
bug#47788.
(erc-session-user-full-name): Move variable here from erc.el.
(erc-session-username): Add new local variable to store entry point
parameter.
* lisp/erc/erc.el (erc-session-user-full-name): Move variable to
erc-backend.
(erc-open, erc-determine-parameters, erc, erc-tls): Accept new
optional user parameter.
(erc-query): Preserve current `erc-session-username' when calling
`erc-open'.
(erc-login): Use `erc-session-username' instead of deriving it.
(erc-compute-user): Add new function to determine user name from
explicit argument or user options.
(Bug#54824)
F. Jason Park [Tue, 5 Apr 2022 08:30:07 +0000 (01:30 -0700)]
Initialize erc-server-filter-data in erc-backend
* lisp/erc/erc-backend.el (erc-server-connect): Set
`erc-server-filter-data' to nil upon (re)connecting.
* lisp/erc/erc.el (erc-open): For the sake of clarity, don't
initialize `erc-server-filter-data' here because non-connect
invocations merely set up a target buffer and have no business
touching this variable.
F. Jason Park [Tue, 5 Apr 2022 05:38:22 +0000 (22:38 -0700)]
Rework mutual dependency between erc and erc-backend
* lisp/erc/erc.el: Declare needed variables exported by erc-backend.el
as special near the top of the file, and only require `erc-backend'
after providing `erc' as a feature at the very end.
* lisp/erc/erc-backend.el: Don't preemptively provide `erc-backend'.
* test/lisp/erc/erc-tests.el (erc--meta--backend-dependencies): Add
utility test to scrape for unused vars that may accumulate over time.
(Bug#54825)
* 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).