]> git.eshelyaron.com Git - emacs.git/log
emacs.git
2 years agoRemove purespace and ancillary code scratch/no-purespace scratch/no-purespace-old
Pip Cet [Sun, 16 May 2021 13:44:26 +0000 (15:44 +0200)]
Remove purespace and ancillary code

Now that purespace is not used any more, remove it, along with the functions
used to allocate into it.  Use equivalent functions allocating into the
normal heap.
Remove calls to PURE_P since they always return false.

* src/puresize.h: Delete file.

* src/alloc.c: Don't include `puresize.h` any more.
(pure, purebeg, pure_size, pure_bytes_used_before_overflow)
(pure_bytes_used_lisp, pure_bytes_used_non_lisp, symbol_block_pinned)
(pinned_objects): Delete vars.
(PUREBEG): Delete macro.
(pointer_align): Move after definition of USE_ALIGNED_ALLOC and only
define it if USE_ALIGNED_ALLOC is not used.
(cons_listn): Remove `cons` arg, hardcode `Fcons` instead.
(pure_listn, pure_alloc, check_pure_size, make_pure_string)
(make_pure_c_string, pure_cons): Delete functions.
(init_symbol): Don't set `pinned` any more.
(mark_pinned_objects, mark_pinned_symbols): Delete functions.
(garbage_collect): Don't call them any more.
(init_alloc_once_for_pdumper): Don't initialize purebeg and pure_size.

* src/print.c (print_object) <PVEC_HASH_TABLE>: Don't print `purecopy`.

* src/pdumper.c (dump_symbol, dump_hash_table): Update sig hash.
(dump_symbol): Don't dump `pinned`.
(dump_hash_table): Don't dump `purecopy`.

* src/lread.c (readevalloop, read_internal_start): Adjust call to
`make_hash_table`.
(read0, intern_c_string_1, define_symbol, Fintern): Don't purify
symbol names.
(string): Avoid `pure_cons` and `build_pure_c_string`.

* src/lisp.h (struct Lisp_Symbol): Remove `pinned` field.
(struct Lisp_Hash_Table): Remove `purecopy` field.
(check_pure_size, pure_listn, pure_list, make_pure_string)
(make_pure_c_string, pure_cons): Remove prototypes.
(build_pure_c_string): Delete function.

* src/keymap.c: Don't include `puresize.h` any more.
(Fmake_sparse_keymap): Don't purecopy the menu name.
(Fset_keymap_parent, store_in_keymap): Don't `CHECK_IMPURE` any more.
(syms_of_keymap): Avoid `pure_cons` and `build_pure_c_string`.

* src/intervals.c: Don't include `puresize.h` any more.
(create_root_interval): Don't `CHECK_IMPURE` any more.

* src/fns.c: Don't include `puresize.h` any more.
(Ffillarray, Fclear_string): Don't `CHECK_IMPURE` any more.
(make_hash_table): Remove `purecopy` arg.
(Fmake_hash_table): Remove `:purecopy` keyword argument.

* src/eval.c (Finternal__define_uninitialized_variable): Don't purecopy
the doc any more.
(Fdefconst_1): Don't purecopy the initvalue any more.
(Fautoload): Get rid of hack needed when we used hash-consing.
(syms_of_eval): Avoid `build_pure_c_string`.

* src/emacs.c: Don't include `puresize.h` any more.
(Fdump_emacs): Don't `check_pure_size`.

* src/doc.c (Fsnarf_documentation): Don't purecopy the build files.

* src/deps.mk: Remove puresize.h.

* src/data.c: Don't include `puresize.h` any more.
(pure_write_error): Delete function.
(Fsetcar, Fsetcdr): Don't `CHECK_IMPURE` any more.
(Fdefalias): Don't purecopy the definition any more.
(Faset): Don't `CHECK_IMPURE` any more.
(syms_of_data): Avoid `pure_cons` and `build_pure_c_string`.

* src/conf_post.h (SYSTEM_PURESIZE_EXTRA): Delete macro.

* src/comp.c: Don't include `puresize.h` any more.
(helper_link_table): Remove `pure_write_error`.
(define_CHECK_IMPURE): Delete function.
(maybe_defer_native_compilation, syms_of_comp):
Avoid `build_pure_c_string`.

* src/category.c (hash_get_category_set): Update call to `make_hash_table`.
(Fdefine_category): Don't purecopy the docstring any more.

* src/bytecode.c: Don't include `puresize.h` any more.
(Bsetcar, Bsetcdr): Don't `CHECK_IMPURE` any more.

* doc/lispref/internals.texi (Pure Storage): Delete section.
(Garbage Collection): Remove note about purespace overflow.

* src/xfaces.c (syms_of_xfaces):
* src/emacs-module.c (syms_of_module):
* src/frame.c (make_frame, make_initial_frame):
* src/fileio.c (syms_of_fileio):
* src/image.c (xpm_make_color_table_h):
* src/process.c (ADD_SUBFEATURE, syms_of_process):
* src/profiler.c (make_log):
* src/json.c (define_error):
* src/xterm.c (syms_of_xterm):
* src/xfns.c (syms_of_xfns):
* src/xdisp.c (syms_of_xdisp):
* src/w32fns.c (syms_of_w32fns):
* src/syntax.c (syms_of_syntax):
* src/sqlite.c (syms_of_sqlite):
* src/search.c (syms_of_search):
* src/keyboard.c (syms_of_keyboard):
* src/fontset.c (syms_of_fontset):
* src/dbusbind.c (syms_of_dbusbind):
* src/coding.c (syms_of_coding):
* src/callint.c (syms_of_callint):
* src/buffer.c (init_buffer_once, syms_of_buffer):
Avoid `build_pure_c_string`, `Fpurecopy`, `pure_cons`, and `pure_list`,
and adjust calls to `make_hash_table`.

2 years agosrc/alloc.c: Remove all uses of `pure_alloc`
Stefan Monnier [Fri, 1 Jul 2022 18:36:49 +0000 (14:36 -0400)]
src/alloc.c: Remove all uses of `pure_alloc`

First step of removal of the purespace: stop using it.
The more delicate parts are the handling of 0-length strings and
vectors which we used to allocate in purespace but now need to be
allocated elsewhere, but the existing code makes us work harder to
allocate them in the normal way.

* src/alloc.c: Remove all uses of `pure_alloc`.
(init_strings): Alloc empty strings in the normal heap.
(init_vectors): Allocate the zero_vector in the normal heap.
(make_pure_string, make_pure_c_string, pure_cons): Rewrite to create
normal heap objects.
(find_string_data_in_pure, make_pure_float, make_pure_bignum)
(make_pure_vector, purecopy_hash_table): Delete functions.
(purecopy): Return without purecopying.

2 years agoFix elisp-byte-compile-buffer requirements
Lars Ingebrigtsen [Fri, 1 Jul 2022 11:19:31 +0000 (13:19 +0200)]
Fix elisp-byte-compile-buffer requirements

* lisp/progmodes/elisp-mode.el (elisp-byte-compile-buffer):
Require bytecomp so that byte-compile-dest-file-function is
defined.  (The byte compiler didn't catch this, because it's
defined in bytecomp.)

2 years agoFix typo in Property Search manual entry
dick r. chiang [Fri, 1 Jul 2022 10:49:36 +0000 (12:49 +0200)]
Fix typo in Property Search manual entry

* doc/lispref/text.texi (Property Search): Fix typo (bug#56329).

2 years agoMake time-stamp-tests.el work in a Norwegian language enviroment
Lars Ingebrigtsen [Fri, 1 Jul 2022 10:12:49 +0000 (12:12 +0200)]
Make time-stamp-tests.el work in a Norwegian language enviroment

The short version of names for days/month is not necessary the same as
limiting the string with a #n operator.  For instance:

(format-time-string "%^A" time)
=> "FREDAG"

(format-time-string "%^a" time)
=> "FR."

(time-stamp-string "%#3a" time)
=> "FRE"

2 years agoDocument XDS stuff
Po Lu [Fri, 1 Jul 2022 10:10:39 +0000 (18:10 +0800)]
Document XDS stuff

* doc/emacs/frames.texi (Drag and Drop):
* doc/lispref/frames.texi (Drag and Drop): Add documentation
about XDS features.
* etc/NEWS: Tag entry.

2 years agoMake it easier to debug nnimap-retrieve-headers
Lars Ingebrigtsen [Fri, 1 Jul 2022 09:49:29 +0000 (11:49 +0200)]
Make it easier to debug nnimap-retrieve-headers

* lisp/gnus/nnimap.el (nnimap--max-retrieve-headers): New variable
to ease debugging.
(nnimap-retrieve-headers): Use it.

2 years agoMake the emoji-zoom commands use a transient map for repetition
Lars Ingebrigtsen [Fri, 1 Jul 2022 09:11:47 +0000 (11:11 +0200)]
Make the emoji-zoom commands use a transient map for repetition

* lisp/international/emoji.el (emoji-zoom-increase)
(emoji-zoom-decrease): Use a transient map for convenience.

2 years ago; * test/lisp/erc/erc-networks-tests.el: escape `*`s in regexp
Mattias Engdegård [Fri, 1 Jul 2022 09:00:41 +0000 (11:00 +0200)]
; * test/lisp/erc/erc-networks-tests.el: escape `*`s in regexp

2 years agoExpand file names read from XDS functions
Po Lu [Fri, 1 Jul 2022 08:32:37 +0000 (16:32 +0800)]
Expand file names read from XDS functions

* lisp/x-dnd.el (x-dnd-handle-xds-drop): Expand file names
before use.  Some GUI dialogs read un-expanded file names.

2 years agoPrevent XdndPosition messages from rarely being sent out of band
Po Lu [Fri, 1 Jul 2022 08:17:11 +0000 (16:17 +0800)]
Prevent XdndPosition messages from rarely being sent out of band

* src/xterm.c (handle_one_xevent): Don't clear
`x_dnd_waiting_for_status_window' if a pending position message
was sent in reply to an XdndStatus event.

2 years agoSupport receiving XDS drops correctly
Po Lu [Fri, 1 Jul 2022 08:12:45 +0000 (16:12 +0800)]
Support receiving XDS drops correctly

* etc/NEWS: Announce new feature.  It is not yet documented.
* lisp/x-dnd.el (x-dnd-known-types): Add XdndDirectSave0.
(x-dnd-direct-save-function): New defcustom.
(x-dnd-xdnd-to-action): Add `direct-save'.
(x-dnd-maybe-call-test-function): If XDS is present, use `direct-save'.
(x-dnd-find-type): New function.
(x-dnd-handle-xdnd): Handle XDS position and drop messages.
(x-dnd-handle-direct-save): Don't use local-file-uri if nil.
(x-dnd-save-direct): New function.
(x-dnd-handle-octet-stream-for-drop):
(x-dnd-handle-xds-drop): New functions.

2 years ago; Fix documentation of recent ERC changes
Eli Zaretskii [Fri, 1 Jul 2022 07:13:07 +0000 (10:13 +0300)]
; Fix documentation of recent ERC changes

* lisp/erc/erc.el (erc-inhibit-multiline-input)
(erc-ask-about-multiline-input): Doc fixes.

* doc/misc/erc.texi (Connecting): Fix typos, grammar, wording,
punctuation, markup, and indexing.

2 years ago; Tag ERC channel-buffers test as unstable
F. Jason Park [Fri, 1 Jul 2022 05:43:41 +0000 (22:43 -0700)]
; Tag ERC channel-buffers test as unstable

* test/lisp/erc/erc-networks-tests.el (erc-networks--id,
erc-networks--id-create): Attempt to fix arity of mocked `float-time'.

* test/lisp/erc/erc-scenarios-base-reuse-buffers.el
(erc-scenarios-base-reuse-buffers-channel-buffers--disabled): Tag as
being unstable.

2 years agoUpdate publicsuffix.txt from upstream
Stefan Kangas [Fri, 1 Jul 2022 04:01:14 +0000 (06:01 +0200)]
Update publicsuffix.txt from upstream

* etc/publicsuffix.txt: Update from
https://publicsuffix.org/list/public_suffix_list.dat
dated 2022-06-29 19:13:08 UTC.

2 years agoAdd tests for XDS protocol support
Po Lu [Fri, 1 Jul 2022 03:31:25 +0000 (11:31 +0800)]
Add tests for XDS protocol support

* test/lisp/x-dnd-tests.el (x-dnd-tests-xds-property-value): New
variable.
(x-window-property): Handle new kind of window property.
(x-dnd-tests-xds-target-dir, x-dnd-tests-xds-name)
(x-dnd-tests-xds-include-hostname): New variables.
(x-dnd-tests-call-xds-converter): New function.
(x-begin-drag, x-change-window-property):
(x-delete-window-property): New replacement functions.
(x-dnd-tests-do-direct-save-internal): New function.
(x-dnd-tests-do-direct-save): New test.

2 years agoFix `clipboard-yank' inserting off the kill ring instead of CLIPBOARD
Po Lu [Fri, 1 Jul 2022 02:23:13 +0000 (10:23 +0800)]
Fix `clipboard-yank' inserting off the kill ring instead of CLIPBOARD

* lisp/select.el (gui-last-cut-in-clipboard)
(gui-last-cut-in-primary): New variables.
(gui-select-text): Set those variables.
(gui--selection-value-internal, gui-selection-value): Don't
return nil if the last cut did not own the chosen
selection.  (bug#56325)

2 years agoDisable middle click selection emulation during XDS
Po Lu [Fri, 1 Jul 2022 01:10:34 +0000 (09:10 +0800)]
Disable middle click selection emulation during XDS

* doc/lispref/frames.texi (Drag and Drop): Document new
variable.
* lisp/x-dnd.el (x-dnd-do-direct-save): Disable drop emulation
during XDS drag-and-drop.

* src/keyboard.c (kbd_buffer_get_event): Handle recorded value.
* src/xterm.c (x_dnd_do_unsupported_drop): Return if new
variable is nil.
(x_dnd_send_unsupported_drop): Record value of new variable in
events.
(x_dnd_begin_drag_and_drop): Handle recorded value.
(syms_of_xterm): New variable `x-dnd-use-unsupported-drop'.

2 years ago; Help ERC test fixture better withstand reordering
F. Jason Park [Fri, 1 Jul 2022 00:15:25 +0000 (17:15 -0700)]
; Help ERC test fixture better withstand reordering

* test/lisp/erc/erc-tests.el (erc-tests--with-process-input-spy):
Shadow hook to prevent the erc-button module from interfering with
tests using this helper.

2 years agoUpdate ERC's Info doc with network-ID related changes
F. Jason Park [Fri, 18 Jun 2021 11:25:44 +0000 (04:25 -0700)]
Update ERC's Info doc with network-ID related changes

* doc/misc/erc.texi: Update the `erc' and `erc-tls' entry-point
sections with the new :id keyword parameter.  Expand the auth-info
related information in the passwords section.  Remove all mention of
the variable `erc-rename-buffers', whose "on" behavior has been made
permanent.

* etc/ERC-NEWS: Add new section for future 5.5 release.

2 years agoOptionally prevent sending multiline input in ERC
F. Jason Park [Wed, 27 Apr 2022 09:27:32 +0000 (02:27 -0700)]
Optionally prevent sending multiline input in ERC

* lisp/erc/erc.el (erc-inhibit-multiline-input): Add option to cap the
number of lines to be sent before admonishing the user.
(erc-ask-about-multiline-input): Add option to ask instead of warning
user when `erc-inhibit-multiline-input' is reached.
(erc--check-prompt-input-for-excess-lines): Add validator to possibly
warn when too many lines are submitted for transmission.

* test/lisp/erc/erc-tests.el
(erc--check-prompt-input-for-excess-lines): Add test.
(Bug#54536)

2 years agoImprove ERC's handling of multiline prompt input
F. Jason Park [Mon, 21 Mar 2022 12:40:16 +0000 (05:40 -0700)]
Improve ERC's handling of multiline prompt input

* lisp/erc/erc.el (erc--pre-send-split-functions): Add new internal
hook allowing members to revise individual lines before sending.  This
was created with an eye toward possibly exporting it publicly as a
customizable option.
(erc-last-input-time): Tweak meaning of variable to match likely
original intent, which is that it's only updated on successful calls
to `erc-send-current-line'.
(erc--discard-trailing-multiline-nulls): Conditionally truncate list
of lines to be sent, skipping trailing blanks.  This constitutes a
behavioral change.  But, considering the nature of the bug being
fixed, it is thought to be justified.
(erc--input-split): Add new internal struct containing split input
lines and flag for command detection.
(erc--input-line-delim-regexp): Add regex var for splitting multiline
prompt input.
(erc--blank-in-multiline-p): Add helper for detecting blank lines.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-point-in-bounds,
erc--check-prompt-input-for-running-process): New functions to
encapsulate logic for various pre-flight idiot checks.
(erc--check-prompt-input-functions): Add new hook for validating
prompt input prior to clearing it, internal for now.
(erc-send-current-line): Pre-screen for blank lines and bail out if
necessary.
(erc-send-input): Add optional param to skip checking for blank lines.
Call hook `erc--pre-send-split-functions'.

* test/lisp/erc/erc-tests.el (erc-ring-previous-command): Use new test
helper.
(erc--input-line-delim-regexp,
erc--blank-in-multiline-input-p): Add tests.
(erc-tests--send-prep, erc-tests--set-fake-server-process,
erc-tests--with-process-input-spy): Add test helpers.
(erc--check-prompt-input-functions, erc-send-current-line,
erc-send-whitespace-lines): Add tests.
(Bug#54536)

2 years agoFix regression in erc-send-input-line
F. Jason Park [Tue, 22 Mar 2022 02:21:57 +0000 (19:21 -0700)]
Fix regression in erc-send-input-line

* lisp/erc/erc.el (erc-send-input-line): Restore remedial single-space
padding to ensure empty messages typed at the prompt without an
explicit /msg aren't rejected by the server.  This behavior is only
noticeable when `erc-send-whitespace-lines' is active.

* test/lisp/erc/erc-tests.el (erc-process-input-line): Add trailing
newline to more correctly simulate how it's actually called by
`erc-send-input'. (Bug#50008)

2 years agoStandardize auth-source queries in ERC
F. Jason Park [Mon, 16 Aug 2021 11:38:18 +0000 (04:38 -0700)]
Standardize auth-source queries in ERC

* lisp/erc/erc.el (erc-password): Deprecate variable only used by
`erc-select-read-args'.  Server passwords are primarily used as
surrogates for other forms of authentication.  Such use is common but
nonstandard and often discouraged in favor of the de facto standard,
SASL.  Folks in the habit of invoking `erc(-tls)' interactively should
be encouraged to use auth-source instead.
(erc-select-read-args): Before this change, `erc-select-read-args'
offered to use the value of a non-nil `erc-password' as the :password
argument for `erc' and `erc-tls', referring to it as the "default"
password.  And when `erc-prompt-for-password' was nil and
`erc-password' wasn't, the latter was passed along unconditionally.
This only further complicated an already confusing situation for new
users, who in most cases shouldn't be worried about sending a PASS
command at all.  Until SASL arrives, they should provide server
passwords manually or learn to use auth-source.
(erc-auth-source-server-function, erc-auth-source-join-function): New
user options for retrieving a password externally, ostensibly by
calling `auth-source-search'.
(erc--auth-source-determine-params-defaults): New helper for
`erc--auth-source-search' with potential for exporting publicly in the
future.  Favors :host and :port fields above others.  Prioritizes
network IDs over announced servers and dialed endpoints.
(erc--auth-source-determine-params-merge): Add new function for
merging contextual and default parameters.  This is another contender
for possible exporting.
(erc--auth-source-search): New function for consulting auth-source and
sorting the result as filtered and prioritized by the previously
mentioned helpers.
(erc-auth-source-search): New function to serve as default
value for auth-source query-function options.
(erc-server-join-channel): Use user option for consulting auth-source
facility.  Also accept nil for first argument (instead of server).
(erc-cmd-JOIN): Use above-mentioned facilities when joining new
channel.  Omit server when calling `erc-server-join-channel'.  Don't
filter target buffers twice.  Don't call `switch-to-buffer', which
would create phantom buffers with names like target/server that were
never used.  IOW, only switch to existing target buffers.
(erc--compute-server-password): Add new helper function for
determining password.
(erc-open, erc-determine-parameters): Move password figuring from the
first to the latter.

* lisp/erc/erc-services.el
(erc-auth-source-services-function): Add new option for consulting
auth-source in a NickServ context.
(erc-nickserv-get-password): Pass network-context ID, when looking up
password in `erc-nickserv-passwords' and when formatting prompt for
user input.
(erc-nickserv-passwords): Add comment to custom option definition type
tag.

* test/lisp/erc/erc-services-tests.el: Add new test file for above
changes.  For now, stash auth-source-related tests here until a
suitable home can be found.

* lisp/erc/erc-join.el (erc-autojoin--join): Don't pass session-like
entity from `erc-autojoin-channels-alist' match to
`erc-server-join-channel'.  Allow that function to decide for itself
which host to look up if necessary.

* test/lisp/erc/resources/base/auth-source/foonet.eld: New file.
* test/lisp/erc/resources/base/auth-source/nopass.eld: New file.
* test/lisp/erc/resources/erc-scenarios-common.el: New file.
* test/lisp/erc/resources/services/auth-source/libera.eld: New file.
* test/lisp/erc/erc-scenarios-auth-source.el: New file.
* test/lisp/erc/erc-scenarios-base-reuse-buffers.el: New file.
* test/lisp/erc/erc-scenarios-join-auth-source.el: New file.
* test/lisp/erc/resources/base/reuse-buffers/channel/barnet.eld: New file.
* test/lisp/erc/resources/base/reuse-buffers/channel/foonet.eld: New file.
* test/lisp/erc/resources/join/auth-source/foonet.eld: New file.
(Bug#48598)

2 years agoFavor network identities in erc-join
F. Jason Park [Sun, 30 May 2021 07:50:50 +0000 (00:50 -0700)]
Favor network identities in erc-join

* lisp/erc/erc-join.el (erc-autojoin-server-match): Favor network
identities, falling back on old definition.
(erc-autojoin--join): Add new helper containing common code from
hookees `erc-autojoin-after-ident' and `erc-autojoin-channels'.
(erc-autojoin-after-ident, erc-autojoin-channels): No longer make a
point of returning nil because the hooks they're registered on,
`erc-nickserv-identified-hook' and `erc-after-connect', don't stop on
success.
(erc-autojoin--mutate): Add helper for `erc-autojoin-add' and
`erc-autojoin-remove'.
(erc-autojoin-add, erc-autojoin-remove): Favor given network
identities, over networks, when matching keys for
`erc-autojoin-channels-alist'.

* test/lisp/erc/erc-scenarios-base-reconnect.el: New file.
* test/lisp/erc/erc-scenarios-join-netid-newcmd-id.el: New file.
* test/lisp/erc/erc-scenarios-join-netid-newcmd.el: New file.
* test/lisp/erc/erc-scenarios-join-netid-recon-id.el: New file.
* test/lisp/erc/erc-scenarios-join-netid-recon.el: New file.
* test/lisp/erc/resources/erc-scenarios-common.el: New file.
* test/lisp/erc/resources/join/legacy/foonet.eld: New file.
* test/lisp/erc/resources/join/network-id/barnet.eld: New file.
* test/lisp/erc/resources/join/network-id/foonet-again.eld: New file.
* test/lisp/erc/resources/join/network-id/foonet.eld: New file.
* test/lisp/erc/resources/join/reconnect/foonet-again.eld: New file.
* test/lisp/erc/resources/join/reconnect/foonet.eld: New file.

2 years agoDon't call erc-auto-query twice on PRIVMSG
F. Jason Park [Fri, 7 May 2021 08:52:41 +0000 (01:52 -0700)]
Don't call erc-auto-query twice on PRIVMSG

* lisp/erc/erc-backend.el (erc-server-JOIN): Use `erc--open-target'
instead of `erc-join'.
(erc-server-PRIVMSG): Don't call `erc-auto-query' at all, and instead
borrow the portion of its logic that detects when a query buffer
should be created instead of a channel buffer.

* lisp/erc/erc.el (erc-cmd-QUERY): Update the mode line explicitly
after calling `erc-query' in case it's needed after `erc-setup-buffer'
runs. Simplify.
(erc-query, erc--open-target): Replace uses of `erc-query'
with `erc--open-target' and make the former obsolete.  Don't call
`erc-update-mode-line' because `erc-open' already does that.
(erc-auto-query): Make this function obsolete.  It was previously only
used in erc-backend.el and only sewed confusion.
(erc-query-on-unjoined-chan-privmsg): Add note questioning its role.
It was previously only used by the now deprecated `erc-auto-query'.

* test/lisp/erc/erc-scenarios-misc.el
(erc-scenarios-base-mask-target-routing): Add test for server masks.
* test/lisp/erc/resources/base/mask-target-routing/foonet.eld: New file.

2 years agoRegister erc-kill-buffer-function locally
F. Jason Park [Thu, 28 Oct 2021 04:13:24 +0000 (21:13 -0700)]
Register erc-kill-buffer-function locally

* lisp/erc/erc.el (erc-kill-buffer-function): Don't add hook when
loading file.  Move to major-mode setup and make buffer-local instead.
Depends on tests in bug#48598.

2 years agoAdd user-oriented test scenarios for ERC
F. Jason Park [Thu, 13 May 2021 12:55:22 +0000 (05:55 -0700)]
Add user-oriented test scenarios for ERC

* test/lisp/erc/erc-scenarios-base-association-nick.el: New file.
* test/lisp/erc/erc-scenarios-base-association-samenet.el: New file.
* test/lisp/erc/erc-scenarios-base-association.el: New file.
* test/lisp/erc/erc-scenarios-base-compat-rename-bouncer.el: New file.
* test/lisp/erc/erc-scenarios-base-misc-regressions.el: New file.
* test/lisp/erc/erc-scenarios-base-netid-bouncer-id.el: New file.
* test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-base.el: New file.
* test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-both.el: New file.
* test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-id.el: New file.
* test/lisp/erc/erc-scenarios-base-netid-bouncer.el: New file.
* test/lisp/erc/erc-scenarios-base-netid-samenet.el: New file.
* test/lisp/erc/erc-scenarios-base-reconnect.el: New file.
* test/lisp/erc/erc-scenarios-base-renick.el: New file.
* test/lisp/erc/erc-scenarios-base-reuse-buffers.el: New file.
* test/lisp/erc/erc-scenarios-base-unstable.el: New file.
* test/lisp/erc/erc-scenarios-base-upstream-recon-soju.el: New file.
* test/lisp/erc/erc-scenarios-base-upstream-recon-znc.el: New file.
* test/lisp/erc/erc-scenarios-misc.el: New file.
* test/lisp/erc/erc-scenarios-services-misc.el: New file.
* test/lisp/erc/resources/base/assoc/bouncer-history/barnet.eld: New file.
* test/lisp/erc/resources/base/assoc/bouncer-history/foonet.eld: New file.
* test/lisp/erc/resources/base/assoc/bumped/again.eld: New file.
* test/lisp/erc/resources/base/assoc/bumped/foisted.eld: New file.
* test/lisp/erc/resources/base/assoc/bumped/refoisted.eld: New file.
* test/lisp/erc/resources/base/assoc/bumped/renicked.eld: New file.
* test/lisp/erc/resources/base/assoc/multi-net/barnet.eld: New file.
* test/lisp/erc/resources/base/assoc/multi-net/foonet.eld: New file.
* test/lisp/erc/resources/base/assoc/reconplay/again.eld: New file.
* test/lisp/erc/resources/base/assoc/reconplay/foonet.eld: New file.
* test/lisp/erc/resources/base/assoc/samenet/chester.eld: New file.
* test/lisp/erc/resources/base/assoc/samenet/tester.eld: New file.
* test/lisp/erc/resources/base/assoc/samenet/tester2.eld: New file.
* test/lisp/erc/resources/base/channel-buffer-revival/foonet.eld: New file.
* test/lisp/erc/resources/base/flood/soju.eld: New file.
* test/lisp/erc/resources/base/gapless-connect/barnet.eld: New file.
* test/lisp/erc/resources/base/gapless-connect/foonet.eld: New file.
* test/lisp/erc/resources/base/gapless-connect/pass-stub.eld: New file.
* test/lisp/erc/resources/base/netid/bouncer/barnet-again.eld: New file.
* test/lisp/erc/resources/base/netid/bouncer/barnet-drop.eld: New file.
* test/lisp/erc/resources/base/netid/bouncer/barnet.eld: New file.
* test/lisp/erc/resources/base/netid/bouncer/foonet-again.eld: New file.
* test/lisp/erc/resources/base/netid/bouncer/foonet-drop.eld: New file.
* test/lisp/erc/resources/base/netid/bouncer/foonet.eld: New file.
* test/lisp/erc/resources/base/netid/bouncer/stub-again.eld: New file.
* test/lisp/erc/resources/base/netid/samenet/chester.eld: New file.
* test/lisp/erc/resources/base/netid/samenet/tester.eld: New file.
* test/lisp/erc/resources/base/reconnect/aborted-dupe.eld: New file.
* test/lisp/erc/resources/base/reconnect/aborted.eld: New file.
* test/lisp/erc/resources/base/reconnect/options-again.eld: New file.
* test/lisp/erc/resources/base/reconnect/options.eld: New file.
* test/lisp/erc/resources/base/reconnect/timer-last.eld: New file.
* test/lisp/erc/resources/base/reconnect/timer.eld: New file.
* test/lisp/erc/resources/base/renick/queries/bouncer-barnet.eld: New file.
* test/lisp/erc/resources/base/renick/queries/bouncer-foonet.eld: New file.
* test/lisp/erc/resources/base/renick/queries/solo.eld: New file.
* test/lisp/erc/resources/base/renick/self/auto.eld: New file.
* test/lisp/erc/resources/base/renick/self/manual.eld: New file.
* test/lisp/erc/resources/base/renick/self/qual-chester.eld: New file.
* test/lisp/erc/resources/base/renick/self/qual-tester.eld: New file.
* test/lisp/erc/resources/base/reuse-buffers/server/barnet.eld: New file.
* test/lisp/erc/resources/base/reuse-buffers/server/foonet.eld: New file.
* test/lisp/erc/resources/base/upstream-reconnect/soju-barnet.eld: New file.
* test/lisp/erc/resources/base/upstream-reconnect/soju-foonet.eld: New file.
* test/lisp/erc/resources/base/upstream-reconnect/znc-barnet.eld: New file.
* test/lisp/erc/resources/base/upstream-reconnect/znc-foonet.eld: New file.
* test/lisp/erc/resources/erc-scenarios-common.el: New file.
* test/lisp/erc/resources/networks/announced-missing/foonet.eld: New file.
* test/lisp/erc/resources/services/password/libera.eld: New file.

Add test cases for locking down fundamental client behavior, much of
it involving the relationship between buffers and connections.  Also
add accompanying resources subdir containing canned dialog scripts and
common code needed by various tests.  For test cases demoing the
problematic behavior originally described in the initial report, see
update #4 on the bug tracker thread for bug#48598.  Most reside in a
file named test/lisp/erc/erc-scenarios-48598.el introduced by the
patch "Add user-oriented test scenarios for ERC".

2 years agoAddress long-standing ERC buffer-naming issues
F. Jason Park [Mon, 3 May 2021 12:54:56 +0000 (05:54 -0700)]
Address long-standing ERC buffer-naming issues

* lisp/erc/erc-backend.el (erc-server-connected): Revise doc string.
(erc-server-reconnect, erc-server-JOIN): Reuse original ID param from
the first connection when calling `erc-open'.
(erc-server-NICK): Apply same name generation process used by
`erc-open'; except here, do so for the purpose of "re-nicking".
Update network identifier and maybe buffer names after a user's own
nick changes.

* lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed,
erc-networks--id-qualifying): Define new set of structs to contain all
info relevant to specifying a unique identifier for a network context.
Add a new variable `erc-networks--id' to store a local reference to a
`erc-networks--id' object, shared among all buffers in a logical
session.
(erc-networks--id-given, erc-networks--id-create,
erc-networks--id-on-connect, erc-networks--id--equal-p,
erc-networks--id-qualifying-init-parts,
erc-networks--id-qualifying-init-symbol,
erc-networks--id-qualifying-grow-id,
erc-networks--id-qualifying-reset-id,
erc-networks--id-qualifying-prefix-length,
erc-networks--id-qualifying-update, erc-networks--id-reload,
erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers):
Add new functions to support management of `erc-networks--id' struct
instances.
(erc-networks--id-sep): New variable for to help when formatting
buffer names.
(erc-obsolete-var): Define new generic context rewriter.
(erc-networks-shrink-ids-and-buffer-names,
erc-networks--refresh-buffer-names,
erc-networks--shrink-ids-and-buffer-names-any): Add functions to
reassess all network IDs and shrink them if necessary along with
affected buffer names.  Also add function to rename buffers so that
their names are unique.  Register these on all three of ERC's
kill-buffer hooks because an orphaned target buffer is enough to keep
its session alive.
(erc-networks-rename-surviving-target-buffer): Add new function that
renames a target buffer when it becomes the sole bearer of a name
based on a target that has become unique across all sessions and, in
most cases, all networks.  IOW, remove the @NETWORK-ID suffix from the
last remaining channel or query buffer after its namesakes have all
been killed off.  Register this function with ERC's target-related
kill-buffer hooks.
(erc-networks--examine-targets): Add new utility function that visits
all ERC buffers and runs callbacks when a buffer-name collision is
encountered.
(erc-networks--qualified-sep): Add constant to hold separator between
target and suffix.
(erc-networks--construct-target-buffer-name,
erc-networks--ensure-unique-target-buffer-name,
erc-networks--ensure-unique-server-buffer-name,
erc-networks--maybe-update-buffer-name): Add helpers to support
`erc-networks--reconcile-buffer-names' and friends.
(erc-networks--reconcile-buffer-names): Add new buffer-naming strategy
function and helper for `erc-generate-new-buffer-name' that only run
in target buffers.
(erc-determine-network, erc-networks--determine): Deprecate former and
partially replace with latter, which demotes RPL_ISUPPORT-derived
NETWORK name to fallback in favor of known `erc-networks-alist'
members as part of shift to network-based connection-identity policy.
Return sentinel on failure.  Expect `erc-server-announced-name' to be
set, and signal when it's not.
(erc-networks--name-missing-sentinel): Value returned when new
function `erc-networks--determine' fails to find network name.  The
rationale for not making this customizable is that the value signifies
the pathological case where a user of an uncommon IRC setup has not
yet set a mapping from announced- to network name.  And the chances of
there being multiple unknown networks is low.
(erc-set-network-name, erc-networks--set-name): Deprecate former and
partially replace with latter.  Ding with helpful message, and don't
set `erc-network' when network name is not found.
(erc-networks--ensure-announced): Add new fallback function to ensure
`erc-server-announced-name' is set.  Register with post-MOTD hooks.
(erc-unset-network-name): Deprecate function unused internally.
(erc-networks--insert-transplanted-content,
erc-networks--reclaim-orphaned-target-buffers,
erc-networks--copy-over-server-buffer-contents,
erc--update-server-identity): Add helpers for
`erc-networks--rename-server-buffer'.  The first re-associates all
existing target buffers that ought to be owned by the new server
process.  The second grabs buffer text from an old, dead server buffer
before killing it.  It then inserts that text above everything in the
current, replacement server buffer.  The other two massage the IDs of
related sessions, possibly renaming them as well.  They may also
uniquify the current session's network ID.
(erc-networks--init-identity): Add new function to perform one-time
session-related setup.  This could be combined with
`erc-set-network-name'.
(erc-networks--rename-server-buffer): Add new function to replace
`erc-unset-network-name' as default `erc-disconnected-hook' member;
renames server buffers once network is discovered; added to/removed
from `erc-after-connect' hook on `erc-networks' minor mode.
(erc-networks--bouncer-targets): Add constant to hold target symbols
of well known bouncer-configuration bots.
(erc-networks-on-MOTD-end): Add primary network-context handler to run
on 376/422 functions, just before logical connection is officially
established.
(erc-networks-enable, erc-networks-mode): Register main network-setup
handler with 376/422 hooks.

* lisp/erc/erc.el (erc-rename-buffers): Change this option's default
to t, remove the only instance where it's actually used, and make it
an obsolete variable.
(erc-reuse-buffers): Make this an obsolete variable, but take pains to
ensure its pre-28.1 behavior is preserved.  That is, undo the
regression involving unwanted automatic reassociation of channel
buffers during joins, which arrived in ERC 5.4 and effectively
inverted the meaning of this variable, when nil, for channel buffers,
all without accompanying documentation or announcement.
(erc-generate-new-buffer-name): Replace current policy of appending a
slash and the invocation host name.  Favor instead temporary names for
server buffers and network-based uniquifying suffixes for channels and
query buffers.  Fall back to the TCP host:port<n> convention when
necessary.  Accept additional optional params after the others.
(erc-get-buffer-create): Don't generate a new name when reconnecting,
just return the same buffer.  `erc-open' starts from a clean slate
anyway, so this just keeps things simple.  Also add optional params.
(erc-open): Add new ID param to for a network identifier explicitly
passed to an entry-point command.  This is stored in the `given' slot
of the `erc-network--id' object.  Also initialize the latter in new
connections and otherwise copy it over.  As part of the push to recast
erc-networks.el as an essential library, set `erc-network' explicitly,
when known, rather than via hooks.
(erc, erc-tls): Add new ID keyword parameter and pass it to
`erc-open'.
(erc-log-irc-protocol): Use `erc--network-id' instead of the function
`erc-network' to determine preferred peer name.
(erc-format-target-and/or-network): This is called frequently from
mode-line updates, so renaming buffers here is not ideal.  Instead, do
so in `erc-networks--rename-server-buffer'.
(erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names'
as default member.
(erc-kill-channel-hook, erc-kill-buffer-hook): Add
`erc-networks-shrink-ids-and-buffer-names' and
`erc-networks-rename-surviving-target-buffer' as default member.

* test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID
focused internal API.

* test/lisp/erc/erc-networks-tests.el: Add new file that includes
tests for the above network-ID focused functions.

See bug#48598 for background on all of the above.

2 years agoAdd ERC test server and related resources
F. Jason Park [Thu, 13 May 2021 10:33:33 +0000 (03:33 -0700)]
Add ERC test server and related resources

* test/lisp/erc/resources/erc-d/erc-d.el: New file.
* test/lisp/erc/resources/erc-d/erc-d-u.el: New file.
* test/lisp/erc/resources/erc-d/erc-d-i.el: New file.
* test/lisp/erc/resources/erc-d/erc-d-t.el: New file.
* test/lisp/erc/resources/erc-d/erc-d-tests.el: New file.

* test/lisp/erc/erc-scenarios-internal.el: New file to serve as
discoverable proxy for erc-d-tests.

2 years agoDiscourage ill-defined use of buffer targets in ERC
F. Jason Park [Wed, 20 Oct 2021 10:52:18 +0000 (03:52 -0700)]
Discourage ill-defined use of buffer targets in ERC

* lisp/erc/erc.el (erc-default-recipients, erc-default-target):
Explain that the variable has fallen out of favor and that the
function may have been used historically by third-party code for
detecting channel subscription status, even though that's never been
the case internally since at least the adoption of version control.
Recommend newer alternatives.

(erc--current-buffer-joined-p): Add possibly temporary predicate for
detecting whether a buffer's target is a joined channel.  The existing
means are inconsistent, as discussed in bug#48598.  The mere fact that
they are disparate is unfriendly to new contributors.  For example, in
the function `erc-autojoin-channels', the `process-status' of the
`erc-server-process' is used to detect whether a buffer needs joining.
That's fine in that specific situation, but it won't work elsewhere.
And neither will checking whether `erc-default-target' is nil, so
long as `erc-delete-default-channel' and friends remain in play.

(erc-add-default-channel, erc-delete-default-channel, erc-add-query,
erc-delete-query): Deprecate these helpers, which rely on an unused
usage variant of `erc-default-recipients'.

* lisp/erc/erc-services.el: remove stray `erc-default-recipients'
declaration.

* lisp/erc/erc-backend.el (erc-server-NICK, erc-server-JOIN,
erc-server-KICK, erc-server-PART): wrap deprecated helpers to suppress
warnings.

* lisp/erc/erc-join.el (erc-autojoin-channels): Use helper to detect
whether a buffer needs joining.  Prefer this to server liveliness, as
explained above.

2 years agoAdd eventual replacement for erc-default-recipients
F. Jason Park [Wed, 20 Oct 2021 05:53:03 +0000 (22:53 -0700)]
Add eventual replacement for erc-default-recipients

* lisp/erc/erc.el (erc--target, erc--target-channel,
erc--target-channel-local): Add new structs to hold info on a buffer's
target; stored in a local variable of the same name.
(erc--target-from-string): Add standalone constructor for
`erc--target'.
(erc--default-target): Add temporary internal getter to ease
transition to `erc--target' everywhere.
(erc-open): Create above items in non-server buffers.

* lisp/erc/erc-backend.el (erc-server-NICK): Recreate `erc--target'
when necessary.

2 years agoAdd helper to determine local channels in ERC
F. Jason Park [Mon, 16 Aug 2021 12:01:16 +0000 (05:01 -0700)]
Add helper to determine local channels in ERC

* lisp/erc/erc.el (erc--valid-local-channel-p): Add internal helper to
determine whether an IRC channel is local according to its network's
CHANTYPES ISUPPORT parameter.

* test/lisp/erc/erc-tests.el (erc--valid-local-channel-p): Add test
for this helper.

2 years agoMake ERC respect spaces in server passwords
F. Jason Park [Mon, 16 Aug 2021 04:57:24 +0000 (21:57 -0700)]
Make ERC respect spaces in server passwords

* lisp/erc/erc.el (erc-login): Also known as connection passwords,
these are sent as the sole arg to the PASS command, which is nowadays
often overloaded with other semantics imposed by various entities to
convey things like bouncer or services creds.

2 years agoRecognize ASCII and strict CASEMAPPINGs in ERC
F. Jason Park [Wed, 6 Oct 2021 02:03:56 +0000 (19:03 -0700)]
Recognize ASCII and strict CASEMAPPINGs in ERC

* lisp/erc/erc.el (erc-downcase, erc--casemapping-rfc1459-strict,
erc--casemapping-rfc1459): Add new translation tables for the latter
two mappings and use them in `erc-downcase'.

* test/lisp/erc/erc-tests.el: Add test for `erc-downcase'.

2 years agoUpdate ISUPPORT handling in ERC
F. Jason Park [Thu, 12 Aug 2021 10:10:31 +0000 (03:10 -0700)]
Update ISUPPORT handling in ERC

* lisp/erc/erc-backend (erc--isupport-params): Add new variable to
hold a hashmap of parsed `erc-server-parameters' in a more useful
format.  But keep `erc-server-parameters' around for public use.  We
currently lack dedicated local variables for certain discovered IRC
session properties, such as what prefix characters are supported for
channels, etc.  And the truth of this needs querying many times per
second at various points.  As such, caching here seems justified but
can be easily removed if deemed otherwise because all ingredients are
internal.
(erc--parse-isupport-value): Add helper function that parses an
ISUPPORT value and returns the component parts with backslash-x hex
escapes removed.  This can probably use some streamlining.
(erc--with-memoization): Add compat alias for use in internal ISUPPORT
getter.  Should be moved to `erc-compat.el' when that library is fully
reincorporated.
(erc--get-isupport-entry): Add internal getter to look up ISUPPORT
items.
(erc-server-005): Treat `erc-server-response' "command args" field as
read-only.  Previously, this field was set to nil after processing,
which was unhelpful to other parts of the library.  Also call above
mentioned helper to parse values.  And add some bookkeeping to handle
negation.

* lisp/erc/erc-capab.el (erc-capab-identify-send-messages): Use
internal ISUPPORT getter.

* lisp/erc/erc.el (erc-cmd-NICK, erc-parse-prefix,
erc-nickname-in-use): Use internal ISUPPORT getter.

* test/lisp/erc/erc-tests.el: Add tests for the above mentioned
changes in erc-backend.el.

2 years agoRequire erc-networks in erc.el
F. Jason Park [Tue, 17 Aug 2021 08:50:29 +0000 (01:50 -0700)]
Require erc-networks in erc.el

* lisp/erc/erc.el: Require erc-networks.el, which ERC can't run
without these days.  To sidestep the circular dependency, require it
last, just after erc-goodies.  Remove the `declare-function' for
`erc-network-name' because it's not currently needed at load time.
(erc-log-irc-protocol, erc-hide-current-message-p): Remove `fboundp'
guard logic from `erc-network-name' invocations but preserve meaning
by interpreting `erc-network' being unset to mean module isn't loaded
or authoritative network detection has failed.
(erc-format-network): Likewise here.  At the moment, this function
always returns the empty string because the function
`erc-network-name' always returns non-nil, perhaps from the
fallback/failure sentinel "Unknown", perhaps from the printed form of
nil.

* lisp/erc/erc-networks.el (erc-network): This is called throughout
erc.el but was previously cumbersome to use on account of being
guarded by `fboundp'.  It now relies on the fact that its namesake
variable is set in target buffers as well.

2 years agoDon't set erc-server-announced-name unless known
F. Jason Park [Tue, 15 Jun 2021 06:40:45 +0000 (23:40 -0700)]
Don't set erc-server-announced-name unless known

* lisp/erc/erc.el (erc-open): whenever this function is called, the
variable `erc-server-announced-name' may be set locally in the calling
server buffer.  However, if that buffer's dialed server matches that
of the one being created, the announced name is copied over on faith.
But there's no guarantee that the name will match the one ultimately
emitted by the server during its introductory burst.  Beyond
potentially causing confusion in protocol logs, this behavior may
complicate debugging efforts.  Setting the variable to nil helps
ensure a consistent environment when preparing a buffer for all newly
dialed connections.  This commit also simplifies the setting of
`erc-server-connected', which is always nil when connecting and
vice-versa.

2 years agoAllow exemption from flood penalty in erc-backend
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.

2 years agoCustomize displaying of ERC buffers on reconnect
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)

2 years agoRemove duplicate ERC prompt on reconnect
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.

2 years agoAccept user keyword arg in ERC entry-point commands
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)

2 years agoInitialize erc-server-filter-data in erc-backend
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.

2 years agoRework mutual dependency between erc and erc-backend
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)

2 years agoRegenerate ldefs-boot.el
Lars Ingebrigtsen [Thu, 30 Jun 2022 18:23:42 +0000 (20:23 +0200)]
Regenerate ldefs-boot.el

2 years agoFix define-obsolete-function-alias formatting in loaddefs-gen.el
Lars Ingebrigtsen [Thu, 30 Jun 2022 18:23:32 +0000 (20:23 +0200)]
Fix define-obsolete-function-alias formatting in loaddefs-gen.el

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--print-form):
Fix formatting of define-obsolete-function-alias statements
(bug#56292).

2 years ago(syntax-wholeline-max): New var
Stefan Monnier [Thu, 30 Jun 2022 17:20:33 +0000 (13:20 -0400)]
(syntax-wholeline-max): New var

Try and reduce the pain caused by font-lock and syntax-propertize's
wholeline-based operation in buffers made up of a few very long lines
(bug#45898).

* lisp/emacs-lisp/syntax.el (syntax-wholeline-max): New var.
(syntax--lbp): New function.
(syntax-propertize-wholelines): Use it.

* lisp/jit-lock.el (jit-lock--antiblink-post-command): Use `syntax--lbp`.

* lisp/font-lock.el (font-lock-extend-region-wholelines): Rewrite,
using `syntax-propertize-wholelines`.

2 years ago; * lisp/emacs-lisp/rx.el: Don't set indentation prop for `repeat`.
Mattias Engdegård [Thu, 30 Jun 2022 13:19:15 +0000 (15:19 +0200)]
; * lisp/emacs-lisp/rx.el: Don't set indentation prop for `repeat`.

2 years agoDon't say that macro-expansion error is a warning
Mattias Engdegård [Thu, 30 Jun 2022 12:55:45 +0000 (14:55 +0200)]
Don't say that macro-expansion error is a warning

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

2 years ago* lisp/eshell/em-term.el (eshell-visual-commands): Add vim.
Stefan Kangas [Thu, 30 Jun 2022 12:58:11 +0000 (14:58 +0200)]
* lisp/eshell/em-term.el (eshell-visual-commands): Add vim.

2 years agoAlso add elisp-eval/byte-compile-buffer to lisp-interaction-mode
Lars Ingebrigtsen [Thu, 30 Jun 2022 12:45:55 +0000 (14:45 +0200)]
Also add elisp-eval/byte-compile-buffer to lisp-interaction-mode

* lisp/progmodes/elisp-mode.el (lisp-interaction-mode-map): Also
add elisp-eval-buffer and elisp-byte-compile-buffer to this map.

2 years agoDon't change indentation rules for `>=` and `=`
Mattias Engdegård [Thu, 30 Jun 2022 12:31:47 +0000 (14:31 +0200)]
Don't change indentation rules for `>=` and `=`

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

2 years agoFix typo in previous elisp-byte-compile-buffer change
Lars Ingebrigtsen [Thu, 30 Jun 2022 12:29:49 +0000 (14:29 +0200)]
Fix typo in previous elisp-byte-compile-buffer change

* lisp/progmodes/elisp-mode.el (elisp-byte-compile-buffer): Make
warnings point to the correct place.

2 years agoFix up warning links in elisp-byte-compile-buffer
Lars Ingebrigtsen [Thu, 30 Jun 2022 12:29:04 +0000 (14:29 +0200)]
Fix up warning links in elisp-byte-compile-buffer

* lisp/progmodes/elisp-mode.el (elisp-byte-compile-buffer): Make
warnings point to the correct place.

2 years ago; * lisp/emacs-lisp/testcover.el: Remove duplicate provide.
Stefan Kangas [Thu, 30 Jun 2022 12:11:28 +0000 (14:11 +0200)]
; * lisp/emacs-lisp/testcover.el: Remove duplicate provide.

2 years agoNew hook save-place-after-find-file-hook
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.

2 years agoMake "eager macro-expansion" warning into an error
Lars Ingebrigtsen [Thu, 30 Jun 2022 11:18:15 +0000 (13:18 +0200)]
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).

2 years agoDo NEWS tagging
Lars Ingebrigtsen [Thu, 30 Jun 2022 10:50:45 +0000 (12:50 +0200)]
Do NEWS tagging

2 years agoAdd find-function-setup-keys bindings for find-library commands
Lars Ingebrigtsen [Thu, 30 Jun 2022 10:49:40 +0000 (12:49 +0200)]
Add find-function-setup-keys bindings for find-library commands

* lisp/emacs-lisp/find-func.el (find-function-setup-keys): Add `L'
bindings for the find-library family of commands (bug#51240).

2 years agoRestore temp-buffer-resize-mode behaviour wrt. [back] buttons
Lars Ingebrigtsen [Thu, 30 Jun 2022 10:35:55 +0000 (12:35 +0200)]
Restore temp-buffer-resize-mode behaviour wrt. [back] buttons

* lisp/help.el (help--window-setup): If temp-buffer-resize-mode, do
the window setup after adding [back] buttons (bug#56306).

2 years agoFix typo in previous server.el change
Lars Ingebrigtsen [Thu, 30 Jun 2022 10:13:03 +0000 (12:13 +0200)]
Fix typo in previous server.el change

* lisp/server.el (server-process-filter): Fix typo in previous change.

2 years agoDon't ignore emacsclient's --frame-parameters option when -t
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.

2 years agoAdd new commands to elisp mode for eval/compilation
Lars Ingebrigtsen [Thu, 30 Jun 2022 10:00:49 +0000 (12:00 +0200)]
Add new commands to elisp mode for eval/compilation

* lisp/progmodes/elisp-mode.el (emacs-lisp-mode-map): Add new
keystrokes.
(elisp-eval-buffer, elisp-byte-compile-file)
(elisp-byte-compile-buffer): New commands.

2 years agoClarify `version-control' in the Emacs manual
Mike Kupfer [Thu, 30 Jun 2022 09:21:12 +0000 (11:21 +0200)]
Clarify `version-control' in the Emacs manual

* doc/emacs/files.texi (Backup Names): Rephrase for greater
clarity (bug#56291).

2 years agoRecognize Gradle error messages in compile-mode
Lars Ingebrigtsen [Thu, 30 Jun 2022 09:04:15 +0000 (11:04 +0200)]
Recognize Gradle error messages in compile-mode

* lisp/progmodes/compile.el
(compilation-error-regexp-alist-alist): Recognize Gradle errors
(bug#56249).

2 years agoAdd provide to testcover
Lars Ingebrigtsen [Thu, 30 Jun 2022 08:58:14 +0000 (10:58 +0200)]
Add provide to testcover

* lisp/emacs-lisp/testcover.el (testcover): Provide (bug#55388).

2 years agoRegenerated ldefs-boot.el
Lars Ingebrigtsen [Thu, 30 Jun 2022 08:47:34 +0000 (10:47 +0200)]
Regenerated ldefs-boot.el

2 years agoAdd new commands to zoom emojis
Lars Ingebrigtsen [Thu, 30 Jun 2022 08:46:59 +0000 (10:46 +0200)]
Add new commands to zoom emojis

* lisp/international/emoji.el (emoji-zoom-map)
(emoji-zoom-increase, emoji-zoom-decrease): New commands.

* lisp/international/mule-cmds.el (ctl-x-map): Bind them.

2 years agoDisable unrelated drag-and-drop protocols during XDS drop
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'.

2 years agoImprove compliance with the XDS and XDND protocols
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.

2 years agoEUDC: Use "Surname" instead of "Name" in prompts
Thomas Fitzsimmons [Thu, 30 Jun 2022 01:53:39 +0000 (21:53 -0400)]
EUDC: Use "Surname" instead of "Name" in prompts

* lisp/net/eudc-vars.el (eudc-user-attribute-names-alist): Add
name/"Surname" association.
* lisp/net/eudc.el (eudc-get-email): Prompt for surname.
* lisp/net/eudc.el (eudc-get-phone): Likewise.

2 years agoFix preservation of the original value of PRIMARY after dropping on xterm
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.

* src/xterm.h: Update prototypes.

2 years agoEUDC: Prevent field overlap when query form is reset
Thomas Fitzsimmons [Thu, 30 Jun 2022 01:37:57 +0000 (21:37 -0400)]
EUDC: Prevent field overlap when query form is reset

* lisp/net/eudc.el (eudc-query-form): Delete all overlays before
erasing buffer.  Remove widget-after-change from
after-change-functions.

2 years agoFix hscrolling of :align-to when display-line-numbers is in effect
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)

2 years ago* lisp/vc/diff-mode.el (diff--font-lock-prettify): Fix `diff-buffers` case
Stefan Monnier [Wed, 29 Jun 2022 15:47:24 +0000 (11:47 -0400)]
* lisp/vc/diff-mode.el (diff--font-lock-prettify): Fix `diff-buffers` case

2 years agoMore robust `gnu` pattern (bug#56249)
Mattias Engdegård [Wed, 29 Jun 2022 15:18:04 +0000 (17:18 +0200)]
More robust `gnu` pattern (bug#56249)

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

2 years agoComplete transition to rx for compilation `gnu` pattern
Mattias Engdegård [Wed, 29 Jun 2022 10:34:39 +0000 (12:34 +0200)]
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.

2 years ago* lisp/emacs-lisp/rx.el: Indent some rx constructs correctly.
Mattias Engdegård [Wed, 29 Jun 2022 09:01:16 +0000 (11:01 +0200)]
* lisp/emacs-lisp/rx.el: Indent some rx constructs correctly.

This includes group-n, submatch-n, =, >=, ** and repeat, whose first 1
or 2 arguments are special.

2 years ago; Manually sync ChangeLog and AUTHORS with emacs-28
Stefan Kangas [Wed, 29 Jun 2022 14:13:51 +0000 (16:13 +0200)]
; Manually sync ChangeLog and AUTHORS with emacs-28

* ChangeLog.3:
* etc/AUTHORS: Manually sync with emacs-28 to fix merge errors.

2 years ago; Merge from origin/emacs-28
Stefan Kangas [Wed, 29 Jun 2022 13:34:22 +0000 (15:34 +0200)]
; Merge from origin/emacs-28

The following commit was skipped:

f1de6c0e28 Bump Emacs version to 28.1.90

2 years agoMerge from origin/emacs-28
Stefan Kangas [Wed, 29 Jun 2022 13:34:22 +0000 (15:34 +0200)]
Merge from origin/emacs-28

6c26f089a7 Update ChangeLog and AUTHORS for 28.1.90 pretest

# Conflicts:
# ChangeLog.3
# etc/AUTHORS

2 years ago; Merge from origin/emacs-28
Stefan Kangas [Wed, 29 Jun 2022 13:34:21 +0000 (15:34 +0200)]
; Merge from origin/emacs-28

The following commit was skipped:

7f749e44db ; Auto-commit of loaddefs files.

2 years agoMerge from origin/emacs-28
Stefan Kangas [Wed, 29 Jun 2022 13:34:21 +0000 (15:34 +0200)]
Merge from origin/emacs-28

bf137fdbd2 ; * admin/make-tarball.txt: Small clarification.

2 years ago; Merge from origin/emacs-28
Stefan Kangas [Wed, 29 Jun 2022 13:34:21 +0000 (15:34 +0200)]
; Merge from origin/emacs-28

The following commit was skipped:

3d91d55432 Update Tramp version (don't merge with master)

2 years agoFix handling invalidated selection requests
Po Lu [Wed, 29 Jun 2022 13:24:51 +0000 (21:24 +0800)]
Fix handling invalidated selection requests

* src/xselect.c (x_handle_selection_request): Correctly punt
when !dpyinfo.

2 years agoBump Emacs version to 28.1.90 emacs-28.1.90
Stefan Kangas [Wed, 29 Jun 2022 13:21:26 +0000 (15:21 +0200)]
Bump Emacs version to 28.1.90

* README:
* configure.ac:
* msdos/sed2v2.inp:
* nt/README.W32: Bump Emacs version to 28.1.90.

2 years agoUpdate ChangeLog and AUTHORS for 28.1.90 pretest
Stefan Kangas [Wed, 29 Jun 2022 13:19:55 +0000 (15:19 +0200)]
Update ChangeLog and AUTHORS for 28.1.90 pretest

* ChangeLog.3:
* etc/AUTHORS: Update.

2 years agoFix some bugs found while testing drag-and-drop
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".

2 years ago(cl--generic-compiler): Revert last change
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.

2 years ago; Auto-commit of loaddefs files.
Stefan Kangas [Wed, 29 Jun 2022 12:20:24 +0000 (14:20 +0200)]
; Auto-commit of loaddefs files.

2 years ago; Fix build warnings
Po Lu [Wed, 29 Jun 2022 12:16:44 +0000 (20:16 +0800)]
; Fix build warnings

* lisp/x-dnd.el (x-begin-drag): Add missing declarations.

2 years agoUpdate dnd-tests.el to make sure remote files are removed when Emacs quits
Po Lu [Wed, 29 Jun 2022 12:14:15 +0000 (20:14 +0800)]
Update dnd-tests.el to make sure remote files are removed when Emacs quits

* test/lisp/dnd-tests.el (dnd-tests-begin-drag-files)
(dnd-tests-begin-file-drag): Test value of `kill-emacs-hook'.

2 years agoImplement starting X Direct Save (XDS) drops
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.

2 years ago; * admin/make-tarball.txt: Small clarification.
Stefan Kangas [Wed, 29 Jun 2022 12:07:36 +0000 (14:07 +0200)]
; * admin/make-tarball.txt: Small clarification.

2 years agoMake two text-property-search tests easier to read
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.

2 years agoMinor cleanup in dired-x-bind-find-file
Stefan Kangas [Mon, 27 Jun 2022 14:08:10 +0000 (16:08 +0200)]
Minor cleanup in dired-x-bind-find-file

* lisp/dired-x.el (dired-x-bind-find-file): Use 'format-message'
and 'keymap-set'.

2 years agoImprove the eval-defun doc string
Lars Ingebrigtsen [Wed, 29 Jun 2022 11:05:46 +0000 (13:05 +0200)]
Improve the eval-defun doc string

* lisp/progmodes/elisp-mode.el (eval-defun): Document what the
command actually does w.r.t. finding a form to evaluate
(bug#47747).

2 years agoEnsure that In-Reply-To is saved in drafts in Message
Lars Ingebrigtsen [Wed, 29 Jun 2022 11:00:25 +0000 (13:00 +0200)]
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).

2 years agotest/lisp/progmodes/python-tests.el: add test for nav end of block
Tom Gillespie [Wed, 29 Jun 2022 02:55:31 +0000 (19:55 -0700)]
test/lisp/progmodes/python-tests.el: add test for nav end of block

Add test for python-nav-end-of-block to prevent regression of bug#56271.

2 years agolisp/progmodes/python.el (python-nav-end-of-block): prevent infinite loop
Tom Gillespie [Wed, 29 Jun 2022 02:28:05 +0000 (19:28 -0700)]
lisp/progmodes/python.el (python-nav-end-of-block): prevent infinite loop

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)