2021-03-18 23:14:33 -04:00
|
|
|
;;; erc.el --- An Emacs Internet Relay Chat client -*- lexical-binding:t -*-
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-01-01 05:31:12 -05:00
|
|
|
;; Copyright (C) 1997-2023 Free Software Foundation, Inc.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2022-07-20 22:34:34 +02:00
|
|
|
;; Author: Alexander L. Belikoff <alexander@belikoff.net>
|
2022-01-24 10:59:05 -05:00
|
|
|
;; Maintainer: Amin Bandali <bandali@gnu.org>, F. Jason Park <jp@neverwas.me>
|
2006-01-29 13:08:58 +00:00
|
|
|
;; Contributors: Sergey Berezin (sergey.berezin@cs.cmu.edu),
|
|
|
|
;; Mario Lang (mlang@delysid.org),
|
|
|
|
;; Alex Schroeder (alex@gnu.org)
|
|
|
|
;; Andreas Fuchs (afs@void.at)
|
|
|
|
;; Gergely Nagy (algernon@midgard.debian.net)
|
|
|
|
;; David Edmondson (dme@dme.org)
|
2021-04-26 23:58:05 -04:00
|
|
|
;; Michael Olson (mwolson@gnu.org)
|
2014-11-08 20:51:43 -05:00
|
|
|
;; Kelvin White (kwhite@gnu.org)
|
2023-03-31 19:42:54 -07:00
|
|
|
;; Version: 5.6-git
|
2023-11-07 23:51:27 -08:00
|
|
|
;; Package-Requires: ((emacs "27.1") (compat "29.1.4.3"))
|
2021-09-17 21:54:15 -04:00
|
|
|
;; Keywords: IRC, chat, client, Internet
|
|
|
|
;; URL: https://www.gnu.org/software/emacs/erc.html
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-10-01 00:06:16 +02:00
|
|
|
;; This is a GNU ELPA :core package. Avoid functionality that is not
|
|
|
|
;; compatible with the version of Emacs recorded above.
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 03:36:21 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2006-01-29 13:08:58 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:36:21 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
2006-11-20 06:50:29 +00:00
|
|
|
;; ERC is a powerful, modular, and extensible IRC client for Emacs.
|
2020-04-16 15:11:11 -04:00
|
|
|
;; For more information, visit the ERC page at
|
|
|
|
;; <https://www.gnu.org/software/emacs/erc.html>.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; Configuration:
|
|
|
|
|
|
|
|
;; Use M-x customize-group RET erc RET to get an overview
|
|
|
|
;; of all the variables you can tweak.
|
|
|
|
|
|
|
|
;; Usage:
|
|
|
|
|
|
|
|
;; To connect to an IRC server, do
|
|
|
|
;;
|
2006-11-20 06:50:29 +00:00
|
|
|
;; M-x erc RET
|
2006-01-29 13:08:58 +00:00
|
|
|
;;
|
2021-04-22 20:22:38 -04:00
|
|
|
;; or
|
|
|
|
;;
|
|
|
|
;; M-x erc-tls RET
|
|
|
|
;;
|
|
|
|
;; to connect over TLS (encrypted). Once you are connected to a
|
|
|
|
;; server, you can use C-h m or have a look at the ERC menu.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2014-11-08 20:51:43 -05:00
|
|
|
;;; Code:
|
|
|
|
|
Don't require erc-goodies in erc.el
* lisp/erc/erc-goodies.el: Obviate the need for forward declarations
by requiring `erc'. Add minor-mode autoloads for `scrolltobottom',
`readonly', `move-to-prompt', `keep-place', `noncommands',
`irccontrols', `smiley', and `unmorse'. Add Local variables footer
with `generated-autoload-file'.
(erc-controls-strip): Autoload this function.
* lisp/erc/erc-ibuffer.el: Require `erc-goodies' for
`erc-control-interpret'. The justification for the blanket `require'
is this module isn't a member of `erc-modules' by default.
* lisp/erc/erc-page.el: (erc-ctcp-query-PAGE): Require `erc-goodies'
and put forward declaration for `erc-control-interpret' atop file.
* lisp/erc/erc-speedbar.el: Require `erc-goodies' for the same reason
as erc-ibuffer.el.
* lisp/erc/erc.el: Remove `require' for `erc-goodies' at end of file
and `pp' at top of file because `pp-to-string' is autoloaded on Emacs
27. Also remove `require's for `thingatpt', `time-date', and
`iso8601'. They're all used sparingly and the latter two have only
been around for one major release, so their removal likely won't cause
much churn. And `thingatpt' already has a call-site `require', so the
top-level one is redundant, but autoload `word-at-point' anyway for
the benefit of third-party libraries like `hl-nicks'. Also wrap local
loaddefs `require' call in `eval-and-compile'.
(erc--read-time-period): Require dependencies. (Bug#60954.)
2023-01-19 21:07:27 -08:00
|
|
|
(eval-and-compile (load "erc-loaddefs" 'noerror 'nomessage))
|
Put most erc autoloads in a dedicated file erc-loaddefs.el
These are features that are only useful after erc.el is loaded.
* lisp/erc/erc.el (top-level): Load erc-loaddefs.
* lisp/erc/erc-autoaway.el, lisp/erc/erc-button.el:
* lisp/erc/erc-capab.el, lisp/erc/erc-compat.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-desktop-notifications.el:
* lisp/erc/erc-ezbounce.el, lisp/erc/erc-fill.el:
* lisp/erc/erc-identd.el, lisp/erc/erc-imenu.el:
* lisp/erc/erc-join.el, lisp/erc/erc-list.el, lisp/erc/erc-log.el:
* lisp/erc/erc-match.el, lisp/erc/erc-menu.el:
* lisp/erc/erc-netsplit.el, lisp/erc/erc-notify.el:
* lisp/erc/erc-page.el, lisp/erc/erc-pcomplete.el:
* lisp/erc/erc-replace.el, lisp/erc/erc-ring.el:
* lisp/erc/erc-services.el, lisp/erc/erc-sound.el:
* lisp/erc/erc-speedbar.el, lisp/erc/erc-spelling.el:
* lisp/erc/erc-stamp.el, lisp/erc/erc-track.el:
* lisp/erc/erc-truncate.el, lisp/erc/erc-xdcc.el:
Set generated-autoload-file to "erc-loaddefs.el".
2017-11-28 21:16:02 -05:00
|
|
|
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(require 'erc-networks)
|
|
|
|
(require 'erc-backend)
|
2020-08-12 19:32:52 +02:00
|
|
|
(require 'cl-lib)
|
|
|
|
(require 'format-spec)
|
2012-06-15 16:47:31 +02:00
|
|
|
(require 'auth-source)
|
2022-12-29 06:43:19 -08:00
|
|
|
(eval-when-compile (require 'subr-x))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-03-31 19:42:54 -07:00
|
|
|
(defconst erc-version "5.6-git"
|
2021-10-06 21:50:56 -04:00
|
|
|
"This version of ERC.")
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defvar erc-official-location
|
2020-04-16 15:11:11 -04:00
|
|
|
"https://www.gnu.org/software/emacs/erc.html (mailing list: emacs-erc@gnu.org)"
|
2006-01-29 13:08:58 +00:00
|
|
|
"Location of the ERC client on the Internet.")
|
|
|
|
|
2021-10-11 10:04:44 -04:00
|
|
|
;; Map each :package-version to the associated Emacs version.
|
|
|
|
;; (This eliminates the need for explicit :version keywords on the
|
|
|
|
;; custom definitions.)
|
|
|
|
(add-to-list
|
|
|
|
'customize-package-emacs-version-alist
|
|
|
|
'(ERC ("5.2" . "22.1")
|
2021-10-11 10:29:35 -04:00
|
|
|
("5.3" . "23.1")
|
2021-10-15 16:51:59 -04:00
|
|
|
("5.4" . "28.1")
|
2023-02-13 23:27:50 -08:00
|
|
|
("5.4.1" . "29.1")
|
2023-03-31 19:42:54 -07:00
|
|
|
("5.5" . "29.1")
|
|
|
|
("5.6" . "30.1")))
|
2021-10-11 10:04:44 -04:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defgroup erc nil
|
|
|
|
"Emacs Internet Relay Chat client."
|
2020-04-16 15:11:11 -04:00
|
|
|
:link '(url-link "https://www.gnu.org/software/emacs/erc.html")
|
2014-01-25 20:15:42 +01:00
|
|
|
:link '(custom-manual "(erc) Top")
|
2006-01-29 13:08:58 +00:00
|
|
|
:prefix "erc-"
|
|
|
|
:group 'applications)
|
|
|
|
|
|
|
|
(defgroup erc-buffers nil
|
2021-09-14 08:43:18 +02:00
|
|
|
"Creating new ERC buffers."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc)
|
|
|
|
|
|
|
|
(defgroup erc-display nil
|
Extend erc-interactive-display to cover /JOINs
* lisp/erc/erc.el (erc-display): Mention that buffer-related display
options live in the customization group `erc-buffers'.
(erc-buffer-display, erc-join-buffer): Swap alias and aliased so that
the favored name, `erc-buffer-display', appears in the definition and
in the Customize menu. Also note related buffer-display options in
the doc string.
(erc-query-display, erc-interactive-display): Make the former an alias
of the latter, new in ERC 5.6, because their roles were functionally
redundant and thus confusing. Inherit the default value from
`erc-query-display' because users are more familiar with the pop-up
window behavior than a single-window replacement.
(erc-reconnect-display): Use preferred name for cross-referencing
fallback option `erc-buffer-display' in doc string, and explain how
/reconnect handling differs.
(erc--setup-buffer-hook): Add new internal hook for modules that
operate on windows and frames, such as erc-speedbar and
erc-status-sidebar.
(erc-open): Run `erc--setup-buffer-hook' after `erc-setup-buffer' so
hook members know their code isn't tied to `erc-setup-buffer' itself,
which may be used in other contexts, but rather to a new ERC buffer on
which some display-related action has just been performed.
(erc--called-as-input-p): New variable for "slash" commands, like
`erc-cmd-FOO', to detect whether they're being called "interactively"
as a result of input given at ERC's prompt.
(erc-process-input-line): Bind `erc--called-as-input-p' when running
slash commands.
(erc-cmd-JOIN): When called interactively, schedule a callback to wrap
the response handler and control how new buffers are thus displayed.
(erc-cmd-QUERY): Use preferred alias for `erc-query-display'.
* test/lisp/erc/erc-scenarios-base-buffer-display.el:
(erc-scenarios-base-buffer-display--interactive-default): New test.
* test/lisp/erc/erc-tests.el (erc-process-input-line,
erc-select-read-args, erc-tls, erc--interactive): Change expected
default value of `erc-interactive-display' from `buffer' to
`window'. (Bug#62833)
2023-04-10 17:58:05 -07:00
|
|
|
"Settings controlling how various things are displayed.
|
|
|
|
See the customization group `erc-buffers' for display options
|
|
|
|
concerning buffers."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc)
|
|
|
|
|
|
|
|
(defgroup erc-mode-line-and-header nil
|
2021-09-14 08:43:18 +02:00
|
|
|
"Displaying information in the mode-line and header."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-display)
|
|
|
|
|
|
|
|
(defgroup erc-ignore nil
|
2021-09-14 08:43:18 +02:00
|
|
|
"Ignoring certain messages."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc)
|
|
|
|
|
2012-08-20 09:08:51 -07:00
|
|
|
(defgroup erc-lurker nil
|
2021-09-14 08:43:18 +02:00
|
|
|
"Hide specified message types sent by lurkers."
|
2014-11-10 05:38:11 -05:00
|
|
|
:version "24.3"
|
2012-08-20 09:08:51 -07:00
|
|
|
:group 'erc-ignore)
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defgroup erc-query nil
|
2021-09-14 08:43:18 +02:00
|
|
|
"Using separate buffers for private discussions."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc)
|
|
|
|
|
|
|
|
(defgroup erc-quit-and-part nil
|
2021-09-14 08:43:18 +02:00
|
|
|
"Quitting and parting channels."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc)
|
|
|
|
|
|
|
|
(defgroup erc-paranoia nil
|
|
|
|
"Know what is sent and received; control the display of sensitive data."
|
|
|
|
:group 'erc)
|
|
|
|
|
|
|
|
(defgroup erc-scripts nil
|
2021-09-14 08:43:18 +02:00
|
|
|
"Running scripts at startup and with /LOAD."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc)
|
|
|
|
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(defvar erc-message-parsed) ; only known to this file
|
2023-09-02 13:43:22 -07:00
|
|
|
|
|
|
|
(defvar erc--msg-props nil
|
|
|
|
"Hash table containing metadata properties for current message.
|
|
|
|
Provided by the insertion functions `erc-display-message' and
|
|
|
|
`erc-display-msg' while running their modification hooks.
|
|
|
|
Initialized when null for each visitation round from function
|
|
|
|
parameters and environmental factors, as well as the alist
|
|
|
|
`erc--msg-prop-overrides'. Keys are symbols. Values are opaque
|
|
|
|
objects, unless otherwise specified. Items present after running
|
|
|
|
`erc-insert-post-hook' or `erc-send-post-hook' become text
|
|
|
|
properties added to the first character of an inserted message.
|
|
|
|
A given message therefore spans the interval extending from one
|
|
|
|
set of such properties to the newline before the next (or
|
|
|
|
`erc-insert-marker'). As of ERC 5.6, this forms the basis for
|
|
|
|
visiting and editing inserted messages. Modules should align
|
|
|
|
their markers accordingly. The following properties have meaning
|
|
|
|
as of ERC 5.6:
|
|
|
|
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
- `erc--msg': a symbol, guaranteed present; values include:
|
2023-11-08 21:20:54 -08:00
|
|
|
`msg', signifying a `PRIVMSG' or an incoming `NOTICE';
|
|
|
|
`unknown', a fallback for `erc-display-message'; a catalog
|
|
|
|
key, such as `s401' or `finished'; an `erc-display-message'
|
|
|
|
TYPE parameter, like `notice'
|
2023-09-02 13:43:22 -07:00
|
|
|
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
- `erc--cmd': a message's associated IRC command, as read by
|
2023-09-02 13:43:22 -07:00
|
|
|
`erc--get-eq-comparable-cmd'; currently either a symbol, like
|
|
|
|
`PRIVMSG', or a number, like 5, which represents the numeric
|
2023-11-08 21:20:54 -08:00
|
|
|
\"005\"; absent on \"local\" messages, such as simple warnings
|
|
|
|
and help text, and on outgoing messages unless echoed back by
|
|
|
|
the server (assuming future support)
|
2023-09-02 13:43:22 -07:00
|
|
|
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
- `erc--ctcp': a CTCP command, like `ACTION'
|
2023-09-02 13:43:22 -07:00
|
|
|
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
- `erc--ts': a timestamp, possibly provided by the server; as of
|
2023-11-08 21:20:54 -08:00
|
|
|
5.6, a ticks/hertz pair on Emacs 29 and above, and a \"list\"
|
|
|
|
type otherwise; managed by the `stamp' module
|
2023-09-02 13:43:22 -07:00
|
|
|
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
- `erc--ephemeral': a symbol prefixed by or matching a module
|
2023-11-08 21:20:54 -08:00
|
|
|
name; indicates to other modules and members of modification
|
|
|
|
hooks that the current message should not affect stateful
|
|
|
|
operations, such as recording a channel's most recent speaker
|
2023-09-02 13:43:22 -07:00
|
|
|
|
|
|
|
This is an internal API, and the selection of related helper
|
|
|
|
utilities is fluid and provisional. As of ERC 5.6, see the
|
|
|
|
functions `erc--check-msg-prop' and `erc--get-inserted-msg-prop'.")
|
|
|
|
|
|
|
|
(defvar erc--msg-prop-overrides nil
|
|
|
|
"Alist of \"message properties\" for populating `erc--msg-props'.
|
|
|
|
These override any defaults normally shown to modification hooks
|
|
|
|
by `erc-display-msg' and `erc-display-message'. Modules should
|
|
|
|
accommodate existing overrides when applicable. Items toward the
|
|
|
|
front shadow any that follow. Ignored when `erc--msg-props' is
|
|
|
|
already non-nil.")
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
;; Forward declarations
|
Don't require erc-goodies in erc.el
* lisp/erc/erc-goodies.el: Obviate the need for forward declarations
by requiring `erc'. Add minor-mode autoloads for `scrolltobottom',
`readonly', `move-to-prompt', `keep-place', `noncommands',
`irccontrols', `smiley', and `unmorse'. Add Local variables footer
with `generated-autoload-file'.
(erc-controls-strip): Autoload this function.
* lisp/erc/erc-ibuffer.el: Require `erc-goodies' for
`erc-control-interpret'. The justification for the blanket `require'
is this module isn't a member of `erc-modules' by default.
* lisp/erc/erc-page.el: (erc-ctcp-query-PAGE): Require `erc-goodies'
and put forward declaration for `erc-control-interpret' atop file.
* lisp/erc/erc-speedbar.el: Require `erc-goodies' for the same reason
as erc-ibuffer.el.
* lisp/erc/erc.el: Remove `require' for `erc-goodies' at end of file
and `pp' at top of file because `pp-to-string' is autoloaded on Emacs
27. Also remove `require's for `thingatpt', `time-date', and
`iso8601'. They're all used sparingly and the latter two have only
been around for one major release, so their removal likely won't cause
much churn. And `thingatpt' already has a call-site `require', so the
top-level one is redundant, but autoload `word-at-point' anyway for
the benefit of third-party libraries like `hl-nicks'. Also wrap local
loaddefs `require' call in `eval-and-compile'.
(erc--read-time-period): Require dependencies. (Bug#60954.)
2023-01-19 21:07:27 -08:00
|
|
|
(declare-function decoded-time-period "time-date" (time))
|
|
|
|
(declare-function iso8601-parse-duration "iso8601" (string))
|
|
|
|
(declare-function word-at-point "thingatpt" (&optional no-properties))
|
|
|
|
(autoload 'word-at-point "thingatpt") ; for hl-nicks
|
|
|
|
|
2023-05-22 21:43:29 -07:00
|
|
|
(declare-function gnutls-negotiate "gnutls" (&rest rest))
|
|
|
|
(declare-function socks-open-network-stream "socks" (name buffer host service))
|
2022-12-29 06:43:19 -08:00
|
|
|
(declare-function url-host "url-parse" (cl-x))
|
|
|
|
(declare-function url-password "url-parse" (cl-x))
|
|
|
|
(declare-function url-portspec "url-parse" (cl-x))
|
|
|
|
(declare-function url-type "url-parse" (cl-x))
|
|
|
|
(declare-function url-user "url-parse" (cl-x))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
;; tunable connection and authentication parameters
|
|
|
|
|
|
|
|
(defcustom erc-server nil
|
2006-07-14 02:29:50 +00:00
|
|
|
"IRC server to use if one is not provided.
|
2006-01-29 13:08:58 +00:00
|
|
|
See function `erc-compute-server' for more details on connection
|
|
|
|
parameters and authentication."
|
|
|
|
:group 'erc
|
2006-07-14 02:29:50 +00:00
|
|
|
:type '(choice (const :tag "None" nil)
|
2014-11-08 20:51:43 -05:00
|
|
|
(string :tag "Server")))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defcustom erc-port nil
|
2006-07-14 02:29:50 +00:00
|
|
|
"IRC port to use if not specified.
|
|
|
|
|
|
|
|
This can be either a string or a number."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc
|
2006-07-14 02:29:50 +00:00
|
|
|
:type '(choice (const :tag "None" nil)
|
2014-11-08 20:51:43 -05:00
|
|
|
(integer :tag "Port number")
|
|
|
|
(string :tag "Port string")))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defcustom erc-nick nil
|
2006-07-14 02:29:50 +00:00
|
|
|
"Nickname to use if one is not provided.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
This can be either a string, or a list of strings.
|
2006-01-29 13:08:58 +00:00
|
|
|
In the latter case, if the first nick in the list is already in use,
|
|
|
|
other nicks are tried in the list order.
|
|
|
|
|
|
|
|
See function `erc-compute-nick' for more details on connection
|
|
|
|
parameters and authentication."
|
|
|
|
:group 'erc
|
2006-07-14 02:29:50 +00:00
|
|
|
:type '(choice (const :tag "None" nil)
|
2014-11-08 20:51:43 -05:00
|
|
|
(string :tag "Nickname")
|
|
|
|
(repeat (string :tag "Nickname"))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defcustom erc-nick-uniquifier "`"
|
2006-07-14 02:29:50 +00:00
|
|
|
"The string to append to the nick if it is already in use."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc
|
|
|
|
:type 'string)
|
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
(defcustom erc-try-new-nick-p t
|
2021-09-19 12:59:01 +02:00
|
|
|
"Non-nil means attempt to connect with another nickname if nickname unavailable.
|
2006-07-14 02:29:50 +00:00
|
|
|
You can manually set another nickname with the /NICK command."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-user-full-name nil
|
|
|
|
"User full name.
|
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
This can be either a string or a function to call.
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
See function `erc-compute-full-name' for more details on connection
|
|
|
|
parameters and authentication."
|
|
|
|
:group 'erc
|
2006-07-14 02:29:50 +00:00
|
|
|
:type '(choice (const :tag "No name" nil)
|
2014-11-08 20:51:43 -05:00
|
|
|
(string :tag "Name")
|
|
|
|
(function :tag "Get from function"))
|
2006-01-29 13:08:58 +00:00
|
|
|
:set (lambda (sym val)
|
2014-11-08 20:51:43 -05:00
|
|
|
(set sym (if (functionp val) (funcall val) val))))
|
|
|
|
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(defcustom erc-rename-buffers t
|
2015-02-13 13:19:20 -05:00
|
|
|
"Non-nil means rename buffers with network name, if available."
|
|
|
|
:version "24.5"
|
2014-11-08 20:51:43 -05:00
|
|
|
:group 'erc
|
|
|
|
:type 'boolean)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
;; For the sake of compatibility, an ID will be created on the user's
|
|
|
|
;; behalf when `erc-rename-buffers' is nil and one wasn't provided.
|
|
|
|
;; The name will simply be that of the buffer, usually SERVER:PORT.
|
|
|
|
;; This violates the policy of treating provided IDs as gospel, but
|
|
|
|
;; it'll have to do for now.
|
|
|
|
|
|
|
|
(make-obsolete-variable 'erc-rename-buffers
|
|
|
|
"old behavior when t now permanent" "29.1")
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defvar erc-password nil
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
"Password to use when authenticating to an IRC server interactively.
|
|
|
|
|
|
|
|
This variable only exists for legacy reasons. It's not customizable and
|
|
|
|
is limited to a single server password. Users looking for similar
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
functionality should consider auth-source instead. See Info
|
|
|
|
node `(auth) Top' and Info node `(erc) auth-source'.")
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
|
|
|
|
(make-obsolete-variable 'erc-password "use auth-source instead" "29.1")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2021-09-30 01:49:42 +02:00
|
|
|
(defcustom erc-user-mode "+i"
|
|
|
|
;; +i "Invisible". Hides user from global /who and /names.
|
2006-01-29 13:08:58 +00:00
|
|
|
"Initial user modes to be set after a connection is established."
|
|
|
|
:group 'erc
|
2021-09-30 01:49:42 +02:00
|
|
|
:type '(choice (const nil) string function)
|
|
|
|
:version "28.1")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defcustom erc-prompt-for-password t
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
"Ask for a server password when invoking `erc-tls' interactively."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-warn-about-blank-lines t
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
"Warn the user if they attempt to send a blank line.
|
|
|
|
When non-nil, ERC signals a `user-error' upon encountering prompt
|
|
|
|
input containing empty or whitespace-only lines. When nil, ERC
|
|
|
|
still inhibits sending but does so silently. With the companion
|
|
|
|
option `erc-send-whitespace-lines' enabled, ERC sends pending
|
|
|
|
input and prints a message in the echo area indicating the amount
|
|
|
|
of padding and/or stripping applied, if any. Setting this option
|
|
|
|
to nil suppresses such reporting."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-send-whitespace-lines nil
|
|
|
|
"If set to non-nil, send lines consisting of only whitespace."
|
|
|
|
:group 'erc
|
|
|
|
:type 'boolean)
|
|
|
|
|
2022-04-27 02:27:32 -07:00
|
|
|
(defcustom erc-inhibit-multiline-input nil
|
2022-07-01 10:13:07 +03:00
|
|
|
"When non-nil, conditionally disallow input consisting of multiple lines.
|
2022-04-27 02:27:32 -07:00
|
|
|
Issue an error when the number of input lines submitted for
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
sending meets or exceeds this value. The value t is synonymous
|
|
|
|
with a value of 2 and means disallow more than 1 line of input."
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:package-version '(ERC . "5.5")
|
2022-04-27 02:27:32 -07:00
|
|
|
:group 'erc
|
|
|
|
:type '(choice integer boolean))
|
|
|
|
|
|
|
|
(defcustom erc-ask-about-multiline-input nil
|
2022-07-01 10:13:07 +03:00
|
|
|
"Whether to ask to ignore `erc-inhibit-multiline-input' when tripped."
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:package-version '(ERC . "5.5")
|
2022-04-27 02:27:32 -07:00
|
|
|
:group 'erc
|
|
|
|
:type 'boolean)
|
|
|
|
|
2022-04-05 17:45:00 -07:00
|
|
|
(defcustom erc-prompt-hidden ">"
|
|
|
|
"Text to show in lieu of the prompt when hidden."
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:package-version '(ERC . "5.5")
|
2022-04-05 17:45:00 -07:00
|
|
|
:group 'erc-display
|
|
|
|
:type 'string)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2022-04-05 17:45:00 -07:00
|
|
|
(defcustom erc-hide-prompt t
|
|
|
|
"If non-nil, hide input prompt upon disconnecting.
|
|
|
|
To unhide, type something in the input area. Once revealed, a
|
|
|
|
prompt remains unhidden until the next disconnection. Channel
|
Revive erc-command-indicator as new module
* doc/misc/erc.texi: Add entry for `command-indicator' to Modules
chapter.
* etc/ERC-NEWS: Mention new module `command-indicator'.
* lisp/erc/erc-goodies.el (erc-noncommands-list): Replace the
nonexistent `erc-cmd-SMV' with function `erc-cmd-SAY'.
(erc-noncommands-mode, erc-noncommands-enable,
erc-noncommands-disable): Deprecate this module because it's a no-op.
(erc-command-indicator-face, erc-command-indicator): Migrate from main
library.
(erc-command-indicator-mode, erc-command-indicator-enable,
erc-command-indicator-disable): New module to take the spiritual place
of `noncommands'.
(erc-command-indicator): Move function here from main library, along
with option namesake mentioned above.
(erc-command-indicator-toggle-hidden): New command to toggle echoed
command-line visibility.
(erc--command-indicator-permit-insertion): New function.
(erc--command-indicator-display): New function, a slightly revised
version of the old `erc-display-command' from the main library. Its
only call site was removed back in d1036d288de "backport: erc
bugfixes". However, references were left behind to associated assets,
like `erc-command-indicator', etc. The function was later commented
out in 0c599ee2e2c "* lisp/erc/erc.el: Use `run-hook-with-args` for
`erc-pre-send-functions`", and then removed by a63ed6f78a6 "Remove
duplicate ERC prompt on reconnect".
* lisp/erc/erc-match.el (erc-match-toggle-hidden-fools): Use new
non-module-specific name for `erc-match--toggle-hidden'.
(erc-match--toggle-hidden): Move to main library for shared use by
other modules.
* lisp/erc/erc.el (erc-hide-prompt): Leave note explaining updated
role.
(erc-command-indicator): Move option and function of same name to
erc-goodies.
(erc-command-indicator-face): Move to erc-goodies.
(erc-modules): Remove module `noncommands' from standard value and
Custom set. Add `command-indicator' to set.
(erc--toggle-hidden): "New" function, a rebranded version of the
utility `erc-match--toggle-hidden' from erc-match.
(erc--send-input-lines): Accommodate modules wanting alternate
insertion functions.
(erc-load-irc-script-lines): Account for `erc-command-indicator' no
longer being defined in this library.
* test/lisp/erc/erc-scenarios-base-send-message.el
(erc-scenarios-base-send-message--command-indicator): New test.
* test/lisp/erc/erc-tests.el (erc-tests--modules): Remove
deprecated module `noncommands' from manifest. (Bug#67031)
2023-11-10 13:34:31 -08:00
|
|
|
prompts are unhidden upon rejoining. For behavior concerning
|
|
|
|
query prompts, see `erc-unhide-query-prompt'. Longtime ERC users
|
|
|
|
should note that this option was repurposed in ERC 5.5 because it
|
|
|
|
had lain dormant for years after being sidelined in 5.3 when its
|
|
|
|
only use in the interactive client was removed. Before then, its
|
|
|
|
role was controlling whether `erc-command-indicator' would appear
|
|
|
|
alongside echoed slash-command lines."
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:package-version '(ERC . "5.5")
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-display
|
2022-04-05 17:45:00 -07:00
|
|
|
:type '(choice (const :tag "Always hide prompt" t)
|
|
|
|
(set (const server)
|
|
|
|
(const query)
|
|
|
|
(const channel))))
|
|
|
|
|
|
|
|
(defcustom erc-unhide-query-prompt nil
|
|
|
|
"When non-nil, always reveal query prompts upon reconnecting.
|
|
|
|
Otherwise, prompts in a connection's query buffers remain hidden
|
|
|
|
until the user types in the input area or a new message arrives
|
|
|
|
from the target."
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:package-version '(ERC . "5.5")
|
2022-04-05 17:45:00 -07:00
|
|
|
:group 'erc-display
|
|
|
|
;; Extensions may one day offer a way to discover whether a target
|
|
|
|
;; is online. When that happens, this can be expanded accordingly.
|
2006-01-29 13:08:58 +00:00
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
;; tunable GUI stuff
|
|
|
|
|
|
|
|
(defcustom erc-show-my-nick t
|
|
|
|
"If non-nil, display one's own nickname when sending a message.
|
|
|
|
|
|
|
|
If non-nil, \"<nickname>\" will be shown.
|
|
|
|
If nil, only \"> \" will be shown."
|
|
|
|
:group 'erc-display
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(define-widget 'erc-message-type 'set
|
|
|
|
"A set of standard IRC Message types."
|
|
|
|
:args '((const "JOIN")
|
2014-11-08 20:51:43 -05:00
|
|
|
(const "KICK")
|
|
|
|
(const "NICK")
|
|
|
|
(const "PART")
|
|
|
|
(const "QUIT")
|
|
|
|
(const "MODE")
|
|
|
|
(repeat :inline t :tag "Others" (string :tag "IRC Message Type"))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defcustom erc-hide-list nil
|
2015-05-21 14:30:18 -05:00
|
|
|
"A global list of IRC message types to hide.
|
2015-09-17 12:28:45 -07:00
|
|
|
A typical value would be \(\"JOIN\" \"PART\" \"QUIT\")."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-ignore
|
|
|
|
:type 'erc-message-type)
|
|
|
|
|
2015-05-21 14:30:18 -05:00
|
|
|
(defcustom erc-network-hide-list nil
|
|
|
|
"A list of IRC networks to hide message types from.
|
2021-07-03 23:39:18 -04:00
|
|
|
A typical value would be \((\"Libera.Chat\" \"MODE\")
|
2016-01-12 20:06:49 -05:00
|
|
|
\(\"OFTC\" \"JOIN\" \"QUIT\"))."
|
|
|
|
:version "25.1"
|
2015-05-21 14:30:18 -05:00
|
|
|
:group 'erc-ignore
|
2023-01-02 18:13:08 -08:00
|
|
|
:type '(alist :key-type string :value-type erc-message-type
|
|
|
|
:options ("Libera.Chat")))
|
2015-05-21 14:30:18 -05:00
|
|
|
|
|
|
|
(defcustom erc-channel-hide-list nil
|
|
|
|
"A list of IRC channels to hide message types from.
|
2015-09-17 12:28:45 -07:00
|
|
|
A typical value would be \((\"#emacs\" \"QUIT\" \"JOIN\")
|
2016-01-12 20:06:49 -05:00
|
|
|
\(\"#erc\" \"NICK\")."
|
|
|
|
:version "25.1"
|
2015-05-21 14:30:18 -05:00
|
|
|
:group 'erc-ignore
|
2023-01-02 18:13:08 -08:00
|
|
|
:type '(alist :key-type string :value-type erc-message-type
|
|
|
|
:options ("#emacs")))
|
2015-05-21 14:30:18 -05:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defcustom erc-disconnected-hook nil
|
|
|
|
"Run this hook with arguments (NICK IP REASON) when disconnected.
|
|
|
|
This happens before automatic reconnection. Note, that
|
|
|
|
`erc-server-QUIT-functions' might not be run when we disconnect,
|
|
|
|
simply because we do not necessarily receive the QUIT event."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom erc-complete-functions nil
|
2023-04-10 17:58:05 -07:00
|
|
|
"These functions get called when the user hits \\`TAB' in ERC.
|
2006-01-29 13:08:58 +00:00
|
|
|
Each function in turn is called until one returns non-nil to
|
|
|
|
indicate it has handled the input."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom erc-join-hook nil
|
2021-09-14 08:43:18 +02:00
|
|
|
"Hook run when we join a channel.
|
|
|
|
Hook functions are called without arguments, with the current
|
|
|
|
buffer set to the buffer of the new channel.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
See also `erc-server-JOIN-functions', `erc-part-hook'."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom erc-quit-hook nil
|
|
|
|
"Hook run when processing a quit command directed at our nick.
|
|
|
|
|
|
|
|
The hook receives one argument, the current PROCESS.
|
|
|
|
See also `erc-server-QUIT-functions' and `erc-disconnected-hook'."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom erc-part-hook nil
|
|
|
|
"Hook run when processing a PART message directed at our nick.
|
|
|
|
|
|
|
|
The hook receives one argument, the current BUFFER.
|
|
|
|
See also `erc-server-QUIT-functions', `erc-quit-hook' and
|
|
|
|
`erc-disconnected-hook'."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom erc-kick-hook nil
|
|
|
|
"Hook run when processing a KICK message directed at our nick.
|
|
|
|
|
|
|
|
The hook receives one argument, the current BUFFER.
|
|
|
|
See also `erc-server-PART-functions' and `erc-part-hook'."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom erc-nick-changed-functions nil
|
|
|
|
"List of functions run when your nick was successfully changed.
|
|
|
|
|
|
|
|
Each function should accept two arguments, NEW-NICK and OLD-NICK."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom erc-connect-pre-hook '(erc-initialize-log-marker)
|
|
|
|
"Hook called just before `erc' calls `erc-connect'.
|
2007-04-01 13:36:38 +00:00
|
|
|
Functions are passed a buffer as the first argument."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-channel-users nil
|
2021-09-19 12:59:01 +02:00
|
|
|
"Hash table of members in the current channel.
|
|
|
|
It associates nicknames with cons cells of the form:
|
2006-01-29 13:08:58 +00:00
|
|
|
\(USER . MEMBER-DATA) where USER is a pointer to an
|
|
|
|
erc-server-user struct, and MEMBER-DATA is a pointer to an
|
|
|
|
erc-channel-user struct.")
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-server-users nil
|
2021-09-19 12:59:01 +02:00
|
|
|
"Hash table of users on the current server.
|
|
|
|
It associates nicknames with `erc-server-user' struct instances.")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2021-10-05 19:03:56 -07:00
|
|
|
(defconst erc--casemapping-rfc1459-strict
|
2022-12-11 19:41:43 -08:00
|
|
|
(let ((tbl (copy-sequence ascii-case-table))
|
|
|
|
(cup (copy-sequence (char-table-extra-slot ascii-case-table 0))))
|
|
|
|
(set-char-table-extra-slot tbl 0 cup)
|
|
|
|
(set-char-table-extra-slot tbl 1 nil)
|
|
|
|
(set-char-table-extra-slot tbl 2 nil)
|
|
|
|
(pcase-dolist (`(,uc . ,lc) '((?\[ . ?\{) (?\] . ?\}) (?\\ . ?\|)))
|
|
|
|
(aset tbl uc lc)
|
|
|
|
(aset tbl lc lc)
|
|
|
|
(aset cup uc uc))
|
|
|
|
tbl))
|
|
|
|
|
|
|
|
(defconst erc--casemapping-rfc1459
|
|
|
|
(let ((tbl (copy-sequence erc--casemapping-rfc1459-strict))
|
|
|
|
(cup (copy-sequence (char-table-extra-slot
|
|
|
|
erc--casemapping-rfc1459-strict 0))))
|
|
|
|
(set-char-table-extra-slot tbl 0 cup)
|
|
|
|
(aset tbl ?~ ?^)
|
|
|
|
(aset tbl ?^ ?^)
|
|
|
|
(aset cup ?~ ?~)
|
|
|
|
tbl))
|
2021-10-05 19:03:56 -07:00
|
|
|
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(defun erc-add-server-user (nick user)
|
2006-01-29 13:08:58 +00:00
|
|
|
"This function is for internal use only.
|
|
|
|
|
|
|
|
Adds USER with nickname NICK to the `erc-server-users' hash table."
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(erc-with-server-buffer
|
|
|
|
(puthash (erc-downcase nick) user erc-server-users)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(defun erc-remove-server-user (nick)
|
2006-01-29 13:08:58 +00:00
|
|
|
"This function is for internal use only.
|
|
|
|
|
|
|
|
Removes the user with nickname NICK from the `erc-server-users'
|
|
|
|
hash table. This user is not removed from the
|
|
|
|
`erc-channel-users' lists of other buffers.
|
|
|
|
|
|
|
|
See also: `erc-remove-user'."
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(erc-with-server-buffer
|
|
|
|
(remhash (erc-downcase nick) erc-server-users)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-change-user-nickname (user new-nick)
|
|
|
|
"This function is for internal use only.
|
|
|
|
|
|
|
|
Changes the nickname of USER to NEW-NICK in the
|
|
|
|
`erc-server-users' hash table. The `erc-channel-users' lists of
|
|
|
|
other buffers are also changed."
|
|
|
|
(let ((nick (erc-server-user-nickname user)))
|
|
|
|
(setf (erc-server-user-nickname user) new-nick)
|
2007-04-01 13:36:38 +00:00
|
|
|
(erc-with-server-buffer
|
2006-01-29 13:08:58 +00:00
|
|
|
(remhash (erc-downcase nick) erc-server-users)
|
|
|
|
(puthash (erc-downcase new-nick) user erc-server-users))
|
|
|
|
(dolist (buf (erc-server-user-buffers user))
|
|
|
|
(if (buffer-live-p buf)
|
2014-11-08 20:51:43 -05:00
|
|
|
(with-current-buffer buf
|
|
|
|
(let ((cdata (erc-get-channel-user nick)))
|
|
|
|
(remhash (erc-downcase nick) erc-channel-users)
|
|
|
|
(puthash (erc-downcase new-nick) cdata
|
|
|
|
erc-channel-users)))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-remove-channel-user (nick)
|
|
|
|
"This function is for internal use only.
|
|
|
|
|
|
|
|
Removes the user with nickname NICK from the `erc-channel-users'
|
|
|
|
list for this channel. If this user is not in the
|
|
|
|
`erc-channel-users' list of any other buffers, the user is also
|
|
|
|
removed from the server's `erc-server-users' list.
|
|
|
|
|
|
|
|
See also: `erc-remove-server-user' and `erc-remove-user'."
|
|
|
|
(let ((channel-data (erc-get-channel-user nick)))
|
|
|
|
(when channel-data
|
|
|
|
(let ((user (car channel-data)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(setf (erc-server-user-buffers user)
|
|
|
|
(delq (current-buffer)
|
|
|
|
(erc-server-user-buffers user)))
|
|
|
|
(remhash (erc-downcase nick) erc-channel-users)
|
|
|
|
(if (null (erc-server-user-buffers user))
|
|
|
|
(erc-remove-server-user nick))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-remove-user (nick)
|
|
|
|
"This function is for internal use only.
|
|
|
|
|
|
|
|
Removes the user with nickname NICK from the `erc-server-users'
|
|
|
|
list as well as from all `erc-channel-users' lists.
|
|
|
|
|
|
|
|
See also: `erc-remove-server-user' and
|
|
|
|
`erc-remove-channel-user'."
|
|
|
|
(let ((user (erc-get-server-user nick)))
|
|
|
|
(when user
|
|
|
|
(let ((buffers (erc-server-user-buffers user)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(dolist (buf buffers)
|
|
|
|
(if (buffer-live-p buf)
|
|
|
|
(with-current-buffer buf
|
|
|
|
(remhash (erc-downcase nick) erc-channel-users)
|
|
|
|
(run-hooks 'erc-channel-members-changed-hook)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-remove-server-user nick))))
|
|
|
|
|
|
|
|
(defun erc-remove-channel-users ()
|
|
|
|
"This function is for internal use only.
|
|
|
|
|
|
|
|
Removes all users in the current channel. This is called by
|
|
|
|
`erc-server-PART' and `erc-server-QUIT'."
|
2023-10-15 13:20:07 -07:00
|
|
|
(when (erc--target-channel-p erc--target)
|
|
|
|
(setf (erc--target-channel-joined-p erc--target) nil))
|
2006-01-29 13:08:58 +00:00
|
|
|
(when (and erc-server-connected
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-server-process-alive)
|
|
|
|
(hash-table-p erc-channel-users))
|
2013-08-22 00:06:45 -04:00
|
|
|
(maphash (lambda (nick _cdata)
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-remove-channel-user nick))
|
|
|
|
erc-channel-users)
|
2006-01-29 13:08:58 +00:00
|
|
|
(clrhash erc-channel-users)))
|
|
|
|
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(defun erc-channel-user-owner-p (nick)
|
2014-11-08 20:51:43 -05:00
|
|
|
"Return non-nil if NICK is an owner of the current channel."
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(and nick
|
|
|
|
(hash-table-p erc-channel-users)
|
|
|
|
(let ((cdata (erc-get-channel-user nick)))
|
|
|
|
(and cdata (cdr cdata)
|
|
|
|
(erc-channel-user-owner (cdr cdata))))))
|
|
|
|
|
|
|
|
(defun erc-channel-user-admin-p (nick)
|
2014-11-08 20:51:43 -05:00
|
|
|
"Return non-nil if NICK is an admin in the current channel."
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(and nick
|
2014-11-08 20:51:43 -05:00
|
|
|
(hash-table-p erc-channel-users)
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(let ((cdata (erc-get-channel-user nick)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(and cdata (cdr cdata)
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(erc-channel-user-admin (cdr cdata))))))
|
2014-11-08 20:51:43 -05:00
|
|
|
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(defun erc-channel-user-op-p (nick)
|
2014-11-08 20:51:43 -05:00
|
|
|
"Return non-nil if NICK is an operator in the current channel."
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(and nick
|
2006-01-29 13:08:58 +00:00
|
|
|
(hash-table-p erc-channel-users)
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(let ((cdata (erc-get-channel-user nick)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(and cdata (cdr cdata)
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(erc-channel-user-op (cdr cdata))))))
|
2014-11-08 20:51:43 -05:00
|
|
|
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(defun erc-channel-user-halfop-p (nick)
|
2014-11-08 20:51:43 -05:00
|
|
|
"Return non-nil if NICK is a half-operator in the current channel."
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(and nick
|
2014-11-08 20:51:43 -05:00
|
|
|
(hash-table-p erc-channel-users)
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(let ((cdata (erc-get-channel-user nick)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(and cdata (cdr cdata)
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(erc-channel-user-halfop (cdr cdata))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(defun erc-channel-user-voice-p (nick)
|
2014-11-08 20:51:43 -05:00
|
|
|
"Return non-nil if NICK has voice in the current channel."
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(and nick
|
2006-01-29 13:08:58 +00:00
|
|
|
(hash-table-p erc-channel-users)
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(let ((cdata (erc-get-channel-user nick)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(and cdata (cdr cdata)
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(erc-channel-user-voice (cdr cdata))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-get-channel-user-list ()
|
2021-09-14 08:43:18 +02:00
|
|
|
"Return a list of users in the current channel.
|
|
|
|
Each element of the list is of the form (USER . CHANNEL-DATA),
|
|
|
|
where USER is an erc-server-user struct, and CHANNEL-DATA is
|
|
|
|
either nil or an erc-channel-user struct.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
lisp/*.el: Fix typos and other trivial doc fixes
* lisp/allout-widgets.el (allout-widgets-auto-activation)
(allout-current-decorated-p):
* lisp/auth-source.el (auth-source-protocols):
* lisp/autorevert.el (auto-revert-set-timer):
* lisp/battery.el (battery-mode-line-limit):
* lisp/calc/calcalg3.el (math-map-binop):
* lisp/calendar/cal-dst.el (calendar-dst-find-startend):
* lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute):
* lisp/calendar/calendar.el (calendar-date-echo-text)
(calendar-generate-month, calendar-string-spread)
(calendar-cursor-to-date, calendar-read, calendar-read-date)
(calendar-mark-visible-date, calendar-dayname-on-or-before):
* lisp/calendar/diary-lib.el (diary-ordinal-suffix):
* lisp/cedet/ede/autoconf-edit.el (autoconf-new-program)
(autoconf-find-last-macro, autoconf-parameter-strip):
* lisp/cedet/ede/config.el (ede-target-with-config-build):
* lisp/cedet/ede/linux.el (ede-linux--detect-architecture)
(ede-linux--get-architecture):
* lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache)
(semantic-displayer-abstract, semantic-displayer-point-position):
* lisp/cedet/semantic/format.el (semantic-format-face-alist)
(semantic-format-tag-short-doc):
* lisp/cedet/semantic/fw.el (semantic-find-file-noselect):
* lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time)
(semantic-idle-breadcrumbs-display-function)
(semantic-idle-breadcrumbs-format-tag-list-function):
* lisp/cedet/semantic/lex.el (semantic-lex-map-types)
(define-lex, define-lex-block-type-analyzer):
* lisp/cedet/semantic/senator.el (senator-search-default-tag-filter):
* lisp/cedet/semantic/symref.el (semantic-symref-result)
(semantic-symref-hit-to-tag-via-db):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-new-variable)
(semantic-tag-new-include, semantic-tag-new-package)
(semantic-tag-set-faux, semantic-create-tag-proxy)
(semantic-tag-function-parent)
(semantic-tag-components-with-overlays):
* lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces)
(srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict):
* lisp/cedet/srecode/dictionary.el (srecode-create-dictionary)
(srecode-dictionary-add-entries, srecode-dictionary-lookup-name)
(srecode-create-dictionaries-from-tags):
* lisp/cmuscheme.el (scheme-compile-region):
* lisp/color.el (color-lab-to-lch):
* lisp/doc-view.el (doc-view-image-width)
(doc-view-set-up-single-converter):
* lisp/dynamic-setting.el (font-setting-change-default-font)
(dynamic-setting-handle-config-changed-event):
* lisp/elec-pair.el (electric-pair-text-pairs)
(electric-pair-skip-whitespace-function)
(electric-pair-string-bound-function):
* lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance)
(avl-tree-member, avl-tree-mapcar, avl-tree-iter):
* lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree):
* lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag)
(checkdoc-spellcheck-documentation-flag, checkdoc-ispell)
(checkdoc-ispell-current-buffer, checkdoc-ispell-interactive)
(checkdoc-ispell-message-interactive)
(checkdoc-ispell-message-text, checkdoc-ispell-start)
(checkdoc-ispell-continue, checkdoc-ispell-comments)
(checkdoc-ispell-defun):
* lisp/emacs-lisp/cl-generic.el (cl--generic-search-method):
* lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group):
* lisp/emacs-lisp/lisp.el (forward-sexp, up-list):
* lisp/emacs-lisp/package-x.el (package--archive-contents-from-file):
* lisp/emacs-lisp/package.el (package-desc)
(package--make-autoloads-and-stuff, package-hidden-regexps):
* lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup):
* lisp/emacs-lisp/testcover.el (testcover-nohits)
(testcover-1value):
* lisp/epg.el (epg-receive-keys, epg-start-edit-key):
* lisp/erc/erc-backend.el (erc-server-processing-p)
(erc-split-line-length, erc-server-coding-system)
(erc-server-send, erc-message):
* lisp/erc/erc-button.el (erc-button-face, erc-button-alist)
(erc-browse-emacswiki):
* lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login):
* lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation):
* lisp/erc/erc-log.el (erc-current-logfile):
* lisp/erc/erc-match.el (erc-log-match-format)
(erc-text-matched-hook):
* lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug):
* lisp/erc/erc-networks.el (erc-server-alist)
(erc-networks-alist, erc-current-network):
* lisp/erc/erc-ring.el (erc-input-ring-index):
* lisp/erc/erc-speedbar.el (erc-speedbar)
(erc-speedbar-update-channel):
* lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag):
* lisp/erc/erc-track.el (erc-track-position-in-mode-line)
(erc-track-remove-from-mode-line, erc-modified-channels-update)
(erc-track-last-non-erc-buffer, erc-track-sort-by-importance)
(erc-track-get-active-buffer):
* lisp/erc/erc.el (erc-get-channel-user-list)
(erc-echo-notice-hook, erc-echo-notice-always-hook)
(erc-wash-quit-reason, erc-format-@nick):
* lisp/ffap.el (ffap-latex-mode):
* lisp/files.el (abort-if-file-too-large)
(dir-locals--get-sort-score, buffer-stale--default-function):
* lisp/filesets.el (filesets-tree-max-level, filesets-data)
(filesets-update-pre010505):
* lisp/gnus/gnus-agent.el (gnus-agent-flush-cache):
* lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol)
(gnus-button-prefer-mid-or-mail):
* lisp/gnus/gnus-cus.el (gnus-group-parameters):
* lisp/gnus/gnus-demon.el (gnus-demon-handlers)
(gnus-demon-run-callback):
* lisp/gnus/gnus-dired.el (gnus-dired-print):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer):
* lisp/gnus/gnus-range.el (gnus-range-normalize):
* lisp/gnus/gnus-spec.el (gnus-pad-form):
* lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud)
(gnus-server-opened, gnus-server-closed, gnus-server-denied)
(gnus-server-offline):
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir)
(gnus-refer-thread-limit-to-thread)
(gnus-summary-limit-include-thread, gnus-summary-refer-thread)
(gnus-summary-find-matching):
* lisp/gnus/gnus-util.el (gnus-rescale-image):
* lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server):
* lisp/gnus/mail-source.el (mail-source-incoming-file-prefix):
* lisp/gnus/message.el (message-cite-reply-position)
(message-cite-style-outlook, message-cite-style-thunderbird)
(message-cite-style-gmail, message--send-mail-maybe-partially):
* lisp/gnus/mm-extern.el (mm-inline-external-body):
* lisp/gnus/mm-partial.el (mm-inline-partial):
* lisp/gnus/mml-sec.el (mml-secure-message-sign)
(mml-secure-message-sign-encrypt, mml-secure-message-encrypt):
* lisp/gnus/mml2015.el (mml2015-epg-key-image)
(mml2015-epg-key-image-to-string):
* lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail):
* lisp/gnus/nnheader.el (nnheader-directory-files-is-safe):
* lisp/gnus/nnir.el (nnir-search-history)
(nnir-imap-search-other, nnir-artlist-length)
(nnir-artlist-article, nnir-artitem-group, nnir-artitem-number)
(nnir-artitem-rsv, nnir-article-group, nnir-article-number)
(nnir-article-rsv, nnir-article-ids, nnir-categorize)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-hyrex-additional-switches)
(gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms)
(nnir-read-parm, nnir-read-server-parm, nnir-search-thread):
* lisp/gnus/nnmairix.el (nnmairix-default-group)
(nnmairix-propagate-marks):
* lisp/gnus/smime.el (smime-keys, smime-crl-check)
(smime-verify-buffer, smime-noverify-buffer):
* lisp/gnus/spam-report.el (spam-report-url-ping-mm-url):
* lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header)
(spam-spamassassin-spam-status-header, spam-sa-learn-rebuild)
(spam-classifications, spam-check-stat, spam-spamassassin-score):
* lisp/help.el (describe-minor-mode-from-symbol):
* lisp/hippie-exp.el (hippie-expand-ignore-buffers):
* lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face)
(hfy-begin-span):
* lisp/ibuf-ext.el (ibuffer-update-saved-filters-format)
(ibuffer-saved-filters, ibuffer-old-saved-filters-warning)
(ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters)
(eval, ibuffer-unary-operand, file-extension, directory):
* lisp/image-dired.el (image-dired-cmd-pngcrush-options):
* lisp/image-mode.el (image-toggle-display):
* lisp/international/ccl.el (ccl-compile-read-multibyte-character)
(ccl-compile-write-multibyte-character):
* lisp/international/kkc.el (kkc-save-init-file):
* lisp/international/latin1-disp.el (latin1-display):
* lisp/international/ogonek.el (ogonek-name-encoding-alist)
(ogonek-information, ogonek-lookup-encoding)
(ogonek-deprefixify-region):
* lisp/isearch.el (isearch-filter-predicate)
(isearch--momentary-message):
* lisp/jsonrpc.el (jsonrpc-connection-send)
(jsonrpc-process-connection, jsonrpc-shutdown)
(jsonrpc--async-request-1):
* lisp/language/tibet-util.el (tibetan-char-p):
* lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date)
(feedmail-last-chance-hook, feedmail-before-fcc-hook)
(feedmail-send-it-immediately-wrapper, feedmail-find-eoh):
* lisp/mail/hashcash.el (hashcash-generate-payment)
(hashcash-generate-payment-async, hashcash-insert-payment)
(hashcash-verify-payment):
* lisp/mail/rmail.el (rmail-movemail-variant-in-use)
(rmail-get-attr-value):
* lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime):
* lisp/mail/rmailsum.el (rmail-summary-show-message):
* lisp/mail/supercite.el (sc-raw-mode-toggle):
* lisp/man.el (Man-start-calling):
* lisp/mh-e/mh-acros.el (mh-do-at-event-location)
(mh-iterate-on-messages-in-region, mh-iterate-on-range):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases)
(mh-alias-reload, mh-alias-ali)
(mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file)
(mh-alias-add-alias):
* lisp/mouse.el (mouse-save-then-kill):
* lisp/net/browse-url.el (browse-url-default-macosx-browser):
* lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value)
(eudc-variable-server-value, eudc-update-variable)
(eudc-expand-inline):
* lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result):
* lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list):
* lisp/net/pop3.el (pop3-list):
* lisp/net/soap-client.el (soap-namespace-put)
(soap-xs-parse-sequence, soap-parse-envelope):
* lisp/net/soap-inspect.el (soap-inspect-xs-complex-type):
* lisp/nxml/rng-xsd.el (rng-xsd-date-to-days):
* lisp/org/ob-C.el (org-babel-prep-session:C)
(org-babel-load-session:C):
* lisp/org/ob-J.el (org-babel-execute:J):
* lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote):
* lisp/org/ob-awk.el (org-babel-execute:awk):
* lisp/org/ob-core.el (org-babel-process-file-name):
* lisp/org/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/org/ob-forth.el (org-babel-execute:forth):
* lisp/org/ob-fortran.el (org-babel-execute:fortran)
(org-babel-prep-session:fortran, org-babel-load-session:fortran):
* lisp/org/ob-groovy.el (org-babel-execute:groovy):
* lisp/org/ob-io.el (org-babel-execute:io):
* lisp/org/ob-js.el (org-babel-execute:js):
* lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond)
(org-babel-lilypond-compile-post-tangle)
(org-babel-lilypond-display-pdf-post-tangle)
(org-babel-lilypond-tangle)
(org-babel-lilypond-execute-tangled-ly)
(org-babel-lilypond-compile-lilyfile)
(org-babel-lilypond-check-for-compile-error)
(org-babel-lilypond-process-compile-error)
(org-babel-lilypond-mark-error-line)
(org-babel-lilypond-parse-error-line)
(org-babel-lilypond-attempt-to-open-pdf)
(org-babel-lilypond-attempt-to-play-midi)
(org-babel-lilypond-switch-extension)
(org-babel-lilypond-set-header-args):
* lisp/org/ob-lua.el (org-babel-prep-session:lua):
* lisp/org/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/org/ob-processing.el (org-babel-prep-session:processing):
* lisp/org/ob-python.el (org-babel-prep-session:python):
* lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message)
(org-babel-scheme-execute-with-geiser, org-babel-execute:scheme):
* lisp/org/ob-shen.el (org-babel-execute:shen):
* lisp/org/org-agenda.el (org-agenda-entry-types)
(org-agenda-move-date-from-past-immediately-to-today)
(org-agenda-time-grid, org-agenda-sorting-strategy)
(org-agenda-filter-by-category, org-agenda-forward-block):
* lisp/org/org-colview.el (org-columns--overlay-text):
* lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces):
* lisp/org/org-indent.el (org-indent-set-line-properties):
* lisp/org/org-macs.el (org-get-limited-outline-regexp):
* lisp/org/org-mobile.el (org-mobile-files):
* lisp/org/org.el (org-use-fast-todo-selection)
(org-extend-today-until, org-use-property-inheritance)
(org-refresh-effort-properties, org-open-at-point-global)
(org-track-ordered-property-with-tag, org-shiftright):
* lisp/org/ox-html.el (org-html-checkbox-type):
* lisp/org/ox-man.el (org-man-source-highlight)
(org-man-verse-block):
* lisp/org/ox-publish.el (org-publish-sitemap-default):
* lisp/outline.el (outline-head-from-level):
* lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1)
(dcl-calc-command-indent, dcl-indent-to):
* lisp/progmodes/flymake.el (flymake-make-diagnostic)
(flymake--overlays, flymake-diagnostic-functions)
(flymake-diagnostic-types-alist, flymake--backend-state)
(flymake-is-running, flymake--collect, flymake-mode):
* lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop)
(gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer):
* lisp/progmodes/grep.el (grep-error-screen-columns):
* lisp/progmodes/gud.el (gud-prev-expr):
* lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column)
(ps-run-goto-error):
* lisp/progmodes/python.el (python-eldoc-get-doc)
(python-eldoc-function-timeout-permanent, python-eldoc-function):
* lisp/shadowfile.el (shadow-make-group):
* lisp/speedbar.el (speedbar-obj-do-check):
* lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook):
* lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib):
* lisp/textmodes/reftex-index.el (reftex-index-goto-entry)
(reftex-index-kill, reftex-index-undo):
* lisp/textmodes/reftex-parse.el (reftex-context-substring):
* lisp/textmodes/reftex.el (reftex-TeX-master-file):
* lisp/textmodes/rst.el (rst-next-hdr, rst-toc)
(rst-uncomment-region, rst-font-lock-extend-region-internal):
* lisp/thumbs.el (thumbs-mode):
* lisp/vc/ediff-util.el (ediff-restore-diff):
* lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag):
* lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p):
* lisp/wid-edit.el (widget-field-value-set, string):
* lisp/x-dnd.el (x-dnd-version-from-flags)
(x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-21 00:27:53 +02:00
|
|
|
See also: `erc-sort-channel-users-by-activity'."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let (users)
|
|
|
|
(if (hash-table-p erc-channel-users)
|
2014-11-08 20:51:43 -05:00
|
|
|
(maphash (lambda (_nick cdata)
|
|
|
|
(setq users (cons cdata users)))
|
|
|
|
erc-channel-users))
|
2006-01-29 13:08:58 +00:00
|
|
|
users))
|
|
|
|
|
|
|
|
(defun erc-get-server-nickname-list ()
|
2013-08-22 00:06:45 -04:00
|
|
|
"Return a list of known nicknames on the current server."
|
2007-04-01 13:36:38 +00:00
|
|
|
(erc-with-server-buffer
|
|
|
|
(let (nicks)
|
|
|
|
(when (hash-table-p erc-server-users)
|
2014-11-08 20:51:43 -05:00
|
|
|
(maphash (lambda (_n user)
|
|
|
|
(setq nicks
|
|
|
|
(cons (erc-server-user-nickname user)
|
|
|
|
nicks)))
|
|
|
|
erc-server-users)
|
|
|
|
nicks))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-get-channel-nickname-list ()
|
2013-08-22 00:06:45 -04:00
|
|
|
"Return a list of known nicknames on the current channel."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let (nicks)
|
|
|
|
(when (hash-table-p erc-channel-users)
|
2013-08-22 00:06:45 -04:00
|
|
|
(maphash (lambda (_n cdata)
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq nicks
|
|
|
|
(cons (erc-server-user-nickname (car cdata))
|
|
|
|
nicks)))
|
|
|
|
erc-channel-users)
|
2006-01-29 13:08:58 +00:00
|
|
|
nicks)))
|
|
|
|
|
|
|
|
(defun erc-get-server-nickname-alist ()
|
2013-08-22 00:06:45 -04:00
|
|
|
"Return an alist of known nicknames on the current server."
|
2007-04-01 13:36:38 +00:00
|
|
|
(erc-with-server-buffer
|
|
|
|
(let (nicks)
|
|
|
|
(when (hash-table-p erc-server-users)
|
2014-11-08 20:51:43 -05:00
|
|
|
(maphash (lambda (_n user)
|
|
|
|
(setq nicks
|
|
|
|
(cons (cons (erc-server-user-nickname user) nil)
|
|
|
|
nicks)))
|
|
|
|
erc-server-users)
|
|
|
|
nicks))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-get-channel-nickname-alist ()
|
2013-08-22 00:06:45 -04:00
|
|
|
"Return an alist of known nicknames on the current channel."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let (nicks)
|
|
|
|
(when (hash-table-p erc-channel-users)
|
2013-08-22 00:06:45 -04:00
|
|
|
(maphash (lambda (_n cdata)
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq nicks
|
|
|
|
(cons (cons (erc-server-user-nickname (car cdata)) nil)
|
|
|
|
nicks)))
|
|
|
|
erc-channel-users)
|
2006-01-29 13:08:58 +00:00
|
|
|
nicks)))
|
|
|
|
|
|
|
|
(defun erc-sort-channel-users-by-activity (list)
|
2013-08-22 00:06:45 -04:00
|
|
|
"Sort LIST such that users which have spoken most recently are listed first.
|
|
|
|
LIST must be of the form (USER . CHANNEL-DATA).
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
See also: `erc-get-channel-user-list'."
|
|
|
|
(sort list
|
2014-11-08 20:51:43 -05:00
|
|
|
(lambda (x y)
|
|
|
|
(when (and (cdr x) (cdr y))
|
|
|
|
(let ((tx (erc-channel-user-last-message-time (cdr x)))
|
|
|
|
(ty (erc-channel-user-last-message-time (cdr y))))
|
|
|
|
(and tx
|
|
|
|
(or (not ty)
|
|
|
|
(time-less-p ty tx))))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-sort-channel-users-alphabetically (list)
|
|
|
|
"Sort LIST so that users' nicknames are in alphabetical order.
|
|
|
|
LIST must be of the form (USER . CHANNEL-DATA).
|
|
|
|
|
|
|
|
See also: `erc-get-channel-user-list'."
|
|
|
|
(sort list
|
2014-11-08 20:51:43 -05:00
|
|
|
(lambda (x y)
|
|
|
|
(when (and (cdr x) (cdr y))
|
|
|
|
(let ((nickx (downcase (erc-server-user-nickname (car x))))
|
|
|
|
(nicky (downcase (erc-server-user-nickname (car y)))))
|
|
|
|
(and nickx
|
|
|
|
(or (not nicky)
|
|
|
|
(string-lessp nickx nicky))))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-channel-topic nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"A topic string for the channel. Should only be used in channel-buffers.")
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-channel-modes nil
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
"List of letters, as strings, representing channel modes.
|
|
|
|
For example, (\"i\" \"m\" \"s\"). Modes that take accompanying
|
|
|
|
parameters are not included.")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-insert-marker nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"The place where insertion of new text in erc buffers should happen.")
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-input-marker nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"The marker where input should be inserted.")
|
|
|
|
|
|
|
|
(defun erc-string-no-properties (string)
|
|
|
|
"Return a copy of STRING will all text-properties removed."
|
|
|
|
(let ((newstring (copy-sequence string)))
|
|
|
|
(set-text-properties 0 (length newstring) nil newstring)
|
|
|
|
newstring))
|
|
|
|
|
|
|
|
(defcustom erc-prompt "ERC>"
|
|
|
|
"Prompt used by ERC. Trailing whitespace is not required."
|
|
|
|
:group 'erc-display
|
2021-10-07 14:26:36 +02:00
|
|
|
:type '(choice string
|
|
|
|
(function-item :tag "Interpret format specifiers"
|
|
|
|
erc-prompt-format)
|
|
|
|
function))
|
|
|
|
|
|
|
|
(defvar erc--prompt-format-face-example
|
|
|
|
#("%p%m%a\u00b7%b>"
|
|
|
|
0 2 (font-lock-face erc-my-nick-prefix-face)
|
|
|
|
2 4 (font-lock-face font-lock-keyword-face)
|
|
|
|
4 6 (font-lock-face erc-error-face)
|
|
|
|
6 7 (font-lock-face shadow)
|
|
|
|
7 9 (font-lock-face font-lock-constant-face)
|
|
|
|
9 10 (font-lock-face shadow))
|
|
|
|
"An example value for option `erc-prompt-format' with faces.")
|
|
|
|
|
|
|
|
(defcustom erc-prompt-format erc--prompt-format-face-example
|
|
|
|
"Format string when `erc-prompt' is `erc-prompt-format'.
|
|
|
|
ERC recognizes these substitution specifiers:
|
|
|
|
|
|
|
|
%a - away indicator
|
|
|
|
%b - buffer name
|
|
|
|
%t - channel or query target, server domain, or dialed address
|
|
|
|
%S - target@network or buffer name
|
|
|
|
%s - target@server or server
|
|
|
|
%N - current network, like Libera.Chat
|
|
|
|
%p - channel membership prefix, like @ or +
|
|
|
|
%n - current nickname
|
|
|
|
%c - channel modes with args for select modes
|
|
|
|
%C - channel modes with all args
|
|
|
|
%u - user modes
|
|
|
|
%m - channel modes sans args in channels, user modes elsewhere
|
|
|
|
%M - like %m but show nothing in query buffers
|
|
|
|
|
|
|
|
To pick your own colors, do something like:
|
|
|
|
|
|
|
|
(setopt erc-prompt-format
|
|
|
|
(concat
|
|
|
|
(propertize \"%b\" \\='font-lock-face \\='erc-input-face)
|
|
|
|
(propertize \"%a\" \\='font-lock-face \\='erc-error-face)))
|
|
|
|
|
|
|
|
Please remember that ERC ignores this option completely unless
|
|
|
|
the \"parent\" option `erc-prompt' is set to `erc-prompt-format'."
|
|
|
|
:package-version '(ERC . "5.6")
|
|
|
|
:group 'erc-display
|
|
|
|
:type `(choice (const :tag "{Prefix}{Mode}{Away}{MIDDLE DOT}{Buffer}>"
|
|
|
|
,erc--prompt-format-face-example)
|
|
|
|
string))
|
|
|
|
|
|
|
|
(defun erc-prompt-format ()
|
|
|
|
"Make predefined `format-spec' substitutions.
|
|
|
|
|
|
|
|
See option `erc-prompt-format' and option `erc-prompt'."
|
|
|
|
(format-spec erc-prompt-format
|
|
|
|
(erc-compat--defer-format-spec-in-buffer
|
|
|
|
(?C erc--channel-modes 3 ",")
|
|
|
|
(?M erc--format-modes 'no-query-p)
|
|
|
|
(?N erc-format-network)
|
|
|
|
(?S erc-format-target-and/or-network)
|
|
|
|
(?a erc--format-away-indicator)
|
|
|
|
(?b buffer-name)
|
|
|
|
(?c erc-format-channel-modes)
|
|
|
|
(?m erc--format-modes)
|
|
|
|
(?n erc-current-nick)
|
|
|
|
(?p erc--format-channel-status-prefix)
|
|
|
|
(?s erc-format-target-and/or-server)
|
|
|
|
(?t erc-format-target)
|
|
|
|
(?u erc--format-user-modes))
|
|
|
|
'ignore-missing)) ; formerly `only-present'
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-prompt ()
|
|
|
|
"Return the input prompt as a string.
|
|
|
|
|
|
|
|
See also the variable `erc-prompt'."
|
|
|
|
(let ((prompt (if (functionp erc-prompt)
|
2014-11-08 20:51:43 -05:00
|
|
|
(funcall erc-prompt)
|
|
|
|
erc-prompt)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (> (length prompt) 0)
|
2014-11-08 20:51:43 -05:00
|
|
|
(concat prompt " ")
|
2006-01-29 13:08:58 +00:00
|
|
|
prompt)))
|
|
|
|
|
|
|
|
(defcustom erc-notice-prefix "*** "
|
2012-04-09 21:05:48 +08:00
|
|
|
"Prefix for all notices."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-display
|
|
|
|
:type 'string)
|
|
|
|
|
|
|
|
(defcustom erc-notice-highlight-type 'all
|
2012-04-09 21:05:48 +08:00
|
|
|
"Determines how to highlight notices.
|
2006-01-29 13:08:58 +00:00
|
|
|
See `erc-notice-prefix'.
|
|
|
|
|
|
|
|
The following values are allowed:
|
|
|
|
|
Prefer directed to neutral quotes
Prefer directed to neutral quotes in docstings and diagnostics.
In docstrings, escape apostrophes that would otherwise be translated
to curved quotes using the newer, simpler rules.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-lang.el (math-read-giac-subscr)
(math-read-math-subscr):
* lisp/calc/calc-misc.el (report-calc-bug):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/dabbrev.el (dabbrev-expand):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/elint.el (elint-get-top-forms):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emulation/viper-cmd.el (viper-toggle-search-style):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-arg.el (eshell-parse-arguments):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/files-x.el (modify-file-local-variable):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer)
(filesets-update-pre010505):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/gnus/auth-source.el (auth-source-netrc-parse-entries):
* lisp/gnus/gnus-agent.el (gnus-agent-check-overview-buffer)
(gnus-agent-fetch-headers):
* lisp/gnus/gnus-int.el (gnus-start-news-server):
* lisp/gnus/gnus-registry.el:
(gnus-registry--split-fancy-with-parent-internal):
* lisp/gnus/gnus-score.el (gnus-summary-increase-score):
* lisp/gnus/gnus-start.el (gnus-convert-old-newsrc):
* lisp/gnus/gnus-topic.el (gnus-topic-rename):
* lisp/gnus/legacy-gnus-agent.el (gnus-agent-unlist-expire-days):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/gnus/spam.el (spam-check-blackholes):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/tramp-cache.el:
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-bibtex.el (org-bibtex-fields):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/play/dunnet.el (dun-score, dun-help, dun-endgame-question)
(dun-rooms, dun-endgame-questions):
* lisp/progmodes/ada-mode.el (ada-goto-matching-start):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/antlr-mode.el (antlr-options-alists):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/server.el (server-get-auth-key):
* lisp/subr.el (version-to-list):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/vc/ediff-diff.el (ediff-same-contents):
* lisp/vc/vc-cvs.el (vc-cvs-mode-line-string):
* test/automated/tramp-tests.el (tramp-test33-asynchronous-requests):
Use directed rather than neutral quotes in diagnostics.
2015-08-24 23:39:33 -07:00
|
|
|
`prefix' - highlight notice prefix only
|
|
|
|
`all' - highlight the entire notice
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
Any other value disables notice's highlighting altogether."
|
|
|
|
:group 'erc-display
|
|
|
|
:type '(choice (const :tag "highlight notice prefix only" prefix)
|
2014-11-08 20:51:43 -05:00
|
|
|
(const :tag "highlight the entire notice" all)
|
|
|
|
(const :tag "don't highlight notices at all" nil)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defcustom erc-echo-notice-hook nil
|
2013-08-22 00:06:45 -04:00
|
|
|
"List of functions to call to echo a private notice.
|
|
|
|
Each function is called with four arguments, the string
|
2006-01-29 13:08:58 +00:00
|
|
|
to display, the parsed server message, the target buffer (or
|
|
|
|
nil), and the sender. The functions are called in order, until a
|
|
|
|
function evaluates to non-nil. These hooks are called after
|
|
|
|
those specified in `erc-echo-notice-always-hook'.
|
|
|
|
|
|
|
|
See also: `erc-echo-notice-always-hook',
|
|
|
|
`erc-echo-notice-in-default-buffer',
|
|
|
|
`erc-echo-notice-in-target-buffer',
|
|
|
|
`erc-echo-notice-in-minibuffer',
|
|
|
|
`erc-echo-notice-in-server-buffer',
|
|
|
|
`erc-echo-notice-in-active-non-server-buffer',
|
|
|
|
`erc-echo-notice-in-active-buffer',
|
|
|
|
`erc-echo-notice-in-user-buffers',
|
|
|
|
`erc-echo-notice-in-user-and-target-buffers',
|
lisp/*.el: Fix typos and other trivial doc fixes
* lisp/allout-widgets.el (allout-widgets-auto-activation)
(allout-current-decorated-p):
* lisp/auth-source.el (auth-source-protocols):
* lisp/autorevert.el (auto-revert-set-timer):
* lisp/battery.el (battery-mode-line-limit):
* lisp/calc/calcalg3.el (math-map-binop):
* lisp/calendar/cal-dst.el (calendar-dst-find-startend):
* lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute):
* lisp/calendar/calendar.el (calendar-date-echo-text)
(calendar-generate-month, calendar-string-spread)
(calendar-cursor-to-date, calendar-read, calendar-read-date)
(calendar-mark-visible-date, calendar-dayname-on-or-before):
* lisp/calendar/diary-lib.el (diary-ordinal-suffix):
* lisp/cedet/ede/autoconf-edit.el (autoconf-new-program)
(autoconf-find-last-macro, autoconf-parameter-strip):
* lisp/cedet/ede/config.el (ede-target-with-config-build):
* lisp/cedet/ede/linux.el (ede-linux--detect-architecture)
(ede-linux--get-architecture):
* lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache)
(semantic-displayer-abstract, semantic-displayer-point-position):
* lisp/cedet/semantic/format.el (semantic-format-face-alist)
(semantic-format-tag-short-doc):
* lisp/cedet/semantic/fw.el (semantic-find-file-noselect):
* lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time)
(semantic-idle-breadcrumbs-display-function)
(semantic-idle-breadcrumbs-format-tag-list-function):
* lisp/cedet/semantic/lex.el (semantic-lex-map-types)
(define-lex, define-lex-block-type-analyzer):
* lisp/cedet/semantic/senator.el (senator-search-default-tag-filter):
* lisp/cedet/semantic/symref.el (semantic-symref-result)
(semantic-symref-hit-to-tag-via-db):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-new-variable)
(semantic-tag-new-include, semantic-tag-new-package)
(semantic-tag-set-faux, semantic-create-tag-proxy)
(semantic-tag-function-parent)
(semantic-tag-components-with-overlays):
* lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces)
(srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict):
* lisp/cedet/srecode/dictionary.el (srecode-create-dictionary)
(srecode-dictionary-add-entries, srecode-dictionary-lookup-name)
(srecode-create-dictionaries-from-tags):
* lisp/cmuscheme.el (scheme-compile-region):
* lisp/color.el (color-lab-to-lch):
* lisp/doc-view.el (doc-view-image-width)
(doc-view-set-up-single-converter):
* lisp/dynamic-setting.el (font-setting-change-default-font)
(dynamic-setting-handle-config-changed-event):
* lisp/elec-pair.el (electric-pair-text-pairs)
(electric-pair-skip-whitespace-function)
(electric-pair-string-bound-function):
* lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance)
(avl-tree-member, avl-tree-mapcar, avl-tree-iter):
* lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree):
* lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag)
(checkdoc-spellcheck-documentation-flag, checkdoc-ispell)
(checkdoc-ispell-current-buffer, checkdoc-ispell-interactive)
(checkdoc-ispell-message-interactive)
(checkdoc-ispell-message-text, checkdoc-ispell-start)
(checkdoc-ispell-continue, checkdoc-ispell-comments)
(checkdoc-ispell-defun):
* lisp/emacs-lisp/cl-generic.el (cl--generic-search-method):
* lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group):
* lisp/emacs-lisp/lisp.el (forward-sexp, up-list):
* lisp/emacs-lisp/package-x.el (package--archive-contents-from-file):
* lisp/emacs-lisp/package.el (package-desc)
(package--make-autoloads-and-stuff, package-hidden-regexps):
* lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup):
* lisp/emacs-lisp/testcover.el (testcover-nohits)
(testcover-1value):
* lisp/epg.el (epg-receive-keys, epg-start-edit-key):
* lisp/erc/erc-backend.el (erc-server-processing-p)
(erc-split-line-length, erc-server-coding-system)
(erc-server-send, erc-message):
* lisp/erc/erc-button.el (erc-button-face, erc-button-alist)
(erc-browse-emacswiki):
* lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login):
* lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation):
* lisp/erc/erc-log.el (erc-current-logfile):
* lisp/erc/erc-match.el (erc-log-match-format)
(erc-text-matched-hook):
* lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug):
* lisp/erc/erc-networks.el (erc-server-alist)
(erc-networks-alist, erc-current-network):
* lisp/erc/erc-ring.el (erc-input-ring-index):
* lisp/erc/erc-speedbar.el (erc-speedbar)
(erc-speedbar-update-channel):
* lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag):
* lisp/erc/erc-track.el (erc-track-position-in-mode-line)
(erc-track-remove-from-mode-line, erc-modified-channels-update)
(erc-track-last-non-erc-buffer, erc-track-sort-by-importance)
(erc-track-get-active-buffer):
* lisp/erc/erc.el (erc-get-channel-user-list)
(erc-echo-notice-hook, erc-echo-notice-always-hook)
(erc-wash-quit-reason, erc-format-@nick):
* lisp/ffap.el (ffap-latex-mode):
* lisp/files.el (abort-if-file-too-large)
(dir-locals--get-sort-score, buffer-stale--default-function):
* lisp/filesets.el (filesets-tree-max-level, filesets-data)
(filesets-update-pre010505):
* lisp/gnus/gnus-agent.el (gnus-agent-flush-cache):
* lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol)
(gnus-button-prefer-mid-or-mail):
* lisp/gnus/gnus-cus.el (gnus-group-parameters):
* lisp/gnus/gnus-demon.el (gnus-demon-handlers)
(gnus-demon-run-callback):
* lisp/gnus/gnus-dired.el (gnus-dired-print):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer):
* lisp/gnus/gnus-range.el (gnus-range-normalize):
* lisp/gnus/gnus-spec.el (gnus-pad-form):
* lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud)
(gnus-server-opened, gnus-server-closed, gnus-server-denied)
(gnus-server-offline):
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir)
(gnus-refer-thread-limit-to-thread)
(gnus-summary-limit-include-thread, gnus-summary-refer-thread)
(gnus-summary-find-matching):
* lisp/gnus/gnus-util.el (gnus-rescale-image):
* lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server):
* lisp/gnus/mail-source.el (mail-source-incoming-file-prefix):
* lisp/gnus/message.el (message-cite-reply-position)
(message-cite-style-outlook, message-cite-style-thunderbird)
(message-cite-style-gmail, message--send-mail-maybe-partially):
* lisp/gnus/mm-extern.el (mm-inline-external-body):
* lisp/gnus/mm-partial.el (mm-inline-partial):
* lisp/gnus/mml-sec.el (mml-secure-message-sign)
(mml-secure-message-sign-encrypt, mml-secure-message-encrypt):
* lisp/gnus/mml2015.el (mml2015-epg-key-image)
(mml2015-epg-key-image-to-string):
* lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail):
* lisp/gnus/nnheader.el (nnheader-directory-files-is-safe):
* lisp/gnus/nnir.el (nnir-search-history)
(nnir-imap-search-other, nnir-artlist-length)
(nnir-artlist-article, nnir-artitem-group, nnir-artitem-number)
(nnir-artitem-rsv, nnir-article-group, nnir-article-number)
(nnir-article-rsv, nnir-article-ids, nnir-categorize)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-hyrex-additional-switches)
(gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms)
(nnir-read-parm, nnir-read-server-parm, nnir-search-thread):
* lisp/gnus/nnmairix.el (nnmairix-default-group)
(nnmairix-propagate-marks):
* lisp/gnus/smime.el (smime-keys, smime-crl-check)
(smime-verify-buffer, smime-noverify-buffer):
* lisp/gnus/spam-report.el (spam-report-url-ping-mm-url):
* lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header)
(spam-spamassassin-spam-status-header, spam-sa-learn-rebuild)
(spam-classifications, spam-check-stat, spam-spamassassin-score):
* lisp/help.el (describe-minor-mode-from-symbol):
* lisp/hippie-exp.el (hippie-expand-ignore-buffers):
* lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face)
(hfy-begin-span):
* lisp/ibuf-ext.el (ibuffer-update-saved-filters-format)
(ibuffer-saved-filters, ibuffer-old-saved-filters-warning)
(ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters)
(eval, ibuffer-unary-operand, file-extension, directory):
* lisp/image-dired.el (image-dired-cmd-pngcrush-options):
* lisp/image-mode.el (image-toggle-display):
* lisp/international/ccl.el (ccl-compile-read-multibyte-character)
(ccl-compile-write-multibyte-character):
* lisp/international/kkc.el (kkc-save-init-file):
* lisp/international/latin1-disp.el (latin1-display):
* lisp/international/ogonek.el (ogonek-name-encoding-alist)
(ogonek-information, ogonek-lookup-encoding)
(ogonek-deprefixify-region):
* lisp/isearch.el (isearch-filter-predicate)
(isearch--momentary-message):
* lisp/jsonrpc.el (jsonrpc-connection-send)
(jsonrpc-process-connection, jsonrpc-shutdown)
(jsonrpc--async-request-1):
* lisp/language/tibet-util.el (tibetan-char-p):
* lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date)
(feedmail-last-chance-hook, feedmail-before-fcc-hook)
(feedmail-send-it-immediately-wrapper, feedmail-find-eoh):
* lisp/mail/hashcash.el (hashcash-generate-payment)
(hashcash-generate-payment-async, hashcash-insert-payment)
(hashcash-verify-payment):
* lisp/mail/rmail.el (rmail-movemail-variant-in-use)
(rmail-get-attr-value):
* lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime):
* lisp/mail/rmailsum.el (rmail-summary-show-message):
* lisp/mail/supercite.el (sc-raw-mode-toggle):
* lisp/man.el (Man-start-calling):
* lisp/mh-e/mh-acros.el (mh-do-at-event-location)
(mh-iterate-on-messages-in-region, mh-iterate-on-range):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases)
(mh-alias-reload, mh-alias-ali)
(mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file)
(mh-alias-add-alias):
* lisp/mouse.el (mouse-save-then-kill):
* lisp/net/browse-url.el (browse-url-default-macosx-browser):
* lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value)
(eudc-variable-server-value, eudc-update-variable)
(eudc-expand-inline):
* lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result):
* lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list):
* lisp/net/pop3.el (pop3-list):
* lisp/net/soap-client.el (soap-namespace-put)
(soap-xs-parse-sequence, soap-parse-envelope):
* lisp/net/soap-inspect.el (soap-inspect-xs-complex-type):
* lisp/nxml/rng-xsd.el (rng-xsd-date-to-days):
* lisp/org/ob-C.el (org-babel-prep-session:C)
(org-babel-load-session:C):
* lisp/org/ob-J.el (org-babel-execute:J):
* lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote):
* lisp/org/ob-awk.el (org-babel-execute:awk):
* lisp/org/ob-core.el (org-babel-process-file-name):
* lisp/org/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/org/ob-forth.el (org-babel-execute:forth):
* lisp/org/ob-fortran.el (org-babel-execute:fortran)
(org-babel-prep-session:fortran, org-babel-load-session:fortran):
* lisp/org/ob-groovy.el (org-babel-execute:groovy):
* lisp/org/ob-io.el (org-babel-execute:io):
* lisp/org/ob-js.el (org-babel-execute:js):
* lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond)
(org-babel-lilypond-compile-post-tangle)
(org-babel-lilypond-display-pdf-post-tangle)
(org-babel-lilypond-tangle)
(org-babel-lilypond-execute-tangled-ly)
(org-babel-lilypond-compile-lilyfile)
(org-babel-lilypond-check-for-compile-error)
(org-babel-lilypond-process-compile-error)
(org-babel-lilypond-mark-error-line)
(org-babel-lilypond-parse-error-line)
(org-babel-lilypond-attempt-to-open-pdf)
(org-babel-lilypond-attempt-to-play-midi)
(org-babel-lilypond-switch-extension)
(org-babel-lilypond-set-header-args):
* lisp/org/ob-lua.el (org-babel-prep-session:lua):
* lisp/org/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/org/ob-processing.el (org-babel-prep-session:processing):
* lisp/org/ob-python.el (org-babel-prep-session:python):
* lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message)
(org-babel-scheme-execute-with-geiser, org-babel-execute:scheme):
* lisp/org/ob-shen.el (org-babel-execute:shen):
* lisp/org/org-agenda.el (org-agenda-entry-types)
(org-agenda-move-date-from-past-immediately-to-today)
(org-agenda-time-grid, org-agenda-sorting-strategy)
(org-agenda-filter-by-category, org-agenda-forward-block):
* lisp/org/org-colview.el (org-columns--overlay-text):
* lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces):
* lisp/org/org-indent.el (org-indent-set-line-properties):
* lisp/org/org-macs.el (org-get-limited-outline-regexp):
* lisp/org/org-mobile.el (org-mobile-files):
* lisp/org/org.el (org-use-fast-todo-selection)
(org-extend-today-until, org-use-property-inheritance)
(org-refresh-effort-properties, org-open-at-point-global)
(org-track-ordered-property-with-tag, org-shiftright):
* lisp/org/ox-html.el (org-html-checkbox-type):
* lisp/org/ox-man.el (org-man-source-highlight)
(org-man-verse-block):
* lisp/org/ox-publish.el (org-publish-sitemap-default):
* lisp/outline.el (outline-head-from-level):
* lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1)
(dcl-calc-command-indent, dcl-indent-to):
* lisp/progmodes/flymake.el (flymake-make-diagnostic)
(flymake--overlays, flymake-diagnostic-functions)
(flymake-diagnostic-types-alist, flymake--backend-state)
(flymake-is-running, flymake--collect, flymake-mode):
* lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop)
(gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer):
* lisp/progmodes/grep.el (grep-error-screen-columns):
* lisp/progmodes/gud.el (gud-prev-expr):
* lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column)
(ps-run-goto-error):
* lisp/progmodes/python.el (python-eldoc-get-doc)
(python-eldoc-function-timeout-permanent, python-eldoc-function):
* lisp/shadowfile.el (shadow-make-group):
* lisp/speedbar.el (speedbar-obj-do-check):
* lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook):
* lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib):
* lisp/textmodes/reftex-index.el (reftex-index-goto-entry)
(reftex-index-kill, reftex-index-undo):
* lisp/textmodes/reftex-parse.el (reftex-context-substring):
* lisp/textmodes/reftex.el (reftex-TeX-master-file):
* lisp/textmodes/rst.el (rst-next-hdr, rst-toc)
(rst-uncomment-region, rst-font-lock-extend-region-internal):
* lisp/thumbs.el (thumbs-mode):
* lisp/vc/ediff-util.el (ediff-restore-diff):
* lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag):
* lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p):
* lisp/wid-edit.el (widget-field-value-set, string):
* lisp/x-dnd.el (x-dnd-version-from-flags)
(x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-21 00:27:53 +02:00
|
|
|
`erc-echo-notice-in-first-user-buffer'."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook
|
|
|
|
:options '(erc-echo-notice-in-default-buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
erc-echo-notice-in-target-buffer
|
|
|
|
erc-echo-notice-in-minibuffer
|
|
|
|
erc-echo-notice-in-server-buffer
|
|
|
|
erc-echo-notice-in-active-non-server-buffer
|
|
|
|
erc-echo-notice-in-active-buffer
|
|
|
|
erc-echo-notice-in-user-buffers
|
|
|
|
erc-echo-notice-in-user-and-target-buffers
|
|
|
|
erc-echo-notice-in-first-user-buffer))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defcustom erc-echo-notice-always-hook
|
|
|
|
'(erc-echo-notice-in-default-buffer)
|
2013-08-22 00:06:45 -04:00
|
|
|
"List of functions to call to echo a private notice.
|
|
|
|
Each function is called with four arguments, the string
|
2006-01-29 13:08:58 +00:00
|
|
|
to display, the parsed server message, the target buffer (or
|
|
|
|
nil), and the sender. The functions are called in order, and all
|
|
|
|
functions are called. These hooks are called before those
|
|
|
|
specified in `erc-echo-notice-hook'.
|
|
|
|
|
|
|
|
See also: `erc-echo-notice-hook',
|
|
|
|
`erc-echo-notice-in-default-buffer',
|
|
|
|
`erc-echo-notice-in-target-buffer',
|
|
|
|
`erc-echo-notice-in-minibuffer',
|
|
|
|
`erc-echo-notice-in-server-buffer',
|
|
|
|
`erc-echo-notice-in-active-non-server-buffer',
|
|
|
|
`erc-echo-notice-in-active-buffer',
|
|
|
|
`erc-echo-notice-in-user-buffers',
|
|
|
|
`erc-echo-notice-in-user-and-target-buffers',
|
lisp/*.el: Fix typos and other trivial doc fixes
* lisp/allout-widgets.el (allout-widgets-auto-activation)
(allout-current-decorated-p):
* lisp/auth-source.el (auth-source-protocols):
* lisp/autorevert.el (auto-revert-set-timer):
* lisp/battery.el (battery-mode-line-limit):
* lisp/calc/calcalg3.el (math-map-binop):
* lisp/calendar/cal-dst.el (calendar-dst-find-startend):
* lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute):
* lisp/calendar/calendar.el (calendar-date-echo-text)
(calendar-generate-month, calendar-string-spread)
(calendar-cursor-to-date, calendar-read, calendar-read-date)
(calendar-mark-visible-date, calendar-dayname-on-or-before):
* lisp/calendar/diary-lib.el (diary-ordinal-suffix):
* lisp/cedet/ede/autoconf-edit.el (autoconf-new-program)
(autoconf-find-last-macro, autoconf-parameter-strip):
* lisp/cedet/ede/config.el (ede-target-with-config-build):
* lisp/cedet/ede/linux.el (ede-linux--detect-architecture)
(ede-linux--get-architecture):
* lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache)
(semantic-displayer-abstract, semantic-displayer-point-position):
* lisp/cedet/semantic/format.el (semantic-format-face-alist)
(semantic-format-tag-short-doc):
* lisp/cedet/semantic/fw.el (semantic-find-file-noselect):
* lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time)
(semantic-idle-breadcrumbs-display-function)
(semantic-idle-breadcrumbs-format-tag-list-function):
* lisp/cedet/semantic/lex.el (semantic-lex-map-types)
(define-lex, define-lex-block-type-analyzer):
* lisp/cedet/semantic/senator.el (senator-search-default-tag-filter):
* lisp/cedet/semantic/symref.el (semantic-symref-result)
(semantic-symref-hit-to-tag-via-db):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-new-variable)
(semantic-tag-new-include, semantic-tag-new-package)
(semantic-tag-set-faux, semantic-create-tag-proxy)
(semantic-tag-function-parent)
(semantic-tag-components-with-overlays):
* lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces)
(srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict):
* lisp/cedet/srecode/dictionary.el (srecode-create-dictionary)
(srecode-dictionary-add-entries, srecode-dictionary-lookup-name)
(srecode-create-dictionaries-from-tags):
* lisp/cmuscheme.el (scheme-compile-region):
* lisp/color.el (color-lab-to-lch):
* lisp/doc-view.el (doc-view-image-width)
(doc-view-set-up-single-converter):
* lisp/dynamic-setting.el (font-setting-change-default-font)
(dynamic-setting-handle-config-changed-event):
* lisp/elec-pair.el (electric-pair-text-pairs)
(electric-pair-skip-whitespace-function)
(electric-pair-string-bound-function):
* lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance)
(avl-tree-member, avl-tree-mapcar, avl-tree-iter):
* lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree):
* lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag)
(checkdoc-spellcheck-documentation-flag, checkdoc-ispell)
(checkdoc-ispell-current-buffer, checkdoc-ispell-interactive)
(checkdoc-ispell-message-interactive)
(checkdoc-ispell-message-text, checkdoc-ispell-start)
(checkdoc-ispell-continue, checkdoc-ispell-comments)
(checkdoc-ispell-defun):
* lisp/emacs-lisp/cl-generic.el (cl--generic-search-method):
* lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group):
* lisp/emacs-lisp/lisp.el (forward-sexp, up-list):
* lisp/emacs-lisp/package-x.el (package--archive-contents-from-file):
* lisp/emacs-lisp/package.el (package-desc)
(package--make-autoloads-and-stuff, package-hidden-regexps):
* lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup):
* lisp/emacs-lisp/testcover.el (testcover-nohits)
(testcover-1value):
* lisp/epg.el (epg-receive-keys, epg-start-edit-key):
* lisp/erc/erc-backend.el (erc-server-processing-p)
(erc-split-line-length, erc-server-coding-system)
(erc-server-send, erc-message):
* lisp/erc/erc-button.el (erc-button-face, erc-button-alist)
(erc-browse-emacswiki):
* lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login):
* lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation):
* lisp/erc/erc-log.el (erc-current-logfile):
* lisp/erc/erc-match.el (erc-log-match-format)
(erc-text-matched-hook):
* lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug):
* lisp/erc/erc-networks.el (erc-server-alist)
(erc-networks-alist, erc-current-network):
* lisp/erc/erc-ring.el (erc-input-ring-index):
* lisp/erc/erc-speedbar.el (erc-speedbar)
(erc-speedbar-update-channel):
* lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag):
* lisp/erc/erc-track.el (erc-track-position-in-mode-line)
(erc-track-remove-from-mode-line, erc-modified-channels-update)
(erc-track-last-non-erc-buffer, erc-track-sort-by-importance)
(erc-track-get-active-buffer):
* lisp/erc/erc.el (erc-get-channel-user-list)
(erc-echo-notice-hook, erc-echo-notice-always-hook)
(erc-wash-quit-reason, erc-format-@nick):
* lisp/ffap.el (ffap-latex-mode):
* lisp/files.el (abort-if-file-too-large)
(dir-locals--get-sort-score, buffer-stale--default-function):
* lisp/filesets.el (filesets-tree-max-level, filesets-data)
(filesets-update-pre010505):
* lisp/gnus/gnus-agent.el (gnus-agent-flush-cache):
* lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol)
(gnus-button-prefer-mid-or-mail):
* lisp/gnus/gnus-cus.el (gnus-group-parameters):
* lisp/gnus/gnus-demon.el (gnus-demon-handlers)
(gnus-demon-run-callback):
* lisp/gnus/gnus-dired.el (gnus-dired-print):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer):
* lisp/gnus/gnus-range.el (gnus-range-normalize):
* lisp/gnus/gnus-spec.el (gnus-pad-form):
* lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud)
(gnus-server-opened, gnus-server-closed, gnus-server-denied)
(gnus-server-offline):
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir)
(gnus-refer-thread-limit-to-thread)
(gnus-summary-limit-include-thread, gnus-summary-refer-thread)
(gnus-summary-find-matching):
* lisp/gnus/gnus-util.el (gnus-rescale-image):
* lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server):
* lisp/gnus/mail-source.el (mail-source-incoming-file-prefix):
* lisp/gnus/message.el (message-cite-reply-position)
(message-cite-style-outlook, message-cite-style-thunderbird)
(message-cite-style-gmail, message--send-mail-maybe-partially):
* lisp/gnus/mm-extern.el (mm-inline-external-body):
* lisp/gnus/mm-partial.el (mm-inline-partial):
* lisp/gnus/mml-sec.el (mml-secure-message-sign)
(mml-secure-message-sign-encrypt, mml-secure-message-encrypt):
* lisp/gnus/mml2015.el (mml2015-epg-key-image)
(mml2015-epg-key-image-to-string):
* lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail):
* lisp/gnus/nnheader.el (nnheader-directory-files-is-safe):
* lisp/gnus/nnir.el (nnir-search-history)
(nnir-imap-search-other, nnir-artlist-length)
(nnir-artlist-article, nnir-artitem-group, nnir-artitem-number)
(nnir-artitem-rsv, nnir-article-group, nnir-article-number)
(nnir-article-rsv, nnir-article-ids, nnir-categorize)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-hyrex-additional-switches)
(gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms)
(nnir-read-parm, nnir-read-server-parm, nnir-search-thread):
* lisp/gnus/nnmairix.el (nnmairix-default-group)
(nnmairix-propagate-marks):
* lisp/gnus/smime.el (smime-keys, smime-crl-check)
(smime-verify-buffer, smime-noverify-buffer):
* lisp/gnus/spam-report.el (spam-report-url-ping-mm-url):
* lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header)
(spam-spamassassin-spam-status-header, spam-sa-learn-rebuild)
(spam-classifications, spam-check-stat, spam-spamassassin-score):
* lisp/help.el (describe-minor-mode-from-symbol):
* lisp/hippie-exp.el (hippie-expand-ignore-buffers):
* lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face)
(hfy-begin-span):
* lisp/ibuf-ext.el (ibuffer-update-saved-filters-format)
(ibuffer-saved-filters, ibuffer-old-saved-filters-warning)
(ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters)
(eval, ibuffer-unary-operand, file-extension, directory):
* lisp/image-dired.el (image-dired-cmd-pngcrush-options):
* lisp/image-mode.el (image-toggle-display):
* lisp/international/ccl.el (ccl-compile-read-multibyte-character)
(ccl-compile-write-multibyte-character):
* lisp/international/kkc.el (kkc-save-init-file):
* lisp/international/latin1-disp.el (latin1-display):
* lisp/international/ogonek.el (ogonek-name-encoding-alist)
(ogonek-information, ogonek-lookup-encoding)
(ogonek-deprefixify-region):
* lisp/isearch.el (isearch-filter-predicate)
(isearch--momentary-message):
* lisp/jsonrpc.el (jsonrpc-connection-send)
(jsonrpc-process-connection, jsonrpc-shutdown)
(jsonrpc--async-request-1):
* lisp/language/tibet-util.el (tibetan-char-p):
* lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date)
(feedmail-last-chance-hook, feedmail-before-fcc-hook)
(feedmail-send-it-immediately-wrapper, feedmail-find-eoh):
* lisp/mail/hashcash.el (hashcash-generate-payment)
(hashcash-generate-payment-async, hashcash-insert-payment)
(hashcash-verify-payment):
* lisp/mail/rmail.el (rmail-movemail-variant-in-use)
(rmail-get-attr-value):
* lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime):
* lisp/mail/rmailsum.el (rmail-summary-show-message):
* lisp/mail/supercite.el (sc-raw-mode-toggle):
* lisp/man.el (Man-start-calling):
* lisp/mh-e/mh-acros.el (mh-do-at-event-location)
(mh-iterate-on-messages-in-region, mh-iterate-on-range):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases)
(mh-alias-reload, mh-alias-ali)
(mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file)
(mh-alias-add-alias):
* lisp/mouse.el (mouse-save-then-kill):
* lisp/net/browse-url.el (browse-url-default-macosx-browser):
* lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value)
(eudc-variable-server-value, eudc-update-variable)
(eudc-expand-inline):
* lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result):
* lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list):
* lisp/net/pop3.el (pop3-list):
* lisp/net/soap-client.el (soap-namespace-put)
(soap-xs-parse-sequence, soap-parse-envelope):
* lisp/net/soap-inspect.el (soap-inspect-xs-complex-type):
* lisp/nxml/rng-xsd.el (rng-xsd-date-to-days):
* lisp/org/ob-C.el (org-babel-prep-session:C)
(org-babel-load-session:C):
* lisp/org/ob-J.el (org-babel-execute:J):
* lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote):
* lisp/org/ob-awk.el (org-babel-execute:awk):
* lisp/org/ob-core.el (org-babel-process-file-name):
* lisp/org/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/org/ob-forth.el (org-babel-execute:forth):
* lisp/org/ob-fortran.el (org-babel-execute:fortran)
(org-babel-prep-session:fortran, org-babel-load-session:fortran):
* lisp/org/ob-groovy.el (org-babel-execute:groovy):
* lisp/org/ob-io.el (org-babel-execute:io):
* lisp/org/ob-js.el (org-babel-execute:js):
* lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond)
(org-babel-lilypond-compile-post-tangle)
(org-babel-lilypond-display-pdf-post-tangle)
(org-babel-lilypond-tangle)
(org-babel-lilypond-execute-tangled-ly)
(org-babel-lilypond-compile-lilyfile)
(org-babel-lilypond-check-for-compile-error)
(org-babel-lilypond-process-compile-error)
(org-babel-lilypond-mark-error-line)
(org-babel-lilypond-parse-error-line)
(org-babel-lilypond-attempt-to-open-pdf)
(org-babel-lilypond-attempt-to-play-midi)
(org-babel-lilypond-switch-extension)
(org-babel-lilypond-set-header-args):
* lisp/org/ob-lua.el (org-babel-prep-session:lua):
* lisp/org/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/org/ob-processing.el (org-babel-prep-session:processing):
* lisp/org/ob-python.el (org-babel-prep-session:python):
* lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message)
(org-babel-scheme-execute-with-geiser, org-babel-execute:scheme):
* lisp/org/ob-shen.el (org-babel-execute:shen):
* lisp/org/org-agenda.el (org-agenda-entry-types)
(org-agenda-move-date-from-past-immediately-to-today)
(org-agenda-time-grid, org-agenda-sorting-strategy)
(org-agenda-filter-by-category, org-agenda-forward-block):
* lisp/org/org-colview.el (org-columns--overlay-text):
* lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces):
* lisp/org/org-indent.el (org-indent-set-line-properties):
* lisp/org/org-macs.el (org-get-limited-outline-regexp):
* lisp/org/org-mobile.el (org-mobile-files):
* lisp/org/org.el (org-use-fast-todo-selection)
(org-extend-today-until, org-use-property-inheritance)
(org-refresh-effort-properties, org-open-at-point-global)
(org-track-ordered-property-with-tag, org-shiftright):
* lisp/org/ox-html.el (org-html-checkbox-type):
* lisp/org/ox-man.el (org-man-source-highlight)
(org-man-verse-block):
* lisp/org/ox-publish.el (org-publish-sitemap-default):
* lisp/outline.el (outline-head-from-level):
* lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1)
(dcl-calc-command-indent, dcl-indent-to):
* lisp/progmodes/flymake.el (flymake-make-diagnostic)
(flymake--overlays, flymake-diagnostic-functions)
(flymake-diagnostic-types-alist, flymake--backend-state)
(flymake-is-running, flymake--collect, flymake-mode):
* lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop)
(gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer):
* lisp/progmodes/grep.el (grep-error-screen-columns):
* lisp/progmodes/gud.el (gud-prev-expr):
* lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column)
(ps-run-goto-error):
* lisp/progmodes/python.el (python-eldoc-get-doc)
(python-eldoc-function-timeout-permanent, python-eldoc-function):
* lisp/shadowfile.el (shadow-make-group):
* lisp/speedbar.el (speedbar-obj-do-check):
* lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook):
* lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib):
* lisp/textmodes/reftex-index.el (reftex-index-goto-entry)
(reftex-index-kill, reftex-index-undo):
* lisp/textmodes/reftex-parse.el (reftex-context-substring):
* lisp/textmodes/reftex.el (reftex-TeX-master-file):
* lisp/textmodes/rst.el (rst-next-hdr, rst-toc)
(rst-uncomment-region, rst-font-lock-extend-region-internal):
* lisp/thumbs.el (thumbs-mode):
* lisp/vc/ediff-util.el (ediff-restore-diff):
* lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag):
* lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p):
* lisp/wid-edit.el (widget-field-value-set, string):
* lisp/x-dnd.el (x-dnd-version-from-flags)
(x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-21 00:27:53 +02:00
|
|
|
`erc-echo-notice-in-first-user-buffer'."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook
|
|
|
|
:options '(erc-echo-notice-in-default-buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
erc-echo-notice-in-target-buffer
|
|
|
|
erc-echo-notice-in-minibuffer
|
|
|
|
erc-echo-notice-in-server-buffer
|
|
|
|
erc-echo-notice-in-active-non-server-buffer
|
|
|
|
erc-echo-notice-in-active-buffer
|
|
|
|
erc-echo-notice-in-user-buffers
|
|
|
|
erc-echo-notice-in-user-and-target-buffers
|
|
|
|
erc-echo-notice-in-first-user-buffer))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; other tunable parameters
|
|
|
|
|
|
|
|
(defcustom erc-whowas-on-nosuchnick nil
|
2012-04-09 21:05:48 +08:00
|
|
|
"If non-nil, do a whowas on a nick if no such nick."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-verbose-server-ping nil
|
2012-04-09 21:05:48 +08:00
|
|
|
"If non-nil, show every time you get a PING or PONG from the server."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-paranoia
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-public-away-p nil
|
2012-04-09 21:05:48 +08:00
|
|
|
"Let others know you are back when you are no longer marked away.
|
2006-01-29 13:08:58 +00:00
|
|
|
This happens in this form:
|
|
|
|
* <nick> is back (gone for <time>)
|
|
|
|
|
|
|
|
Many consider it impolite to do so automatically."
|
|
|
|
:group 'erc
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-away-nickname nil
|
2012-04-09 21:05:48 +08:00
|
|
|
"The nickname to take when you are marked as being away."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc
|
|
|
|
:type '(choice (const nil)
|
2014-11-08 20:51:43 -05:00
|
|
|
string))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defcustom erc-paranoid nil
|
|
|
|
"If non-nil, then all incoming CTCP requests will be shown."
|
|
|
|
:group 'erc-paranoia
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-disable-ctcp-replies nil
|
|
|
|
"Disable replies to CTCP requests that require a reply.
|
|
|
|
If non-nil, then all incoming CTCP requests that normally require
|
|
|
|
an automatic reply (like VERSION or PING) will be ignored. Good to
|
|
|
|
set if some hacker is trying to flood you away."
|
|
|
|
:group 'erc-paranoia
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-anonymous-login t
|
|
|
|
"Be paranoid, don't give away your machine name."
|
|
|
|
:group 'erc-paranoia
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-prompt-for-channel-key nil
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
"Prompt for channel key when using `erc-join-channel' interactively."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-email-userid "user"
|
|
|
|
"Use this as your email user ID."
|
|
|
|
:group 'erc
|
|
|
|
:type 'string)
|
|
|
|
|
2007-01-17 18:17:25 +00:00
|
|
|
(defcustom erc-system-name nil
|
|
|
|
"Use this as the name of your system.
|
2021-09-14 08:43:18 +02:00
|
|
|
If nil, ERC will call function `system-name' to get this information."
|
2007-01-17 18:17:25 +00:00
|
|
|
:group 'erc
|
|
|
|
:type '(choice (const :tag "Default system name" nil)
|
2014-11-08 20:51:43 -05:00
|
|
|
string))
|
2007-01-17 18:17:25 +00:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defcustom erc-ignore-list nil
|
2012-04-09 21:05:48 +08:00
|
|
|
"List of regexps matching user identifiers to ignore.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
A user identifier has the form \"nick!login@host\". If an
|
|
|
|
identifier matches, the message from the person will not be
|
|
|
|
processed."
|
|
|
|
:group 'erc-ignore
|
|
|
|
:type '(repeat regexp))
|
|
|
|
(make-variable-buffer-local 'erc-ignore-list)
|
|
|
|
|
|
|
|
(defcustom erc-ignore-reply-list nil
|
2012-04-09 21:05:48 +08:00
|
|
|
"List of regexps matching user identifiers to ignore completely.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
This differs from `erc-ignore-list' in that it also ignores any
|
|
|
|
messages directed at the user.
|
|
|
|
|
|
|
|
A user identifier has the form \"nick!login@host\".
|
|
|
|
|
|
|
|
If an identifier matches, or a message is addressed to a nick
|
|
|
|
whose identifier matches, the message will not be processed.
|
|
|
|
|
|
|
|
CAVEAT: ERC doesn't know about the user and host of anyone who
|
|
|
|
was already in the channel when you joined, but never said
|
|
|
|
anything, so it won't be able to match the user and host of those
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
people. You can update the ERC internal info using /WHO *."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-ignore
|
|
|
|
:type '(repeat regexp))
|
|
|
|
|
|
|
|
(defvar erc-flood-protect t
|
2012-04-09 21:05:48 +08:00
|
|
|
"If non-nil, flood protection is enabled.
|
2006-01-29 13:08:58 +00:00
|
|
|
Flooding is sending too much information to the server in too
|
|
|
|
short of an interval, which may cause the server to terminate the
|
|
|
|
connection.
|
|
|
|
|
2023-04-17 00:01:15 -07:00
|
|
|
Note that older code conflated rate limiting and line splitting.
|
|
|
|
Starting in ERC 5.6, this option no longer influences the latter.
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
See `erc-server-flood-margin' for other flood-related parameters.")
|
|
|
|
|
|
|
|
;; Script parameters
|
|
|
|
|
|
|
|
(defcustom erc-startup-file-list
|
2021-11-09 07:51:18 +01:00
|
|
|
(list (locate-user-emacs-file ".ercrc.el")
|
|
|
|
(locate-user-emacs-file ".ercrc")
|
2014-11-08 20:51:43 -05:00
|
|
|
"~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc")
|
2006-01-29 13:08:58 +00:00
|
|
|
"List of files to try for a startup script.
|
|
|
|
The first existent and readable one will get executed.
|
|
|
|
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
If the filename ends with `.el' it is presumed to be an Emacs Lisp
|
2007-06-07 00:38:27 +00:00
|
|
|
script and it gets (load)ed. Otherwise it is treated as a bunch of
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
regular IRC commands."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-scripts
|
|
|
|
:type '(repeat file))
|
|
|
|
|
|
|
|
(defcustom erc-script-path nil
|
|
|
|
"List of directories to look for a script in /load command.
|
|
|
|
The script is first searched in the current directory, then in each
|
|
|
|
directory in the list."
|
|
|
|
:group 'erc-scripts
|
|
|
|
:type '(repeat directory))
|
|
|
|
|
|
|
|
(defcustom erc-script-echo t
|
2012-04-09 21:05:48 +08:00
|
|
|
"If non-nil, echo the IRC script commands locally."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-scripts
|
|
|
|
:type 'boolean)
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-last-saved-position nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"A marker containing the position the current buffer was last saved at.")
|
|
|
|
|
|
|
|
(defcustom erc-kill-buffer-on-part nil
|
|
|
|
"Kill the channel buffer on PART.
|
|
|
|
This variable should probably stay nil, as ERC can reuse buffers if
|
|
|
|
you rejoin them later."
|
|
|
|
:group 'erc-quit-and-part
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-kill-queries-on-quit nil
|
|
|
|
"Kill all query (also channel) buffers of this server on QUIT.
|
|
|
|
See the variable `erc-kill-buffer-on-part' for details."
|
|
|
|
:group 'erc-quit-and-part
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-kill-server-buffer-on-quit nil
|
|
|
|
"Kill the server buffer of the process on QUIT."
|
|
|
|
:group 'erc-quit-and-part
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-quit-reason-various-alist nil
|
|
|
|
"Alist of possible arguments to the /quit command.
|
|
|
|
|
|
|
|
Each element has the form:
|
|
|
|
(REGEXP RESULT)
|
|
|
|
|
|
|
|
If REGEXP matches the argument to /quit, then its relevant RESULT
|
|
|
|
will be used. RESULT may be either a string, or a function. If
|
|
|
|
a function, it should return the quit message as a string.
|
|
|
|
|
|
|
|
If no elements match, then the empty string is used.
|
|
|
|
|
|
|
|
As an example:
|
|
|
|
(setq erc-quit-reason-various-alist
|
2015-09-01 18:21:42 -07:00
|
|
|
\\='((\"xmms\" dme:now-playing)
|
2014-11-08 20:51:43 -05:00
|
|
|
(\"version\" erc-quit-reason-normal)
|
|
|
|
(\"home\" \"Gone home !\")
|
|
|
|
(\"^$\" \"Default Reason\")))
|
2013-05-21 00:15:59 -07:00
|
|
|
If the user types \"/quit home\", then \"Gone home !\" will be used
|
|
|
|
as the quit message."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-quit-and-part
|
|
|
|
:type '(repeat (list regexp (choice (string) (function)))))
|
|
|
|
|
|
|
|
(defcustom erc-part-reason-various-alist nil
|
|
|
|
"Alist of possible arguments to the /part command.
|
|
|
|
|
|
|
|
Each element has the form:
|
|
|
|
(REGEXP RESULT)
|
|
|
|
|
|
|
|
If REGEXP matches the argument to /part, then its relevant RESULT
|
|
|
|
will be used. RESULT may be either a string, or a function. If
|
|
|
|
a function, it should return the part message as a string.
|
|
|
|
|
|
|
|
If no elements match, then the empty string is used.
|
|
|
|
|
|
|
|
As an example:
|
|
|
|
(setq erc-part-reason-various-alist
|
2015-09-01 18:21:42 -07:00
|
|
|
\\='((\"xmms\" dme:now-playing)
|
2014-11-08 20:51:43 -05:00
|
|
|
(\"version\" erc-part-reason-normal)
|
|
|
|
(\"home\" \"Gone home !\")
|
|
|
|
(\"^$\" \"Default Reason\")))
|
2013-05-21 00:15:59 -07:00
|
|
|
If the user types \"/part home\", then \"Gone home !\" will be used
|
|
|
|
as the part message."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-quit-and-part
|
|
|
|
:type '(repeat (list regexp (choice (string) (function)))))
|
|
|
|
|
|
|
|
(defcustom erc-quit-reason 'erc-quit-reason-normal
|
2012-04-09 21:05:48 +08:00
|
|
|
"A function which returns the reason for quitting.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
The function is passed a single argument, the string typed by the
|
|
|
|
user after \"/quit\"."
|
|
|
|
:group 'erc-quit-and-part
|
|
|
|
:type '(choice (const erc-quit-reason-normal)
|
2014-11-08 20:51:43 -05:00
|
|
|
(const erc-quit-reason-various)
|
|
|
|
(symbol)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defcustom erc-part-reason 'erc-part-reason-normal
|
|
|
|
"A function which returns the reason for parting a channel.
|
|
|
|
|
|
|
|
The function is passed a single argument, the string typed by the
|
|
|
|
user after \"/PART\"."
|
|
|
|
:group 'erc-quit-and-part
|
|
|
|
:type '(choice (const erc-part-reason-normal)
|
2014-11-08 20:51:43 -05:00
|
|
|
(const erc-part-reason-various)
|
|
|
|
(symbol)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defvar erc-grab-buffer-name "*erc-grab*"
|
|
|
|
"The name of the buffer created by `erc-grab-region'.")
|
|
|
|
|
|
|
|
;; variables available for IRC scripts
|
|
|
|
|
|
|
|
(defvar erc-user-information "ERC User"
|
|
|
|
"USER_INFORMATION IRC variable.")
|
|
|
|
|
|
|
|
;; Hooks
|
|
|
|
|
|
|
|
(defgroup erc-hooks nil
|
Sequester some special-variable declarations in ERC
* lisp/erc/erc-backend.el (erc-log-p): Remove declaration entirely.
(erc-server-reconnect): Move declaration for `erc-reuse-buffers' here.
(erc-process-sentinel-1): Move `erc-kill-server-buffer-on-quit'
declaration here.
(erc--conceal-prompt): Move `erc-prompt-hidden' declaration here.
(erc-server-INVITE): Move `erc-invitation' declaration here.
(erc-server-PART): Move `erc-kill-buffer-on-part' declaration here.
(erc-server-PRIVMSG): Move declarations for `erc-minibuffer-ignored',
`erc-receive-query-display', `erc-receive-query-display-defer',
`erc--cmem-from-nick-function', `erc-format-nick-function', and
`erc-format-query-as-channel-p' here.
(erc-server-401): Move `erc-whowas-on-nosuchnick' declaration here.
(erc-server-475): Move `erc--called-as-input-p' and
`erc-prompt-for-channel-key' declarations here.
* lisp/erc/erc-common.el (erc-log-p): Remove declaration for
`erc-log-p' and replace with actual definition.
(erc-log-aux): Move `erc-dbuf' declaration from top level into
function body.
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Note in
the doc string that this function produces side effects.
* lisp/erc/erc-networks.el (erc-determine-network,
erc-networks--copy-server-buffer-functions): Move some variable
declarations to function body.
(erc-settings, erc-get): Deprecate for now and explain why in doc
strings. We could deprecate them unconditionally, but they never
provided usable code, and their names are short and valuable.
* lisp/erc/erc.el (tabbar--local-hlf, motif-version-string,
gtk-version-string): Prefer moving these single-serving declarations
to function bodies, if only to make closures from this library less
cluttered when debugging. This should also help avoid stray
declarations.
(erc-hooks, erc-timer-hook): Revise doc strings.
(erc-log-p): Move definition to erc-common.el.
(erc-cmd-SV): Mimic `emacs-version' and stick with `featurep', here in
combination with special-variable declarations, instead of `boundp' or
similar.
(erc-header-line-uses-tabbar-p): Explain that this has nothing to do
with `tab-bar'.
(erc-update-mode-line-buffer): Only assign when bound. This has been
verified to work with version 2.0 on EmacsWiki.
* test/lisp/erc/erc-scenarios-base-reconnect.el: Timeouts.
* test/lisp/erc/erc-scenarios-base-renick.el: Timeouts.
* test/lisp/erc/resources/join/network-id/foonet-again.eld: Timeouts.
2023-11-26 18:24:48 -08:00
|
|
|
"Hooks for ERC.
|
|
|
|
Users of the interactive client should be aware that many of
|
|
|
|
these hooks have names predating the modern convention of
|
|
|
|
conveying abnormality via the \"-function\" suffix. Users should
|
|
|
|
likewise be aware that built-in and third-party modules use these
|
|
|
|
hooks as well, and some of their variables may be buffer-local in
|
|
|
|
particular sessions and/or `let'-bound for spells."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc)
|
|
|
|
|
|
|
|
(defcustom erc-mode-hook nil
|
|
|
|
"Hook run after `erc-mode' setup is finished."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook
|
|
|
|
:options '(erc-add-scroll-to-bottom))
|
|
|
|
|
|
|
|
(defcustom erc-timer-hook nil
|
Sequester some special-variable declarations in ERC
* lisp/erc/erc-backend.el (erc-log-p): Remove declaration entirely.
(erc-server-reconnect): Move declaration for `erc-reuse-buffers' here.
(erc-process-sentinel-1): Move `erc-kill-server-buffer-on-quit'
declaration here.
(erc--conceal-prompt): Move `erc-prompt-hidden' declaration here.
(erc-server-INVITE): Move `erc-invitation' declaration here.
(erc-server-PART): Move `erc-kill-buffer-on-part' declaration here.
(erc-server-PRIVMSG): Move declarations for `erc-minibuffer-ignored',
`erc-receive-query-display', `erc-receive-query-display-defer',
`erc--cmem-from-nick-function', `erc-format-nick-function', and
`erc-format-query-as-channel-p' here.
(erc-server-401): Move `erc-whowas-on-nosuchnick' declaration here.
(erc-server-475): Move `erc--called-as-input-p' and
`erc-prompt-for-channel-key' declarations here.
* lisp/erc/erc-common.el (erc-log-p): Remove declaration for
`erc-log-p' and replace with actual definition.
(erc-log-aux): Move `erc-dbuf' declaration from top level into
function body.
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Note in
the doc string that this function produces side effects.
* lisp/erc/erc-networks.el (erc-determine-network,
erc-networks--copy-server-buffer-functions): Move some variable
declarations to function body.
(erc-settings, erc-get): Deprecate for now and explain why in doc
strings. We could deprecate them unconditionally, but they never
provided usable code, and their names are short and valuable.
* lisp/erc/erc.el (tabbar--local-hlf, motif-version-string,
gtk-version-string): Prefer moving these single-serving declarations
to function bodies, if only to make closures from this library less
cluttered when debugging. This should also help avoid stray
declarations.
(erc-hooks, erc-timer-hook): Revise doc strings.
(erc-log-p): Move definition to erc-common.el.
(erc-cmd-SV): Mimic `emacs-version' and stick with `featurep', here in
combination with special-variable declarations, instead of `boundp' or
similar.
(erc-header-line-uses-tabbar-p): Explain that this has nothing to do
with `tab-bar'.
(erc-update-mode-line-buffer): Only assign when bound. This has been
verified to work with version 2.0 on EmacsWiki.
* test/lisp/erc/erc-scenarios-base-reconnect.el: Timeouts.
* test/lisp/erc/erc-scenarios-base-renick.el: Timeouts.
* test/lisp/erc/resources/join/network-id/foonet-again.eld: Timeouts.
2023-11-26 18:24:48 -08:00
|
|
|
"Abnormal hook run after each response handler.
|
|
|
|
Called with a float returned from `erc-current-time'."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom erc-insert-pre-hook nil
|
|
|
|
"Hook called first when some text is inserted through `erc-display-line'.
|
|
|
|
It gets called with one argument, STRING.
|
|
|
|
To be able to modify the inserted text, use `erc-insert-modify-hook' instead.
|
|
|
|
Filtering functions can set `erc-insert-this' to nil to avoid
|
|
|
|
display of that particular string at all."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom erc-send-pre-hook nil
|
|
|
|
"Hook called first when some text is sent through `erc-send-current-line'.
|
|
|
|
It gets called with one argument, STRING.
|
|
|
|
|
2014-11-04 15:07:59 -05:00
|
|
|
To change the text that will be sent, set the variable `str' which is
|
2006-01-29 13:08:58 +00:00
|
|
|
used in `erc-send-current-line'.
|
|
|
|
|
|
|
|
To change the text inserted into the buffer without changing the text
|
|
|
|
that will be sent, use `erc-send-modify-hook' instead.
|
|
|
|
|
|
|
|
Filtering functions can set `erc-send-this' to nil to avoid sending of
|
|
|
|
that particular string at all and `erc-insert-this' to prevent
|
|
|
|
inserting that particular string into the buffer.
|
|
|
|
|
|
|
|
Note that it's useless to set `erc-send-this' to nil and
|
|
|
|
`erc-insert-this' to t. ERC is sane enough to not insert the text
|
|
|
|
anyway."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
2019-06-14 14:56:04 +02:00
|
|
|
(make-obsolete-variable 'erc-send-pre-hook 'erc-pre-send-functions "27.1")
|
2019-06-14 14:05:24 +02:00
|
|
|
|
2019-06-14 14:56:04 +02:00
|
|
|
(defcustom erc-pre-send-functions nil
|
2021-01-04 00:21:02 -05:00
|
|
|
"Special hook run to possibly alter the string that is sent.
|
|
|
|
The functions are called with one argument, an `erc-input' struct,
|
2019-06-19 17:07:36 +02:00
|
|
|
and should alter that struct.
|
2019-06-14 14:05:24 +02:00
|
|
|
|
2019-06-19 17:07:36 +02:00
|
|
|
The struct has three slots:
|
|
|
|
|
|
|
|
`string': The current input string.
|
|
|
|
`insertp': Whether the string should be inserted into the erc buffer.
|
2023-04-30 07:12:56 -07:00
|
|
|
`sendp': Whether the string should be sent to the irc server.
|
2023-12-01 13:54:12 -08:00
|
|
|
|
|
|
|
And one \"phony\" slot only accessible by hook members at runtime:
|
|
|
|
|
2023-04-30 07:12:56 -07:00
|
|
|
`refoldp': Whether the string should be re-split per protocol limits.
|
|
|
|
|
|
|
|
This hook runs after protocol line splitting has taken place, so
|
|
|
|
the value of `string' is originally \"pre-filled\". If you need
|
2023-12-01 13:54:12 -08:00
|
|
|
ERC to refill the entire payload before sending it, set the phony
|
|
|
|
`refoldp' slot to a non-nil value. Note that this refilling is
|
|
|
|
only a convenience, and modules with special needs, such as
|
|
|
|
preserving \"preformatted\" text or encoding for subprotocol
|
|
|
|
\"tunneling\", should handle splitting manually."
|
2019-06-14 14:05:24 +02:00
|
|
|
:group 'erc
|
2021-01-04 00:21:02 -05:00
|
|
|
:type 'hook
|
2019-06-14 14:05:24 +02:00
|
|
|
:version "27.1")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-04-30 07:12:56 -07:00
|
|
|
(define-obsolete-variable-alias 'erc--pre-send-split-functions
|
|
|
|
'erc--input-review-functions "30.1")
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
(defvar erc--input-review-functions '(erc--split-lines
|
|
|
|
erc--run-input-validation-checks
|
2023-06-09 21:00:03 -07:00
|
|
|
erc--discard-trailing-multiline-nulls
|
|
|
|
erc--inhibit-slash-cmd-insertion)
|
2023-04-30 07:12:56 -07:00
|
|
|
"Special hook for reviewing and modifying prompt input.
|
|
|
|
ERC runs this before clearing the prompt and before running any
|
|
|
|
send-related hooks, such as `erc-pre-send-functions'. Thus, it's
|
|
|
|
quite \"safe\" to bail out of this hook with a `user-error', if
|
|
|
|
necessary. The hook's members are called with one argument, an
|
|
|
|
`erc--input-split' struct, which they can optionally modify.
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
|
|
|
|
The struct has five slots:
|
|
|
|
|
2023-04-30 07:12:56 -07:00
|
|
|
`string': the original input as a read-only reference
|
|
|
|
`insertp': same as in `erc-pre-send-functions'
|
|
|
|
`sendp': same as in `erc-pre-send-functions'
|
|
|
|
`refoldp': same as in `erc-pre-send-functions'
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
`lines': a list of lines to be sent, each one a `string'
|
|
|
|
`cmdp': whether to interpret input as a command, like /ignore
|
|
|
|
|
2023-04-30 07:12:56 -07:00
|
|
|
When `cmdp' is non-nil, all but the first line will be discarded.")
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defvar erc-insert-this t
|
|
|
|
"Insert the text into the target buffer or not.
|
|
|
|
Functions on `erc-insert-pre-hook' can set this variable to nil
|
|
|
|
if they wish to avoid insertion of a particular string.")
|
|
|
|
|
|
|
|
(defvar erc-send-this t
|
|
|
|
"Send the text to the target or not.
|
|
|
|
Functions on `erc-send-pre-hook' can set this variable to nil
|
|
|
|
if they wish to avoid sending of a particular string.")
|
2019-06-19 17:07:36 +02:00
|
|
|
(make-obsolete-variable 'erc-send-this 'erc-pre-send-functions "27.1")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defcustom erc-insert-modify-hook ()
|
|
|
|
"Insertion hook for functions that will change the text's appearance.
|
|
|
|
This hook is called just after `erc-insert-pre-hook' when the value
|
|
|
|
of `erc-insert-this' is t.
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
|
|
|
|
ERC runs this hook with the buffer narrowed to the bounds of the
|
|
|
|
inserted message plus a trailing newline. Built-in modules place
|
|
|
|
their hook members at depths between 20 and 80, with those from
|
|
|
|
the stamp module always running last. Use the functions
|
|
|
|
`erc-find-parsed-property' and `erc-get-parsed-vector' to locate
|
|
|
|
and extract the `erc-response' object for the inserted message."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom erc-insert-post-hook nil
|
|
|
|
"This hook is called just after `erc-insert-modify-hook'.
|
|
|
|
At this point, all modifications from prior hook functions are done."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook
|
|
|
|
:options '(erc-truncate-buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
erc-make-read-only
|
|
|
|
erc-save-buffer-in-logs))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2019-10-23 11:55:13 +02:00
|
|
|
(defcustom erc-insert-done-hook nil
|
|
|
|
"This hook is called after inserting strings into the buffer.
|
|
|
|
This hook is not called from inside `save-excursion' and should
|
|
|
|
preserve point if needed."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:version "27.1"
|
|
|
|
:type 'hook)
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defcustom erc-send-modify-hook nil
|
|
|
|
"Sending hook for functions that will change the text's appearance.
|
2023-04-30 07:12:56 -07:00
|
|
|
ERC runs this just after `erc-pre-send-functions' if its shared
|
|
|
|
`erc-input' object's `sendp' and `insertp' slots remain non-nil.
|
2006-01-29 13:08:58 +00:00
|
|
|
While this hook is run, narrowing is in effect and `current-buffer' is
|
|
|
|
the buffer where the text got inserted.
|
|
|
|
|
|
|
|
Note that no function in this hook can change the appearance of the
|
|
|
|
text that is sent. Only changing the sent text's appearance on the
|
|
|
|
sending user's screen is possible. One possible value to add here
|
|
|
|
is `erc-fill'."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defcustom erc-send-post-hook nil
|
|
|
|
"This hook is called just after `erc-send-modify-hook'.
|
|
|
|
At this point, all modifications from prior hook functions are done.
|
|
|
|
NOTE: The functions on this hook are called _before_ sending a command
|
|
|
|
to the server.
|
|
|
|
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
This function is called with narrowing, ala `erc-send-modify-hook'."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook
|
|
|
|
:options '(erc-make-read-only))
|
|
|
|
|
|
|
|
(defcustom erc-send-completed-hook
|
2013-08-22 00:06:45 -04:00
|
|
|
(when (fboundp 'emacspeak-auditory-icon)
|
2006-01-29 13:08:58 +00:00
|
|
|
(list (byte-compile
|
2014-11-08 20:51:43 -05:00
|
|
|
(lambda (_str)
|
|
|
|
(emacspeak-auditory-icon 'select-object)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
"Hook called after a message has been parsed by ERC.
|
|
|
|
|
|
|
|
The single argument to the functions is the unmodified string
|
|
|
|
which the local user typed."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
;; mode-specific tables
|
|
|
|
|
|
|
|
(defvar erc-mode-syntax-table
|
|
|
|
(let ((syntax-table (make-syntax-table)))
|
|
|
|
(modify-syntax-entry ?\" ". " syntax-table)
|
|
|
|
(modify-syntax-entry ?\\ ". " syntax-table)
|
|
|
|
(modify-syntax-entry ?' "w " syntax-table)
|
|
|
|
;; Make dabbrev-expand useful for nick names
|
|
|
|
(modify-syntax-entry ?< "." syntax-table)
|
|
|
|
(modify-syntax-entry ?> "." syntax-table)
|
|
|
|
syntax-table)
|
|
|
|
"Syntax table used while in ERC mode.")
|
|
|
|
|
|
|
|
(defvar erc-mode-abbrev-table nil
|
|
|
|
"Abbrev table used while in ERC mode.")
|
|
|
|
(define-abbrev-table 'erc-mode-abbrev-table ())
|
|
|
|
|
|
|
|
(defvar erc-mode-map
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2021-03-18 23:14:33 -04:00
|
|
|
(define-key map "\C-m" #'erc-send-current-line)
|
|
|
|
(define-key map "\C-a" #'erc-bol)
|
|
|
|
(define-key map [home] #'erc-bol)
|
|
|
|
(define-key map "\C-c\C-a" #'erc-bol)
|
|
|
|
(define-key map "\C-c\C-b" #'erc-switch-to-buffer)
|
|
|
|
(define-key map "\C-c\C-d" #'erc-input-action)
|
|
|
|
(define-key map "\C-c\C-e" #'erc-toggle-ctcp-autoresponse)
|
|
|
|
(define-key map "\C-c\C-f" #'erc-toggle-flood-control)
|
|
|
|
(define-key map "\C-c\C-i" #'erc-invite-only-mode)
|
|
|
|
(define-key map "\C-c\C-j" #'erc-join-channel)
|
|
|
|
(define-key map "\C-c\C-n" #'erc-channel-names)
|
|
|
|
(define-key map "\C-c\C-o" #'erc-get-channel-mode-from-keypress)
|
|
|
|
(define-key map "\C-c\C-p" #'erc-part-from-channel)
|
|
|
|
(define-key map "\C-c\C-q" #'erc-quit-server)
|
|
|
|
(define-key map "\C-c\C-r" #'erc-remove-text-properties-region)
|
|
|
|
(define-key map "\C-c\C-t" #'erc-set-topic)
|
|
|
|
(define-key map "\C-c\C-u" #'erc-kill-input)
|
|
|
|
(define-key map "\C-c\C-x" #'erc-quit-server)
|
|
|
|
(define-key map "\M-\t" #'ispell-complete-word)
|
2023-04-10 17:58:05 -07:00
|
|
|
(define-key map "\t" #'erc-tab)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; Suppress `font-lock-fontify-block' key binding since it
|
|
|
|
;; destroys face properties.
|
2021-03-18 23:14:33 -04:00
|
|
|
(define-key map [remap font-lock-fontify-block] #'undefined)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
map)
|
|
|
|
"ERC keymap.")
|
|
|
|
|
2023-01-19 21:07:27 -08:00
|
|
|
(defun erc--modify-local-map (mode &rest bindings)
|
|
|
|
"Modify `erc-mode-map' on behalf of a global module.
|
|
|
|
Add or remove `key-valid-p' BINDINGS when toggling MODE."
|
|
|
|
(declare (indent 1))
|
|
|
|
(while (pcase-let* ((`(,key ,def . ,rest) bindings)
|
|
|
|
(existing (keymap-lookup erc-mode-map key)))
|
|
|
|
(if mode
|
|
|
|
(when (or (not existing) (eq existing #'undefined))
|
|
|
|
(keymap-set erc-mode-map key def))
|
|
|
|
(when (eq existing def)
|
|
|
|
(keymap-unset erc-mode-map key t)))
|
|
|
|
(setq bindings rest))))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
;; Faces
|
|
|
|
|
|
|
|
; Honestly, I have a horrible sense of color and the "defaults" below
|
|
|
|
; are supposed to be really bad. But colors ARE required in IRC to
|
|
|
|
; convey different parts of conversation. If you think you know better
|
|
|
|
; defaults - send them to me.
|
|
|
|
|
|
|
|
;; Now colors are a bit nicer, at least to my eyes.
|
|
|
|
;; You may still want to change them to better fit your background.-- S.B.
|
|
|
|
|
|
|
|
(defgroup erc-faces nil
|
|
|
|
"Faces for ERC."
|
|
|
|
:group 'erc)
|
|
|
|
|
2015-02-13 13:19:20 -05:00
|
|
|
;; FIXME faces should not end in "-face".
|
2006-01-29 13:08:58 +00:00
|
|
|
(defface erc-default-face '((t))
|
|
|
|
"ERC default face."
|
|
|
|
:group 'erc-faces)
|
|
|
|
|
2014-11-08 20:51:43 -05:00
|
|
|
(defface erc-nick-prefix-face '((t :inherit erc-nick-default-face :weight bold))
|
|
|
|
"ERC face used for user mode prefix."
|
|
|
|
:group 'erc-faces)
|
|
|
|
|
|
|
|
(defface erc-my-nick-prefix-face '((t :inherit erc-nick-default-face :weight bold))
|
|
|
|
"ERC face used for my user mode prefix."
|
|
|
|
:group 'erc-faces)
|
|
|
|
|
Face cleanups. Remove some uses of old-style face spec and :bold/:italic.
* faces.el (set-face-attribute): Doc fix.
(modify-face): Don't use :bold and :italic.
(error, warning, success): Tweak definitions.
* cus-edit.el (custom-modified, custom-invalid, custom-rogue)
(custom-modified, custom-set, custom-changed, custom-themed)
(custom-saved, custom-button, custom-button-mouse)
(custom-button-pressed, custom-state, custom-comment-tag)
(custom-variable-tag, custom-group-tag-1, custom-group-tag)
(custom-group-subtitle): Use new-style face specs.
(custom-invalid-face, custom-rogue-face, custom-modified-face)
(custom-set-face, custom-changed-face, custom-saved-face)
(custom-button-face, custom-button-pressed-face)
(custom-documentation-face, custom-state-face)
(custom-comment-face, custom-comment-tag-face)
(custom-variable-tag-face, custom-variable-button-face)
(custom-face-tag-face, custom-group-tag-face-1)
(custom-group-tag-face): Remove obsolete face alias.
* epa.el (epa-validity-high, epa-validity-medium)
(epa-validity-low, epa-mark, epa-field-name, epa-string)
(epa-field-name, epa-field-body):
* font-lock.el (font-lock-comment-face, font-lock-string-face)
(font-lock-keyword-face, font-lock-builtin-face)
(font-lock-function-name-face, font-lock-variable-name-face)
(font-lock-type-face, font-lock-constant-face):
* ido.el (ido-first-match, ido-only-match, ido-subdir)
(ido-virtual, ido-indicator, ido-incomplete-regexp):
* speedbar.el (speedbar-button-face, speedbar-file-face)
(speedbar-directory-face, speedbar-tag-face)
(speedbar-selected-face, speedbar-highlight-face)
(speedbar-separator-face):
* whitespace.el (whitespace-newline, whitespace-space)
(whitespace-hspace, whitespace-tab, whitespace-trailing)
(whitespace-line, whitespace-space-before-tab)
(whitespace-space-after-tab, whitespace-indentation)
(whitespace-empty):
* emulation/cua-base.el (cua-global-mark):
* eshell/em-prompt.el (eshell-prompt):
* net/newst-plainview.el (newsticker-new-item-face)
(newsticker-old-item-face, newsticker-immortal-item-face)
(newsticker-obsolete-item-face, newsticker-date-face)
(newsticker-statistics-face, newsticker-default-face):
* net/newst-reader.el (newsticker-feed-face)
(newsticker-extra-face, newsticker-enclosure-face):
* net/newst-treeview.el (newsticker-treeview-face)
(newsticker-treeview-new-face, newsticker-treeview-old-face)
(newsticker-treeview-immortal-face)
(newsticker-treeview-obsolete-face)
(newsticker-treeview-selection-face):
* net/rcirc.el (rcirc-my-nick, rcirc-other-nick)
(rcirc-bright-nick, rcirc-server, rcirc-timestamp)
(rcirc-nick-in-message, rcirc-nick-in-message-full-line)
(rcirc-prompt, rcirc-track-keyword, rcirc-url, rcirc-keyword):
* nxml/nxml-outln.el (nxml-heading, nxml-outline-indicator)
(nxml-outline-active-indicator, nxml-outline-ellipsis):
* play/mpuz.el (mpuz-unsolved, mpuz-solved, mpuz-trivial)
(mpuz-text):
* progmodes/vera-mode.el (vera-font-lock-number)
(vera-font-lock-function, vera-font-lock-interface):
* textmodes/table.el (table-cell): Use new-style face specs, and
don't use the old :bold and :italic attributes.
* erc-button.el (erc-button):
* erc-goodies.el (erc-bold-face, erc-inverse-face)
(erc-underline-face, fg:erc-color-*):
* erc-match.el (erc-current-nick-face, erc-dangerous-host-face)
(erc-pal-face, erc-fool-face, erc-keyword-face):
* erc-stamp.el (erc-timestamp-face): Likewise.
* erc.el (erc-direct-msg-face, erc-header-line, erc-input-face)
(erc-command-indicator-face, erc-notice-face, erc-action-face)
(erc-error-face, erc-my-nick-face, erc-nick-default-face)
(erc-nick-msg-face): Use new-style face specs, and avoid :bold.
* progmodes/ebrowse.el (ebrowse-tree-mark, ebrowse-root-class)
(ebrowse-member-attribute, ebrowse-default, ebrowse-file-name)
(ebrowse-member-class, ebrowse-progress): Likewise.
(ebrowse-tree-mark-face, ebrowse-root-class-face)
(ebrowse-file-name-face, ebrowse-default-face)
(ebrowse-member-attribute-face, ebrowse-member-class-face)
(ebrowse-progress-face): Remove obsolete faces.
* progmodes/flymake.el (flymake-errline, flymake-warnline):
Inherit from error and warning faces respectively.
* textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate):
Likewise.
(flyspell-incorrect-face, flyspell-duplicate-face): Remove
obsolete aliases.
* display.texi (Face Attributes): Font family does not accept
wildcards. De-document obsolete :bold and :italic attributes.
(Defining Faces): Use new-style face spec format.
2012-06-09 00:39:49 +08:00
|
|
|
(defface erc-direct-msg-face '((t :foreground "IndianRed"))
|
2006-01-29 13:08:58 +00:00
|
|
|
"ERC face used for messages you receive in the main erc buffer."
|
|
|
|
:group 'erc-faces)
|
|
|
|
|
2006-03-27 11:27:46 +00:00
|
|
|
(defface erc-header-line
|
2020-07-29 06:54:05 +02:00
|
|
|
'((t :inherit header-line))
|
2006-03-27 11:27:46 +00:00
|
|
|
"ERC face used for the header line.
|
|
|
|
|
|
|
|
This will only be used if `erc-header-line-face-method' is non-nil."
|
|
|
|
:group 'erc-faces)
|
|
|
|
|
Face cleanups. Remove some uses of old-style face spec and :bold/:italic.
* faces.el (set-face-attribute): Doc fix.
(modify-face): Don't use :bold and :italic.
(error, warning, success): Tweak definitions.
* cus-edit.el (custom-modified, custom-invalid, custom-rogue)
(custom-modified, custom-set, custom-changed, custom-themed)
(custom-saved, custom-button, custom-button-mouse)
(custom-button-pressed, custom-state, custom-comment-tag)
(custom-variable-tag, custom-group-tag-1, custom-group-tag)
(custom-group-subtitle): Use new-style face specs.
(custom-invalid-face, custom-rogue-face, custom-modified-face)
(custom-set-face, custom-changed-face, custom-saved-face)
(custom-button-face, custom-button-pressed-face)
(custom-documentation-face, custom-state-face)
(custom-comment-face, custom-comment-tag-face)
(custom-variable-tag-face, custom-variable-button-face)
(custom-face-tag-face, custom-group-tag-face-1)
(custom-group-tag-face): Remove obsolete face alias.
* epa.el (epa-validity-high, epa-validity-medium)
(epa-validity-low, epa-mark, epa-field-name, epa-string)
(epa-field-name, epa-field-body):
* font-lock.el (font-lock-comment-face, font-lock-string-face)
(font-lock-keyword-face, font-lock-builtin-face)
(font-lock-function-name-face, font-lock-variable-name-face)
(font-lock-type-face, font-lock-constant-face):
* ido.el (ido-first-match, ido-only-match, ido-subdir)
(ido-virtual, ido-indicator, ido-incomplete-regexp):
* speedbar.el (speedbar-button-face, speedbar-file-face)
(speedbar-directory-face, speedbar-tag-face)
(speedbar-selected-face, speedbar-highlight-face)
(speedbar-separator-face):
* whitespace.el (whitespace-newline, whitespace-space)
(whitespace-hspace, whitespace-tab, whitespace-trailing)
(whitespace-line, whitespace-space-before-tab)
(whitespace-space-after-tab, whitespace-indentation)
(whitespace-empty):
* emulation/cua-base.el (cua-global-mark):
* eshell/em-prompt.el (eshell-prompt):
* net/newst-plainview.el (newsticker-new-item-face)
(newsticker-old-item-face, newsticker-immortal-item-face)
(newsticker-obsolete-item-face, newsticker-date-face)
(newsticker-statistics-face, newsticker-default-face):
* net/newst-reader.el (newsticker-feed-face)
(newsticker-extra-face, newsticker-enclosure-face):
* net/newst-treeview.el (newsticker-treeview-face)
(newsticker-treeview-new-face, newsticker-treeview-old-face)
(newsticker-treeview-immortal-face)
(newsticker-treeview-obsolete-face)
(newsticker-treeview-selection-face):
* net/rcirc.el (rcirc-my-nick, rcirc-other-nick)
(rcirc-bright-nick, rcirc-server, rcirc-timestamp)
(rcirc-nick-in-message, rcirc-nick-in-message-full-line)
(rcirc-prompt, rcirc-track-keyword, rcirc-url, rcirc-keyword):
* nxml/nxml-outln.el (nxml-heading, nxml-outline-indicator)
(nxml-outline-active-indicator, nxml-outline-ellipsis):
* play/mpuz.el (mpuz-unsolved, mpuz-solved, mpuz-trivial)
(mpuz-text):
* progmodes/vera-mode.el (vera-font-lock-number)
(vera-font-lock-function, vera-font-lock-interface):
* textmodes/table.el (table-cell): Use new-style face specs, and
don't use the old :bold and :italic attributes.
* erc-button.el (erc-button):
* erc-goodies.el (erc-bold-face, erc-inverse-face)
(erc-underline-face, fg:erc-color-*):
* erc-match.el (erc-current-nick-face, erc-dangerous-host-face)
(erc-pal-face, erc-fool-face, erc-keyword-face):
* erc-stamp.el (erc-timestamp-face): Likewise.
* erc.el (erc-direct-msg-face, erc-header-line, erc-input-face)
(erc-command-indicator-face, erc-notice-face, erc-action-face)
(erc-error-face, erc-my-nick-face, erc-nick-default-face)
(erc-nick-msg-face): Use new-style face specs, and avoid :bold.
* progmodes/ebrowse.el (ebrowse-tree-mark, ebrowse-root-class)
(ebrowse-member-attribute, ebrowse-default, ebrowse-file-name)
(ebrowse-member-class, ebrowse-progress): Likewise.
(ebrowse-tree-mark-face, ebrowse-root-class-face)
(ebrowse-file-name-face, ebrowse-default-face)
(ebrowse-member-attribute-face, ebrowse-member-class-face)
(ebrowse-progress-face): Remove obsolete faces.
* progmodes/flymake.el (flymake-errline, flymake-warnline):
Inherit from error and warning faces respectively.
* textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate):
Likewise.
(flyspell-incorrect-face, flyspell-duplicate-face): Remove
obsolete aliases.
* display.texi (Face Attributes): Font family does not accept
wildcards. De-document obsolete :bold and :italic attributes.
(Defining Faces): Use new-style face spec format.
2012-06-09 00:39:49 +08:00
|
|
|
(defface erc-input-face '((t :foreground "brown"))
|
2006-01-29 13:08:58 +00:00
|
|
|
"ERC face used for your input."
|
|
|
|
:group 'erc-faces)
|
|
|
|
|
|
|
|
(defface erc-prompt-face
|
Face cleanups. Remove some uses of old-style face spec and :bold/:italic.
* faces.el (set-face-attribute): Doc fix.
(modify-face): Don't use :bold and :italic.
(error, warning, success): Tweak definitions.
* cus-edit.el (custom-modified, custom-invalid, custom-rogue)
(custom-modified, custom-set, custom-changed, custom-themed)
(custom-saved, custom-button, custom-button-mouse)
(custom-button-pressed, custom-state, custom-comment-tag)
(custom-variable-tag, custom-group-tag-1, custom-group-tag)
(custom-group-subtitle): Use new-style face specs.
(custom-invalid-face, custom-rogue-face, custom-modified-face)
(custom-set-face, custom-changed-face, custom-saved-face)
(custom-button-face, custom-button-pressed-face)
(custom-documentation-face, custom-state-face)
(custom-comment-face, custom-comment-tag-face)
(custom-variable-tag-face, custom-variable-button-face)
(custom-face-tag-face, custom-group-tag-face-1)
(custom-group-tag-face): Remove obsolete face alias.
* epa.el (epa-validity-high, epa-validity-medium)
(epa-validity-low, epa-mark, epa-field-name, epa-string)
(epa-field-name, epa-field-body):
* font-lock.el (font-lock-comment-face, font-lock-string-face)
(font-lock-keyword-face, font-lock-builtin-face)
(font-lock-function-name-face, font-lock-variable-name-face)
(font-lock-type-face, font-lock-constant-face):
* ido.el (ido-first-match, ido-only-match, ido-subdir)
(ido-virtual, ido-indicator, ido-incomplete-regexp):
* speedbar.el (speedbar-button-face, speedbar-file-face)
(speedbar-directory-face, speedbar-tag-face)
(speedbar-selected-face, speedbar-highlight-face)
(speedbar-separator-face):
* whitespace.el (whitespace-newline, whitespace-space)
(whitespace-hspace, whitespace-tab, whitespace-trailing)
(whitespace-line, whitespace-space-before-tab)
(whitespace-space-after-tab, whitespace-indentation)
(whitespace-empty):
* emulation/cua-base.el (cua-global-mark):
* eshell/em-prompt.el (eshell-prompt):
* net/newst-plainview.el (newsticker-new-item-face)
(newsticker-old-item-face, newsticker-immortal-item-face)
(newsticker-obsolete-item-face, newsticker-date-face)
(newsticker-statistics-face, newsticker-default-face):
* net/newst-reader.el (newsticker-feed-face)
(newsticker-extra-face, newsticker-enclosure-face):
* net/newst-treeview.el (newsticker-treeview-face)
(newsticker-treeview-new-face, newsticker-treeview-old-face)
(newsticker-treeview-immortal-face)
(newsticker-treeview-obsolete-face)
(newsticker-treeview-selection-face):
* net/rcirc.el (rcirc-my-nick, rcirc-other-nick)
(rcirc-bright-nick, rcirc-server, rcirc-timestamp)
(rcirc-nick-in-message, rcirc-nick-in-message-full-line)
(rcirc-prompt, rcirc-track-keyword, rcirc-url, rcirc-keyword):
* nxml/nxml-outln.el (nxml-heading, nxml-outline-indicator)
(nxml-outline-active-indicator, nxml-outline-ellipsis):
* play/mpuz.el (mpuz-unsolved, mpuz-solved, mpuz-trivial)
(mpuz-text):
* progmodes/vera-mode.el (vera-font-lock-number)
(vera-font-lock-function, vera-font-lock-interface):
* textmodes/table.el (table-cell): Use new-style face specs, and
don't use the old :bold and :italic attributes.
* erc-button.el (erc-button):
* erc-goodies.el (erc-bold-face, erc-inverse-face)
(erc-underline-face, fg:erc-color-*):
* erc-match.el (erc-current-nick-face, erc-dangerous-host-face)
(erc-pal-face, erc-fool-face, erc-keyword-face):
* erc-stamp.el (erc-timestamp-face): Likewise.
* erc.el (erc-direct-msg-face, erc-header-line, erc-input-face)
(erc-command-indicator-face, erc-notice-face, erc-action-face)
(erc-error-face, erc-my-nick-face, erc-nick-default-face)
(erc-nick-msg-face): Use new-style face specs, and avoid :bold.
* progmodes/ebrowse.el (ebrowse-tree-mark, ebrowse-root-class)
(ebrowse-member-attribute, ebrowse-default, ebrowse-file-name)
(ebrowse-member-class, ebrowse-progress): Likewise.
(ebrowse-tree-mark-face, ebrowse-root-class-face)
(ebrowse-file-name-face, ebrowse-default-face)
(ebrowse-member-attribute-face, ebrowse-member-class-face)
(ebrowse-progress-face): Remove obsolete faces.
* progmodes/flymake.el (flymake-errline, flymake-warnline):
Inherit from error and warning faces respectively.
* textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate):
Likewise.
(flyspell-incorrect-face, flyspell-duplicate-face): Remove
obsolete aliases.
* display.texi (Face Attributes): Font family does not accept
wildcards. De-document obsolete :bold and :italic attributes.
(Defining Faces): Use new-style face spec format.
2012-06-09 00:39:49 +08:00
|
|
|
'((t :weight bold :foreground "Black" :background "lightBlue2"))
|
2006-01-29 13:08:58 +00:00
|
|
|
"ERC face for the prompt."
|
|
|
|
:group 'erc-faces)
|
|
|
|
|
2008-01-25 03:28:10 +00:00
|
|
|
(defface erc-notice-face
|
Face cleanups. Remove some uses of old-style face spec and :bold/:italic.
* faces.el (set-face-attribute): Doc fix.
(modify-face): Don't use :bold and :italic.
(error, warning, success): Tweak definitions.
* cus-edit.el (custom-modified, custom-invalid, custom-rogue)
(custom-modified, custom-set, custom-changed, custom-themed)
(custom-saved, custom-button, custom-button-mouse)
(custom-button-pressed, custom-state, custom-comment-tag)
(custom-variable-tag, custom-group-tag-1, custom-group-tag)
(custom-group-subtitle): Use new-style face specs.
(custom-invalid-face, custom-rogue-face, custom-modified-face)
(custom-set-face, custom-changed-face, custom-saved-face)
(custom-button-face, custom-button-pressed-face)
(custom-documentation-face, custom-state-face)
(custom-comment-face, custom-comment-tag-face)
(custom-variable-tag-face, custom-variable-button-face)
(custom-face-tag-face, custom-group-tag-face-1)
(custom-group-tag-face): Remove obsolete face alias.
* epa.el (epa-validity-high, epa-validity-medium)
(epa-validity-low, epa-mark, epa-field-name, epa-string)
(epa-field-name, epa-field-body):
* font-lock.el (font-lock-comment-face, font-lock-string-face)
(font-lock-keyword-face, font-lock-builtin-face)
(font-lock-function-name-face, font-lock-variable-name-face)
(font-lock-type-face, font-lock-constant-face):
* ido.el (ido-first-match, ido-only-match, ido-subdir)
(ido-virtual, ido-indicator, ido-incomplete-regexp):
* speedbar.el (speedbar-button-face, speedbar-file-face)
(speedbar-directory-face, speedbar-tag-face)
(speedbar-selected-face, speedbar-highlight-face)
(speedbar-separator-face):
* whitespace.el (whitespace-newline, whitespace-space)
(whitespace-hspace, whitespace-tab, whitespace-trailing)
(whitespace-line, whitespace-space-before-tab)
(whitespace-space-after-tab, whitespace-indentation)
(whitespace-empty):
* emulation/cua-base.el (cua-global-mark):
* eshell/em-prompt.el (eshell-prompt):
* net/newst-plainview.el (newsticker-new-item-face)
(newsticker-old-item-face, newsticker-immortal-item-face)
(newsticker-obsolete-item-face, newsticker-date-face)
(newsticker-statistics-face, newsticker-default-face):
* net/newst-reader.el (newsticker-feed-face)
(newsticker-extra-face, newsticker-enclosure-face):
* net/newst-treeview.el (newsticker-treeview-face)
(newsticker-treeview-new-face, newsticker-treeview-old-face)
(newsticker-treeview-immortal-face)
(newsticker-treeview-obsolete-face)
(newsticker-treeview-selection-face):
* net/rcirc.el (rcirc-my-nick, rcirc-other-nick)
(rcirc-bright-nick, rcirc-server, rcirc-timestamp)
(rcirc-nick-in-message, rcirc-nick-in-message-full-line)
(rcirc-prompt, rcirc-track-keyword, rcirc-url, rcirc-keyword):
* nxml/nxml-outln.el (nxml-heading, nxml-outline-indicator)
(nxml-outline-active-indicator, nxml-outline-ellipsis):
* play/mpuz.el (mpuz-unsolved, mpuz-solved, mpuz-trivial)
(mpuz-text):
* progmodes/vera-mode.el (vera-font-lock-number)
(vera-font-lock-function, vera-font-lock-interface):
* textmodes/table.el (table-cell): Use new-style face specs, and
don't use the old :bold and :italic attributes.
* erc-button.el (erc-button):
* erc-goodies.el (erc-bold-face, erc-inverse-face)
(erc-underline-face, fg:erc-color-*):
* erc-match.el (erc-current-nick-face, erc-dangerous-host-face)
(erc-pal-face, erc-fool-face, erc-keyword-face):
* erc-stamp.el (erc-timestamp-face): Likewise.
* erc.el (erc-direct-msg-face, erc-header-line, erc-input-face)
(erc-command-indicator-face, erc-notice-face, erc-action-face)
(erc-error-face, erc-my-nick-face, erc-nick-default-face)
(erc-nick-msg-face): Use new-style face specs, and avoid :bold.
* progmodes/ebrowse.el (ebrowse-tree-mark, ebrowse-root-class)
(ebrowse-member-attribute, ebrowse-default, ebrowse-file-name)
(ebrowse-member-class, ebrowse-progress): Likewise.
(ebrowse-tree-mark-face, ebrowse-root-class-face)
(ebrowse-file-name-face, ebrowse-default-face)
(ebrowse-member-attribute-face, ebrowse-member-class-face)
(ebrowse-progress-face): Remove obsolete faces.
* progmodes/flymake.el (flymake-errline, flymake-warnline):
Inherit from error and warning faces respectively.
* textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate):
Likewise.
(flyspell-incorrect-face, flyspell-duplicate-face): Remove
obsolete aliases.
* display.texi (Face Attributes): Font family does not accept
wildcards. De-document obsolete :bold and :italic attributes.
(Defining Faces): Use new-style face spec format.
2012-06-09 00:39:49 +08:00
|
|
|
'((default :weight bold)
|
2023-06-24 18:33:20 -07:00
|
|
|
(((class color) (min-colors 88) (supports :weight semi-bold))
|
|
|
|
:weight semi-bold :foreground "SlateBlue")
|
Face cleanups. Remove some uses of old-style face spec and :bold/:italic.
* faces.el (set-face-attribute): Doc fix.
(modify-face): Don't use :bold and :italic.
(error, warning, success): Tweak definitions.
* cus-edit.el (custom-modified, custom-invalid, custom-rogue)
(custom-modified, custom-set, custom-changed, custom-themed)
(custom-saved, custom-button, custom-button-mouse)
(custom-button-pressed, custom-state, custom-comment-tag)
(custom-variable-tag, custom-group-tag-1, custom-group-tag)
(custom-group-subtitle): Use new-style face specs.
(custom-invalid-face, custom-rogue-face, custom-modified-face)
(custom-set-face, custom-changed-face, custom-saved-face)
(custom-button-face, custom-button-pressed-face)
(custom-documentation-face, custom-state-face)
(custom-comment-face, custom-comment-tag-face)
(custom-variable-tag-face, custom-variable-button-face)
(custom-face-tag-face, custom-group-tag-face-1)
(custom-group-tag-face): Remove obsolete face alias.
* epa.el (epa-validity-high, epa-validity-medium)
(epa-validity-low, epa-mark, epa-field-name, epa-string)
(epa-field-name, epa-field-body):
* font-lock.el (font-lock-comment-face, font-lock-string-face)
(font-lock-keyword-face, font-lock-builtin-face)
(font-lock-function-name-face, font-lock-variable-name-face)
(font-lock-type-face, font-lock-constant-face):
* ido.el (ido-first-match, ido-only-match, ido-subdir)
(ido-virtual, ido-indicator, ido-incomplete-regexp):
* speedbar.el (speedbar-button-face, speedbar-file-face)
(speedbar-directory-face, speedbar-tag-face)
(speedbar-selected-face, speedbar-highlight-face)
(speedbar-separator-face):
* whitespace.el (whitespace-newline, whitespace-space)
(whitespace-hspace, whitespace-tab, whitespace-trailing)
(whitespace-line, whitespace-space-before-tab)
(whitespace-space-after-tab, whitespace-indentation)
(whitespace-empty):
* emulation/cua-base.el (cua-global-mark):
* eshell/em-prompt.el (eshell-prompt):
* net/newst-plainview.el (newsticker-new-item-face)
(newsticker-old-item-face, newsticker-immortal-item-face)
(newsticker-obsolete-item-face, newsticker-date-face)
(newsticker-statistics-face, newsticker-default-face):
* net/newst-reader.el (newsticker-feed-face)
(newsticker-extra-face, newsticker-enclosure-face):
* net/newst-treeview.el (newsticker-treeview-face)
(newsticker-treeview-new-face, newsticker-treeview-old-face)
(newsticker-treeview-immortal-face)
(newsticker-treeview-obsolete-face)
(newsticker-treeview-selection-face):
* net/rcirc.el (rcirc-my-nick, rcirc-other-nick)
(rcirc-bright-nick, rcirc-server, rcirc-timestamp)
(rcirc-nick-in-message, rcirc-nick-in-message-full-line)
(rcirc-prompt, rcirc-track-keyword, rcirc-url, rcirc-keyword):
* nxml/nxml-outln.el (nxml-heading, nxml-outline-indicator)
(nxml-outline-active-indicator, nxml-outline-ellipsis):
* play/mpuz.el (mpuz-unsolved, mpuz-solved, mpuz-trivial)
(mpuz-text):
* progmodes/vera-mode.el (vera-font-lock-number)
(vera-font-lock-function, vera-font-lock-interface):
* textmodes/table.el (table-cell): Use new-style face specs, and
don't use the old :bold and :italic attributes.
* erc-button.el (erc-button):
* erc-goodies.el (erc-bold-face, erc-inverse-face)
(erc-underline-face, fg:erc-color-*):
* erc-match.el (erc-current-nick-face, erc-dangerous-host-face)
(erc-pal-face, erc-fool-face, erc-keyword-face):
* erc-stamp.el (erc-timestamp-face): Likewise.
* erc.el (erc-direct-msg-face, erc-header-line, erc-input-face)
(erc-command-indicator-face, erc-notice-face, erc-action-face)
(erc-error-face, erc-my-nick-face, erc-nick-default-face)
(erc-nick-msg-face): Use new-style face specs, and avoid :bold.
* progmodes/ebrowse.el (ebrowse-tree-mark, ebrowse-root-class)
(ebrowse-member-attribute, ebrowse-default, ebrowse-file-name)
(ebrowse-member-class, ebrowse-progress): Likewise.
(ebrowse-tree-mark-face, ebrowse-root-class-face)
(ebrowse-file-name-face, ebrowse-default-face)
(ebrowse-member-attribute-face, ebrowse-member-class-face)
(ebrowse-progress-face): Remove obsolete faces.
* progmodes/flymake.el (flymake-errline, flymake-warnline):
Inherit from error and warning faces respectively.
* textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate):
Likewise.
(flyspell-incorrect-face, flyspell-duplicate-face): Remove
obsolete aliases.
* display.texi (Face Attributes): Font family does not accept
wildcards. De-document obsolete :bold and :italic attributes.
(Defining Faces): Use new-style face spec format.
2012-06-09 00:39:49 +08:00
|
|
|
(((class color) (min-colors 88)) :foreground "SlateBlue")
|
|
|
|
(t :foreground "blue"))
|
2006-01-29 13:08:58 +00:00
|
|
|
"ERC face for notices."
|
2023-11-07 23:51:27 -08:00
|
|
|
:package-version '(ERC . "5.6")
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-faces)
|
|
|
|
|
2023-06-24 18:33:20 -07:00
|
|
|
(defface erc-action-face '((((supports :weight semi-bold)) :weight semi-bold)
|
|
|
|
(t :weight bold))
|
2006-01-29 13:08:58 +00:00
|
|
|
"ERC face for actions generated by /ME."
|
2023-11-07 23:51:27 -08:00
|
|
|
:package-version '(ERC . "5.6")
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-faces)
|
|
|
|
|
Face cleanups. Remove some uses of old-style face spec and :bold/:italic.
* faces.el (set-face-attribute): Doc fix.
(modify-face): Don't use :bold and :italic.
(error, warning, success): Tweak definitions.
* cus-edit.el (custom-modified, custom-invalid, custom-rogue)
(custom-modified, custom-set, custom-changed, custom-themed)
(custom-saved, custom-button, custom-button-mouse)
(custom-button-pressed, custom-state, custom-comment-tag)
(custom-variable-tag, custom-group-tag-1, custom-group-tag)
(custom-group-subtitle): Use new-style face specs.
(custom-invalid-face, custom-rogue-face, custom-modified-face)
(custom-set-face, custom-changed-face, custom-saved-face)
(custom-button-face, custom-button-pressed-face)
(custom-documentation-face, custom-state-face)
(custom-comment-face, custom-comment-tag-face)
(custom-variable-tag-face, custom-variable-button-face)
(custom-face-tag-face, custom-group-tag-face-1)
(custom-group-tag-face): Remove obsolete face alias.
* epa.el (epa-validity-high, epa-validity-medium)
(epa-validity-low, epa-mark, epa-field-name, epa-string)
(epa-field-name, epa-field-body):
* font-lock.el (font-lock-comment-face, font-lock-string-face)
(font-lock-keyword-face, font-lock-builtin-face)
(font-lock-function-name-face, font-lock-variable-name-face)
(font-lock-type-face, font-lock-constant-face):
* ido.el (ido-first-match, ido-only-match, ido-subdir)
(ido-virtual, ido-indicator, ido-incomplete-regexp):
* speedbar.el (speedbar-button-face, speedbar-file-face)
(speedbar-directory-face, speedbar-tag-face)
(speedbar-selected-face, speedbar-highlight-face)
(speedbar-separator-face):
* whitespace.el (whitespace-newline, whitespace-space)
(whitespace-hspace, whitespace-tab, whitespace-trailing)
(whitespace-line, whitespace-space-before-tab)
(whitespace-space-after-tab, whitespace-indentation)
(whitespace-empty):
* emulation/cua-base.el (cua-global-mark):
* eshell/em-prompt.el (eshell-prompt):
* net/newst-plainview.el (newsticker-new-item-face)
(newsticker-old-item-face, newsticker-immortal-item-face)
(newsticker-obsolete-item-face, newsticker-date-face)
(newsticker-statistics-face, newsticker-default-face):
* net/newst-reader.el (newsticker-feed-face)
(newsticker-extra-face, newsticker-enclosure-face):
* net/newst-treeview.el (newsticker-treeview-face)
(newsticker-treeview-new-face, newsticker-treeview-old-face)
(newsticker-treeview-immortal-face)
(newsticker-treeview-obsolete-face)
(newsticker-treeview-selection-face):
* net/rcirc.el (rcirc-my-nick, rcirc-other-nick)
(rcirc-bright-nick, rcirc-server, rcirc-timestamp)
(rcirc-nick-in-message, rcirc-nick-in-message-full-line)
(rcirc-prompt, rcirc-track-keyword, rcirc-url, rcirc-keyword):
* nxml/nxml-outln.el (nxml-heading, nxml-outline-indicator)
(nxml-outline-active-indicator, nxml-outline-ellipsis):
* play/mpuz.el (mpuz-unsolved, mpuz-solved, mpuz-trivial)
(mpuz-text):
* progmodes/vera-mode.el (vera-font-lock-number)
(vera-font-lock-function, vera-font-lock-interface):
* textmodes/table.el (table-cell): Use new-style face specs, and
don't use the old :bold and :italic attributes.
* erc-button.el (erc-button):
* erc-goodies.el (erc-bold-face, erc-inverse-face)
(erc-underline-face, fg:erc-color-*):
* erc-match.el (erc-current-nick-face, erc-dangerous-host-face)
(erc-pal-face, erc-fool-face, erc-keyword-face):
* erc-stamp.el (erc-timestamp-face): Likewise.
* erc.el (erc-direct-msg-face, erc-header-line, erc-input-face)
(erc-command-indicator-face, erc-notice-face, erc-action-face)
(erc-error-face, erc-my-nick-face, erc-nick-default-face)
(erc-nick-msg-face): Use new-style face specs, and avoid :bold.
* progmodes/ebrowse.el (ebrowse-tree-mark, ebrowse-root-class)
(ebrowse-member-attribute, ebrowse-default, ebrowse-file-name)
(ebrowse-member-class, ebrowse-progress): Likewise.
(ebrowse-tree-mark-face, ebrowse-root-class-face)
(ebrowse-file-name-face, ebrowse-default-face)
(ebrowse-member-attribute-face, ebrowse-member-class-face)
(ebrowse-progress-face): Remove obsolete faces.
* progmodes/flymake.el (flymake-errline, flymake-warnline):
Inherit from error and warning faces respectively.
* textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate):
Likewise.
(flyspell-incorrect-face, flyspell-duplicate-face): Remove
obsolete aliases.
* display.texi (Face Attributes): Font family does not accept
wildcards. De-document obsolete :bold and :italic attributes.
(Defining Faces): Use new-style face spec format.
2012-06-09 00:39:49 +08:00
|
|
|
(defface erc-error-face '((t :foreground "red"))
|
2006-01-29 13:08:58 +00:00
|
|
|
"ERC face for errors."
|
|
|
|
:group 'erc-faces)
|
|
|
|
|
2006-11-20 06:50:29 +00:00
|
|
|
;; same default color as `erc-input-face'
|
Face cleanups. Remove some uses of old-style face spec and :bold/:italic.
* faces.el (set-face-attribute): Doc fix.
(modify-face): Don't use :bold and :italic.
(error, warning, success): Tweak definitions.
* cus-edit.el (custom-modified, custom-invalid, custom-rogue)
(custom-modified, custom-set, custom-changed, custom-themed)
(custom-saved, custom-button, custom-button-mouse)
(custom-button-pressed, custom-state, custom-comment-tag)
(custom-variable-tag, custom-group-tag-1, custom-group-tag)
(custom-group-subtitle): Use new-style face specs.
(custom-invalid-face, custom-rogue-face, custom-modified-face)
(custom-set-face, custom-changed-face, custom-saved-face)
(custom-button-face, custom-button-pressed-face)
(custom-documentation-face, custom-state-face)
(custom-comment-face, custom-comment-tag-face)
(custom-variable-tag-face, custom-variable-button-face)
(custom-face-tag-face, custom-group-tag-face-1)
(custom-group-tag-face): Remove obsolete face alias.
* epa.el (epa-validity-high, epa-validity-medium)
(epa-validity-low, epa-mark, epa-field-name, epa-string)
(epa-field-name, epa-field-body):
* font-lock.el (font-lock-comment-face, font-lock-string-face)
(font-lock-keyword-face, font-lock-builtin-face)
(font-lock-function-name-face, font-lock-variable-name-face)
(font-lock-type-face, font-lock-constant-face):
* ido.el (ido-first-match, ido-only-match, ido-subdir)
(ido-virtual, ido-indicator, ido-incomplete-regexp):
* speedbar.el (speedbar-button-face, speedbar-file-face)
(speedbar-directory-face, speedbar-tag-face)
(speedbar-selected-face, speedbar-highlight-face)
(speedbar-separator-face):
* whitespace.el (whitespace-newline, whitespace-space)
(whitespace-hspace, whitespace-tab, whitespace-trailing)
(whitespace-line, whitespace-space-before-tab)
(whitespace-space-after-tab, whitespace-indentation)
(whitespace-empty):
* emulation/cua-base.el (cua-global-mark):
* eshell/em-prompt.el (eshell-prompt):
* net/newst-plainview.el (newsticker-new-item-face)
(newsticker-old-item-face, newsticker-immortal-item-face)
(newsticker-obsolete-item-face, newsticker-date-face)
(newsticker-statistics-face, newsticker-default-face):
* net/newst-reader.el (newsticker-feed-face)
(newsticker-extra-face, newsticker-enclosure-face):
* net/newst-treeview.el (newsticker-treeview-face)
(newsticker-treeview-new-face, newsticker-treeview-old-face)
(newsticker-treeview-immortal-face)
(newsticker-treeview-obsolete-face)
(newsticker-treeview-selection-face):
* net/rcirc.el (rcirc-my-nick, rcirc-other-nick)
(rcirc-bright-nick, rcirc-server, rcirc-timestamp)
(rcirc-nick-in-message, rcirc-nick-in-message-full-line)
(rcirc-prompt, rcirc-track-keyword, rcirc-url, rcirc-keyword):
* nxml/nxml-outln.el (nxml-heading, nxml-outline-indicator)
(nxml-outline-active-indicator, nxml-outline-ellipsis):
* play/mpuz.el (mpuz-unsolved, mpuz-solved, mpuz-trivial)
(mpuz-text):
* progmodes/vera-mode.el (vera-font-lock-number)
(vera-font-lock-function, vera-font-lock-interface):
* textmodes/table.el (table-cell): Use new-style face specs, and
don't use the old :bold and :italic attributes.
* erc-button.el (erc-button):
* erc-goodies.el (erc-bold-face, erc-inverse-face)
(erc-underline-face, fg:erc-color-*):
* erc-match.el (erc-current-nick-face, erc-dangerous-host-face)
(erc-pal-face, erc-fool-face, erc-keyword-face):
* erc-stamp.el (erc-timestamp-face): Likewise.
* erc.el (erc-direct-msg-face, erc-header-line, erc-input-face)
(erc-command-indicator-face, erc-notice-face, erc-action-face)
(erc-error-face, erc-my-nick-face, erc-nick-default-face)
(erc-nick-msg-face): Use new-style face specs, and avoid :bold.
* progmodes/ebrowse.el (ebrowse-tree-mark, ebrowse-root-class)
(ebrowse-member-attribute, ebrowse-default, ebrowse-file-name)
(ebrowse-member-class, ebrowse-progress): Likewise.
(ebrowse-tree-mark-face, ebrowse-root-class-face)
(ebrowse-file-name-face, ebrowse-default-face)
(ebrowse-member-attribute-face, ebrowse-member-class-face)
(ebrowse-progress-face): Remove obsolete faces.
* progmodes/flymake.el (flymake-errline, flymake-warnline):
Inherit from error and warning faces respectively.
* textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate):
Likewise.
(flyspell-incorrect-face, flyspell-duplicate-face): Remove
obsolete aliases.
* display.texi (Face Attributes): Font family does not accept
wildcards. De-document obsolete :bold and :italic attributes.
(Defining Faces): Use new-style face spec format.
2012-06-09 00:39:49 +08:00
|
|
|
(defface erc-my-nick-face '((t :weight bold :foreground "brown"))
|
2006-11-20 06:50:29 +00:00
|
|
|
"ERC face for your current nickname in messages sent by you.
|
|
|
|
See also `erc-show-my-nick'."
|
|
|
|
:group 'erc-faces)
|
|
|
|
|
Face cleanups. Remove some uses of old-style face spec and :bold/:italic.
* faces.el (set-face-attribute): Doc fix.
(modify-face): Don't use :bold and :italic.
(error, warning, success): Tweak definitions.
* cus-edit.el (custom-modified, custom-invalid, custom-rogue)
(custom-modified, custom-set, custom-changed, custom-themed)
(custom-saved, custom-button, custom-button-mouse)
(custom-button-pressed, custom-state, custom-comment-tag)
(custom-variable-tag, custom-group-tag-1, custom-group-tag)
(custom-group-subtitle): Use new-style face specs.
(custom-invalid-face, custom-rogue-face, custom-modified-face)
(custom-set-face, custom-changed-face, custom-saved-face)
(custom-button-face, custom-button-pressed-face)
(custom-documentation-face, custom-state-face)
(custom-comment-face, custom-comment-tag-face)
(custom-variable-tag-face, custom-variable-button-face)
(custom-face-tag-face, custom-group-tag-face-1)
(custom-group-tag-face): Remove obsolete face alias.
* epa.el (epa-validity-high, epa-validity-medium)
(epa-validity-low, epa-mark, epa-field-name, epa-string)
(epa-field-name, epa-field-body):
* font-lock.el (font-lock-comment-face, font-lock-string-face)
(font-lock-keyword-face, font-lock-builtin-face)
(font-lock-function-name-face, font-lock-variable-name-face)
(font-lock-type-face, font-lock-constant-face):
* ido.el (ido-first-match, ido-only-match, ido-subdir)
(ido-virtual, ido-indicator, ido-incomplete-regexp):
* speedbar.el (speedbar-button-face, speedbar-file-face)
(speedbar-directory-face, speedbar-tag-face)
(speedbar-selected-face, speedbar-highlight-face)
(speedbar-separator-face):
* whitespace.el (whitespace-newline, whitespace-space)
(whitespace-hspace, whitespace-tab, whitespace-trailing)
(whitespace-line, whitespace-space-before-tab)
(whitespace-space-after-tab, whitespace-indentation)
(whitespace-empty):
* emulation/cua-base.el (cua-global-mark):
* eshell/em-prompt.el (eshell-prompt):
* net/newst-plainview.el (newsticker-new-item-face)
(newsticker-old-item-face, newsticker-immortal-item-face)
(newsticker-obsolete-item-face, newsticker-date-face)
(newsticker-statistics-face, newsticker-default-face):
* net/newst-reader.el (newsticker-feed-face)
(newsticker-extra-face, newsticker-enclosure-face):
* net/newst-treeview.el (newsticker-treeview-face)
(newsticker-treeview-new-face, newsticker-treeview-old-face)
(newsticker-treeview-immortal-face)
(newsticker-treeview-obsolete-face)
(newsticker-treeview-selection-face):
* net/rcirc.el (rcirc-my-nick, rcirc-other-nick)
(rcirc-bright-nick, rcirc-server, rcirc-timestamp)
(rcirc-nick-in-message, rcirc-nick-in-message-full-line)
(rcirc-prompt, rcirc-track-keyword, rcirc-url, rcirc-keyword):
* nxml/nxml-outln.el (nxml-heading, nxml-outline-indicator)
(nxml-outline-active-indicator, nxml-outline-ellipsis):
* play/mpuz.el (mpuz-unsolved, mpuz-solved, mpuz-trivial)
(mpuz-text):
* progmodes/vera-mode.el (vera-font-lock-number)
(vera-font-lock-function, vera-font-lock-interface):
* textmodes/table.el (table-cell): Use new-style face specs, and
don't use the old :bold and :italic attributes.
* erc-button.el (erc-button):
* erc-goodies.el (erc-bold-face, erc-inverse-face)
(erc-underline-face, fg:erc-color-*):
* erc-match.el (erc-current-nick-face, erc-dangerous-host-face)
(erc-pal-face, erc-fool-face, erc-keyword-face):
* erc-stamp.el (erc-timestamp-face): Likewise.
* erc.el (erc-direct-msg-face, erc-header-line, erc-input-face)
(erc-command-indicator-face, erc-notice-face, erc-action-face)
(erc-error-face, erc-my-nick-face, erc-nick-default-face)
(erc-nick-msg-face): Use new-style face specs, and avoid :bold.
* progmodes/ebrowse.el (ebrowse-tree-mark, ebrowse-root-class)
(ebrowse-member-attribute, ebrowse-default, ebrowse-file-name)
(ebrowse-member-class, ebrowse-progress): Likewise.
(ebrowse-tree-mark-face, ebrowse-root-class-face)
(ebrowse-file-name-face, ebrowse-default-face)
(ebrowse-member-attribute-face, ebrowse-member-class-face)
(ebrowse-progress-face): Remove obsolete faces.
* progmodes/flymake.el (flymake-errline, flymake-warnline):
Inherit from error and warning faces respectively.
* textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate):
Likewise.
(flyspell-incorrect-face, flyspell-duplicate-face): Remove
obsolete aliases.
* display.texi (Face Attributes): Font family does not accept
wildcards. De-document obsolete :bold and :italic attributes.
(Defining Faces): Use new-style face spec format.
2012-06-09 00:39:49 +08:00
|
|
|
(defface erc-nick-default-face '((t :weight bold))
|
2006-01-29 13:08:58 +00:00
|
|
|
"ERC nickname default face."
|
|
|
|
:group 'erc-faces)
|
|
|
|
|
Face cleanups. Remove some uses of old-style face spec and :bold/:italic.
* faces.el (set-face-attribute): Doc fix.
(modify-face): Don't use :bold and :italic.
(error, warning, success): Tweak definitions.
* cus-edit.el (custom-modified, custom-invalid, custom-rogue)
(custom-modified, custom-set, custom-changed, custom-themed)
(custom-saved, custom-button, custom-button-mouse)
(custom-button-pressed, custom-state, custom-comment-tag)
(custom-variable-tag, custom-group-tag-1, custom-group-tag)
(custom-group-subtitle): Use new-style face specs.
(custom-invalid-face, custom-rogue-face, custom-modified-face)
(custom-set-face, custom-changed-face, custom-saved-face)
(custom-button-face, custom-button-pressed-face)
(custom-documentation-face, custom-state-face)
(custom-comment-face, custom-comment-tag-face)
(custom-variable-tag-face, custom-variable-button-face)
(custom-face-tag-face, custom-group-tag-face-1)
(custom-group-tag-face): Remove obsolete face alias.
* epa.el (epa-validity-high, epa-validity-medium)
(epa-validity-low, epa-mark, epa-field-name, epa-string)
(epa-field-name, epa-field-body):
* font-lock.el (font-lock-comment-face, font-lock-string-face)
(font-lock-keyword-face, font-lock-builtin-face)
(font-lock-function-name-face, font-lock-variable-name-face)
(font-lock-type-face, font-lock-constant-face):
* ido.el (ido-first-match, ido-only-match, ido-subdir)
(ido-virtual, ido-indicator, ido-incomplete-regexp):
* speedbar.el (speedbar-button-face, speedbar-file-face)
(speedbar-directory-face, speedbar-tag-face)
(speedbar-selected-face, speedbar-highlight-face)
(speedbar-separator-face):
* whitespace.el (whitespace-newline, whitespace-space)
(whitespace-hspace, whitespace-tab, whitespace-trailing)
(whitespace-line, whitespace-space-before-tab)
(whitespace-space-after-tab, whitespace-indentation)
(whitespace-empty):
* emulation/cua-base.el (cua-global-mark):
* eshell/em-prompt.el (eshell-prompt):
* net/newst-plainview.el (newsticker-new-item-face)
(newsticker-old-item-face, newsticker-immortal-item-face)
(newsticker-obsolete-item-face, newsticker-date-face)
(newsticker-statistics-face, newsticker-default-face):
* net/newst-reader.el (newsticker-feed-face)
(newsticker-extra-face, newsticker-enclosure-face):
* net/newst-treeview.el (newsticker-treeview-face)
(newsticker-treeview-new-face, newsticker-treeview-old-face)
(newsticker-treeview-immortal-face)
(newsticker-treeview-obsolete-face)
(newsticker-treeview-selection-face):
* net/rcirc.el (rcirc-my-nick, rcirc-other-nick)
(rcirc-bright-nick, rcirc-server, rcirc-timestamp)
(rcirc-nick-in-message, rcirc-nick-in-message-full-line)
(rcirc-prompt, rcirc-track-keyword, rcirc-url, rcirc-keyword):
* nxml/nxml-outln.el (nxml-heading, nxml-outline-indicator)
(nxml-outline-active-indicator, nxml-outline-ellipsis):
* play/mpuz.el (mpuz-unsolved, mpuz-solved, mpuz-trivial)
(mpuz-text):
* progmodes/vera-mode.el (vera-font-lock-number)
(vera-font-lock-function, vera-font-lock-interface):
* textmodes/table.el (table-cell): Use new-style face specs, and
don't use the old :bold and :italic attributes.
* erc-button.el (erc-button):
* erc-goodies.el (erc-bold-face, erc-inverse-face)
(erc-underline-face, fg:erc-color-*):
* erc-match.el (erc-current-nick-face, erc-dangerous-host-face)
(erc-pal-face, erc-fool-face, erc-keyword-face):
* erc-stamp.el (erc-timestamp-face): Likewise.
* erc.el (erc-direct-msg-face, erc-header-line, erc-input-face)
(erc-command-indicator-face, erc-notice-face, erc-action-face)
(erc-error-face, erc-my-nick-face, erc-nick-default-face)
(erc-nick-msg-face): Use new-style face specs, and avoid :bold.
* progmodes/ebrowse.el (ebrowse-tree-mark, ebrowse-root-class)
(ebrowse-member-attribute, ebrowse-default, ebrowse-file-name)
(ebrowse-member-class, ebrowse-progress): Likewise.
(ebrowse-tree-mark-face, ebrowse-root-class-face)
(ebrowse-file-name-face, ebrowse-default-face)
(ebrowse-member-attribute-face, ebrowse-member-class-face)
(ebrowse-progress-face): Remove obsolete faces.
* progmodes/flymake.el (flymake-errline, flymake-warnline):
Inherit from error and warning faces respectively.
* textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate):
Likewise.
(flyspell-incorrect-face, flyspell-duplicate-face): Remove
obsolete aliases.
* display.texi (Face Attributes): Font family does not accept
wildcards. De-document obsolete :bold and :italic attributes.
(Defining Faces): Use new-style face spec format.
2012-06-09 00:39:49 +08:00
|
|
|
(defface erc-nick-msg-face '((t :weight bold :foreground "IndianRed"))
|
2006-01-29 13:08:58 +00:00
|
|
|
"ERC nickname face for private messages."
|
|
|
|
:group 'erc-faces)
|
|
|
|
|
|
|
|
;; Debugging support
|
|
|
|
|
Sequester some special-variable declarations in ERC
* lisp/erc/erc-backend.el (erc-log-p): Remove declaration entirely.
(erc-server-reconnect): Move declaration for `erc-reuse-buffers' here.
(erc-process-sentinel-1): Move `erc-kill-server-buffer-on-quit'
declaration here.
(erc--conceal-prompt): Move `erc-prompt-hidden' declaration here.
(erc-server-INVITE): Move `erc-invitation' declaration here.
(erc-server-PART): Move `erc-kill-buffer-on-part' declaration here.
(erc-server-PRIVMSG): Move declarations for `erc-minibuffer-ignored',
`erc-receive-query-display', `erc-receive-query-display-defer',
`erc--cmem-from-nick-function', `erc-format-nick-function', and
`erc-format-query-as-channel-p' here.
(erc-server-401): Move `erc-whowas-on-nosuchnick' declaration here.
(erc-server-475): Move `erc--called-as-input-p' and
`erc-prompt-for-channel-key' declarations here.
* lisp/erc/erc-common.el (erc-log-p): Remove declaration for
`erc-log-p' and replace with actual definition.
(erc-log-aux): Move `erc-dbuf' declaration from top level into
function body.
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Note in
the doc string that this function produces side effects.
* lisp/erc/erc-networks.el (erc-determine-network,
erc-networks--copy-server-buffer-functions): Move some variable
declarations to function body.
(erc-settings, erc-get): Deprecate for now and explain why in doc
strings. We could deprecate them unconditionally, but they never
provided usable code, and their names are short and valuable.
* lisp/erc/erc.el (tabbar--local-hlf, motif-version-string,
gtk-version-string): Prefer moving these single-serving declarations
to function bodies, if only to make closures from this library less
cluttered when debugging. This should also help avoid stray
declarations.
(erc-hooks, erc-timer-hook): Revise doc strings.
(erc-log-p): Move definition to erc-common.el.
(erc-cmd-SV): Mimic `emacs-version' and stick with `featurep', here in
combination with special-variable declarations, instead of `boundp' or
similar.
(erc-header-line-uses-tabbar-p): Explain that this has nothing to do
with `tab-bar'.
(erc-update-mode-line-buffer): Only assign when bound. This has been
verified to work with version 2.0 on EmacsWiki.
* test/lisp/erc/erc-scenarios-base-reconnect.el: Timeouts.
* test/lisp/erc/erc-scenarios-base-renick.el: Timeouts.
* test/lisp/erc/resources/join/network-id/foonet-again.eld: Timeouts.
2023-11-26 18:24:48 -08:00
|
|
|
;; FIXME if this variable plays some role, indicate that here.
|
|
|
|
;; Otherwise, deprecate.
|
2006-01-29 13:08:58 +00:00
|
|
|
(defvar erc-debug-log-file (expand-file-name "ERC.debug")
|
|
|
|
"Debug log file name.")
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-dbuf nil)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-01-16 23:05:16 -08:00
|
|
|
;; See comments in `erc-scenarios-base-local-modules' explaining why
|
|
|
|
;; this is insufficient as a public interface.
|
|
|
|
|
|
|
|
(defvar erc--target-priors nil
|
|
|
|
"Analogous to `erc--server-reconnecting' but for target buffers.
|
|
|
|
Bound to local variables from an existing (logical) session's
|
|
|
|
buffer during local-module setup and `erc-mode-hook' activation.")
|
|
|
|
|
2023-05-07 19:43:57 -07:00
|
|
|
(defmacro erc--restore-initialize-priors (mode &rest vars)
|
|
|
|
"Restore local VARS for MODE from a previous session."
|
|
|
|
(declare (indent 1))
|
2023-10-05 00:16:46 -07:00
|
|
|
(let ((priors (make-symbol "priors"))
|
|
|
|
(initp (make-symbol "initp"))
|
2023-05-07 19:43:57 -07:00
|
|
|
;;
|
2023-10-05 00:16:46 -07:00
|
|
|
forms)
|
|
|
|
(while-let ((k (pop vars)))
|
|
|
|
(push `(,k (if ,initp (alist-get ',k ,priors) ,(pop vars))) forms))
|
|
|
|
`(let* ((,priors (or erc--server-reconnecting erc--target-priors))
|
|
|
|
(,initp (and ,priors (alist-get ',mode ,priors))))
|
|
|
|
(setq ,@(mapcan #'identity (nreverse forms))))))
|
2023-05-07 19:43:57 -07:00
|
|
|
|
2021-10-19 22:53:03 -07:00
|
|
|
(defun erc--target-from-string (string)
|
|
|
|
"Construct an `erc--target' variant from STRING."
|
|
|
|
(funcall (if (erc-channel-p string)
|
|
|
|
(if (erc--valid-local-channel-p string)
|
|
|
|
#'make-erc--target-channel-local
|
|
|
|
#'make-erc--target-channel)
|
|
|
|
#'make-erc--target)
|
|
|
|
:string string :symbol (intern (erc-downcase string))))
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-once-with-server-event (event f)
|
|
|
|
"Run function F the next time EVENT occurs in the `current-buffer'.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
You should make sure that `current-buffer' is a server buffer.
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
This function temporarily adds a function to EVENT's hook to call F with
|
|
|
|
two arguments (`proc' and `parsed'). After F is called, the function is
|
|
|
|
removed from EVENT's hook. F should return either nil
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
or t, where nil indicates that the other functions on EVENT's hook
|
2006-01-29 13:08:58 +00:00
|
|
|
should be run too, and t indicates that other functions should
|
|
|
|
not be run.
|
|
|
|
|
|
|
|
Please be sure to use this function in server-buffers. In
|
|
|
|
channel-buffers it may not work at all, as it uses the LOCAL
|
|
|
|
argument of `add-hook' and `remove-hook' to ensure multiserver
|
|
|
|
capabilities."
|
2023-10-15 07:22:31 -07:00
|
|
|
(unless (erc--server-buffer-p)
|
2006-01-29 13:08:58 +00:00
|
|
|
(error
|
|
|
|
"You should only run `erc-once-with-server-event' in a server buffer"))
|
2007-04-01 13:36:38 +00:00
|
|
|
(let ((fun (make-symbol "fun"))
|
2014-11-08 20:51:43 -05:00
|
|
|
(hook (erc-get-hook event)))
|
2013-08-22 00:06:45 -04:00
|
|
|
(put fun 'erc-original-buffer (current-buffer))
|
|
|
|
(fset fun (lambda (proc parsed)
|
2014-11-08 20:51:43 -05:00
|
|
|
(with-current-buffer (get fun 'erc-original-buffer)
|
|
|
|
(remove-hook hook fun t))
|
|
|
|
(fmakunbound fun)
|
|
|
|
(funcall f proc parsed)))
|
2013-08-22 00:06:45 -04:00
|
|
|
(add-hook hook fun nil t)
|
|
|
|
fun))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-05-07 19:43:57 -07:00
|
|
|
(defun erc--warn-once-before-connect (mode-var &rest args)
|
|
|
|
"Display an \"error notice\" once.
|
|
|
|
Expect ARGS to be `erc-button--display-error-notice-with-keys'
|
|
|
|
compatible parameters, except without any leading buffers or
|
|
|
|
processes. If we're in an ERC buffer with a network process when
|
|
|
|
called, print the notice immediately. Otherwise, if we're in a
|
|
|
|
server buffer, arrange to do so after local modules have been set
|
|
|
|
up and mode hooks have run. Otherwise, if MODE-VAR is a global
|
|
|
|
module, try again at most once the next time `erc-mode-hook'
|
|
|
|
runs."
|
|
|
|
(declare (indent 1))
|
|
|
|
(cl-assert (stringp (car args)))
|
|
|
|
(if (derived-mode-p 'erc-mode)
|
|
|
|
(unless (or (erc-with-server-buffer ; needs `erc-server-process'
|
|
|
|
(apply #'erc-button--display-error-notice-with-keys
|
|
|
|
(current-buffer) args)
|
|
|
|
t)
|
|
|
|
erc--target) ; unlikely
|
|
|
|
(let (hook)
|
|
|
|
(setq hook
|
|
|
|
(lambda (_)
|
|
|
|
(remove-hook 'erc-connect-pre-hook hook t)
|
|
|
|
(apply #'erc-button--display-error-notice-with-keys args)))
|
|
|
|
(add-hook 'erc-connect-pre-hook hook nil t)))
|
|
|
|
(when (custom-variable-p mode-var)
|
|
|
|
(let (hook)
|
|
|
|
(setq hook (lambda ()
|
|
|
|
(remove-hook 'erc-mode-hook hook)
|
|
|
|
(apply #'erc--warn-once-before-connect 'erc-fake args)))
|
|
|
|
(add-hook 'erc-mode-hook hook)))))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-server-buffer ()
|
|
|
|
"Return the server buffer for the current buffer's process.
|
|
|
|
The buffer-local variable `erc-server-process' is used to find
|
|
|
|
the process buffer."
|
|
|
|
(and (erc-server-buffer-live-p)
|
|
|
|
(process-buffer erc-server-process)))
|
|
|
|
|
|
|
|
(defun erc-server-buffer-live-p ()
|
2006-11-20 06:50:29 +00:00
|
|
|
"Return t if the server buffer has not been killed."
|
2006-01-29 13:08:58 +00:00
|
|
|
(and (processp erc-server-process)
|
|
|
|
(buffer-live-p (process-buffer erc-server-process))))
|
|
|
|
|
2023-10-15 07:22:31 -07:00
|
|
|
(define-obsolete-function-alias
|
|
|
|
'erc-server-buffer-p 'erc-server-or-unjoined-channel-buffer-p "30.1")
|
|
|
|
(defun erc-server-or-unjoined-channel-buffer-p (&optional buffer)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Return non-nil if argument BUFFER is an ERC server buffer.
|
2023-10-15 07:22:31 -07:00
|
|
|
If BUFFER is nil, use the current buffer. For historical
|
|
|
|
reasons, also return non-nil for channel buffers the client has
|
|
|
|
parted or from which it's been kicked."
|
2006-01-29 13:08:58 +00:00
|
|
|
(with-current-buffer (or buffer (current-buffer))
|
|
|
|
(and (eq major-mode 'erc-mode)
|
2014-11-08 20:51:43 -05:00
|
|
|
(null (erc-default-target)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-10-15 07:22:31 -07:00
|
|
|
(defun erc--server-buffer-p (&optional buffer)
|
|
|
|
"Return non-nil if BUFFER is an ERC server buffer.
|
|
|
|
Without BUFFER, use the current buffer."
|
|
|
|
(if buffer
|
|
|
|
(with-current-buffer buffer
|
|
|
|
(and (eq major-mode 'erc-mode) (null erc--target)))
|
|
|
|
(and (eq major-mode 'erc-mode) (null erc--target))))
|
|
|
|
|
2013-09-18 19:21:31 -07:00
|
|
|
(defun erc-open-server-buffer-p (&optional buffer)
|
2021-09-19 12:59:01 +02:00
|
|
|
"Return non-nil if BUFFER is an ERC server buffer with an open IRC process.
|
2007-01-17 18:17:35 +00:00
|
|
|
|
|
|
|
If BUFFER is nil, the current buffer is used."
|
2023-10-15 07:22:31 -07:00
|
|
|
(and (erc--server-buffer-p buffer)
|
2013-09-18 19:21:31 -07:00
|
|
|
(erc-server-process-alive buffer)))
|
2007-01-17 18:17:35 +00:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-query-buffer-p (&optional buffer)
|
|
|
|
"Return non-nil if BUFFER is an ERC query buffer.
|
|
|
|
If BUFFER is nil, the current buffer is used."
|
|
|
|
(with-current-buffer (or buffer (current-buffer))
|
2023-10-15 13:20:07 -07:00
|
|
|
(let ((target (erc-target)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(and (eq major-mode 'erc-mode)
|
2014-11-08 20:51:43 -05:00
|
|
|
target
|
|
|
|
(not (memq (aref target 0) '(?# ?& ?+ ?!)))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-ison-p (nick)
|
|
|
|
"Return non-nil if NICK is online."
|
|
|
|
(interactive "sNick: ")
|
2007-04-01 13:36:38 +00:00
|
|
|
(erc-with-server-buffer
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((erc-online-p 'unknown))
|
|
|
|
(erc-once-with-server-event
|
|
|
|
303
|
2013-08-22 00:06:45 -04:00
|
|
|
(lambda (_proc parsed)
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((ison (split-string (aref parsed 3))))
|
|
|
|
(setq erc-online-p (car (erc-member-ignore-case nick ison)))
|
|
|
|
t)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-server-send (format "ISON %s" nick))
|
|
|
|
(while (eq erc-online-p 'unknown) (accept-process-output))
|
Use cl-lib instead of cl, and interactive-p => called-interactively-p.
* lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
called-interactively-p instead of cl.
* lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
* lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
* lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
* lisp/erc/erc-capab.el: Don't require cl since we don't use it.
* lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
(erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
* lisp/json.el: Don't require cl since we don't use it.
* lisp/color.el: Don't require cl.
(color-complement): `caddr' -> `nth 2'.
* test/automated/ert-x-tests.el: Use cl-lib.
* test/automated/ert-tests.el: Use lexical-binding and cl-lib.
2012-11-19 12:24:12 -05:00
|
|
|
(if (called-interactively-p 'interactive)
|
2014-11-08 20:51:43 -05:00
|
|
|
(message "%s is %sonline"
|
|
|
|
(or erc-online-p nick)
|
|
|
|
(if erc-online-p "" "not "))
|
|
|
|
erc-online-p))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; Last active buffer, to print server messages in the right place
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-active-buffer nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"The current active buffer, the one where the user typed the last command.
|
|
|
|
Defaults to the server buffer, and should only be set in the
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
server buffer.")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-active-buffer ()
|
|
|
|
"Return the value of `erc-active-buffer' for the current server.
|
|
|
|
Defaults to the server buffer."
|
2007-04-01 13:36:38 +00:00
|
|
|
(erc-with-server-buffer
|
2006-07-14 02:29:50 +00:00
|
|
|
(if (buffer-live-p erc-active-buffer)
|
2014-11-08 20:51:43 -05:00
|
|
|
erc-active-buffer
|
2006-08-03 05:10:38 +00:00
|
|
|
(setq erc-active-buffer (current-buffer)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-set-active-buffer (buffer)
|
|
|
|
"Set the value of `erc-active-buffer' to BUFFER."
|
|
|
|
(cond ((erc-server-buffer)
|
2014-11-08 20:51:43 -05:00
|
|
|
(with-current-buffer (erc-server-buffer)
|
|
|
|
(setq erc-active-buffer buffer)))
|
|
|
|
(t (setq erc-active-buffer buffer))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; Mode activation routines
|
|
|
|
|
2011-01-13 18:14:30 -05:00
|
|
|
(define-derived-mode erc-mode fundamental-mode "ERC"
|
|
|
|
"Major mode for Emacs IRC."
|
2021-11-15 10:07:11 +01:00
|
|
|
:interactive nil
|
2011-01-13 18:14:30 -05:00
|
|
|
(setq local-abbrev-table erc-mode-abbrev-table)
|
2020-12-04 11:14:26 +01:00
|
|
|
(setq-local next-line-add-newlines nil)
|
2006-01-29 13:08:58 +00:00
|
|
|
(setq line-move-ignore-invisible t)
|
2020-12-04 11:14:26 +01:00
|
|
|
(setq-local paragraph-separate
|
|
|
|
(concat "\C-l\\|\\(^" (regexp-quote (erc-prompt)) "\\)"))
|
|
|
|
(setq-local paragraph-start
|
|
|
|
(concat "\\(" (regexp-quote (erc-prompt)) "\\)"))
|
2016-02-06 14:13:57 +11:00
|
|
|
(setq-local completion-ignore-case t)
|
2023-09-11 09:32:44 +08:00
|
|
|
(add-hook 'post-command-hook #'erc-check-text-conversion nil t)
|
2021-10-27 21:13:24 -07:00
|
|
|
(add-hook 'kill-buffer-hook #'erc-kill-buffer-function nil t)
|
2021-01-04 00:21:02 -05:00
|
|
|
(add-hook 'completion-at-point-functions #'erc-complete-word-at-point nil t))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; activation
|
|
|
|
|
2021-07-03 23:39:18 -04:00
|
|
|
(defconst erc-default-server "irc.libera.chat"
|
2006-01-29 13:08:58 +00:00
|
|
|
"IRC server to use if it cannot be detected otherwise.")
|
|
|
|
|
2007-09-08 03:07:09 +00:00
|
|
|
(defconst erc-default-port 6667
|
2006-01-29 13:08:58 +00:00
|
|
|
"IRC port to use if it cannot be detected otherwise.")
|
|
|
|
|
2015-12-26 03:47:21 +01:00
|
|
|
(defconst erc-default-port-tls 6697
|
2021-09-14 08:43:18 +02:00
|
|
|
"IRC port to use for encrypted connections if it cannot be \
|
|
|
|
detected otherwise.")
|
2015-12-26 03:47:21 +01:00
|
|
|
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(defconst erc--buffer-display-choices
|
|
|
|
`(choice (const :tag "Use value of `erc-buffer-display'" nil)
|
|
|
|
(const :tag "Split window and select" window)
|
|
|
|
(const :tag "Split window but don't select" window-noselect)
|
|
|
|
(const :tag "New frame" frame)
|
|
|
|
(const :tag "Don't display" bury)
|
|
|
|
(const :tag "Use current window" buffer)
|
|
|
|
(choice :tag "Defer to a display function"
|
|
|
|
(function-item display-buffer)
|
|
|
|
(function-item pop-to-buffer)
|
|
|
|
(function :tag "User-defined")))
|
|
|
|
"Common choices for buffer-display options.")
|
|
|
|
|
Extend erc-interactive-display to cover /JOINs
* lisp/erc/erc.el (erc-display): Mention that buffer-related display
options live in the customization group `erc-buffers'.
(erc-buffer-display, erc-join-buffer): Swap alias and aliased so that
the favored name, `erc-buffer-display', appears in the definition and
in the Customize menu. Also note related buffer-display options in
the doc string.
(erc-query-display, erc-interactive-display): Make the former an alias
of the latter, new in ERC 5.6, because their roles were functionally
redundant and thus confusing. Inherit the default value from
`erc-query-display' because users are more familiar with the pop-up
window behavior than a single-window replacement.
(erc-reconnect-display): Use preferred name for cross-referencing
fallback option `erc-buffer-display' in doc string, and explain how
/reconnect handling differs.
(erc--setup-buffer-hook): Add new internal hook for modules that
operate on windows and frames, such as erc-speedbar and
erc-status-sidebar.
(erc-open): Run `erc--setup-buffer-hook' after `erc-setup-buffer' so
hook members know their code isn't tied to `erc-setup-buffer' itself,
which may be used in other contexts, but rather to a new ERC buffer on
which some display-related action has just been performed.
(erc--called-as-input-p): New variable for "slash" commands, like
`erc-cmd-FOO', to detect whether they're being called "interactively"
as a result of input given at ERC's prompt.
(erc-process-input-line): Bind `erc--called-as-input-p' when running
slash commands.
(erc-cmd-JOIN): When called interactively, schedule a callback to wrap
the response handler and control how new buffers are thus displayed.
(erc-cmd-QUERY): Use preferred alias for `erc-query-display'.
* test/lisp/erc/erc-scenarios-base-buffer-display.el:
(erc-scenarios-base-buffer-display--interactive-default): New test.
* test/lisp/erc/erc-tests.el (erc-process-input-line,
erc-select-read-args, erc-tls, erc--interactive): Change expected
default value of `erc-interactive-display' from `buffer' to
`window'. (Bug#62833)
2023-04-10 17:58:05 -07:00
|
|
|
(defvaralias 'erc-join-buffer 'erc-buffer-display)
|
|
|
|
(defcustom erc-buffer-display 'bury
|
|
|
|
"How to display a newly created ERC buffer.
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
This determines ERC's baseline, \"catch-all\" buffer-display
|
|
|
|
behavior. It takes a backseat to more specific options, like
|
|
|
|
`erc-interactive-display', `erc-auto-reconnect-display', and
|
|
|
|
`erc-receive-query-display'.
|
2008-01-25 03:28:10 +00:00
|
|
|
|
|
|
|
The available choices are:
|
|
|
|
|
Prefer directed to neutral quotes
Prefer directed to neutral quotes in docstings and diagnostics.
In docstrings, escape apostrophes that would otherwise be translated
to curved quotes using the newer, simpler rules.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-lang.el (math-read-giac-subscr)
(math-read-math-subscr):
* lisp/calc/calc-misc.el (report-calc-bug):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/dabbrev.el (dabbrev-expand):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/elint.el (elint-get-top-forms):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emulation/viper-cmd.el (viper-toggle-search-style):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-arg.el (eshell-parse-arguments):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/files-x.el (modify-file-local-variable):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer)
(filesets-update-pre010505):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/gnus/auth-source.el (auth-source-netrc-parse-entries):
* lisp/gnus/gnus-agent.el (gnus-agent-check-overview-buffer)
(gnus-agent-fetch-headers):
* lisp/gnus/gnus-int.el (gnus-start-news-server):
* lisp/gnus/gnus-registry.el:
(gnus-registry--split-fancy-with-parent-internal):
* lisp/gnus/gnus-score.el (gnus-summary-increase-score):
* lisp/gnus/gnus-start.el (gnus-convert-old-newsrc):
* lisp/gnus/gnus-topic.el (gnus-topic-rename):
* lisp/gnus/legacy-gnus-agent.el (gnus-agent-unlist-expire-days):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/gnus/spam.el (spam-check-blackholes):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/tramp-cache.el:
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-bibtex.el (org-bibtex-fields):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/play/dunnet.el (dun-score, dun-help, dun-endgame-question)
(dun-rooms, dun-endgame-questions):
* lisp/progmodes/ada-mode.el (ada-goto-matching-start):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/antlr-mode.el (antlr-options-alists):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/server.el (server-get-auth-key):
* lisp/subr.el (version-to-list):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/vc/ediff-diff.el (ediff-same-contents):
* lisp/vc/vc-cvs.el (vc-cvs-mode-line-string):
* test/automated/tramp-tests.el (tramp-test33-asynchronous-requests):
Use directed rather than neutral quotes in diagnostics.
2015-08-24 23:39:33 -07:00
|
|
|
`window' - in another window,
|
|
|
|
`window-noselect' - in another window, but don't select that one,
|
|
|
|
`frame' - in another frame,
|
|
|
|
`bury' - bury it in a new buffer,
|
|
|
|
`buffer' - in place of the current buffer,
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
DISPLAY-FUNCTION - a `display-buffer'-like function
|
|
|
|
|
|
|
|
Here, DISPLAY-FUNCTION should accept a buffer and an ACTION of
|
|
|
|
the kind described by the Info node `(elisp) Choosing Window'.
|
|
|
|
At times, ERC may add hints about the calling context to the
|
|
|
|
ACTION's alist. Keys are symbols such as user options, like
|
|
|
|
`erc-buffer-display', or module minor modes, like
|
|
|
|
`erc-autojoin-mode'. Values are non-nil constants specific to
|
|
|
|
each. For this particular option, possible values include the
|
|
|
|
symbols
|
|
|
|
|
|
|
|
`JOIN', `PRIVMSG', `NOTICE', `erc', and `erc-tls'.
|
|
|
|
|
|
|
|
The first three signify IRC commands received from the server and
|
|
|
|
the rest entry-point commands responsible for the connection.
|
|
|
|
When dealing with the latter two, users may prefer to set this
|
|
|
|
option to `bury' and instead call DISPLAY-FUNCTION directly
|
|
|
|
on (server) buffers returned by these entry points because the
|
|
|
|
context leading to their creation is plainly obvious. For
|
|
|
|
additional details, see the Info node `(erc) display-buffer'.
|
|
|
|
|
|
|
|
Note that when the selected window already shows the current
|
|
|
|
buffer, ERC pretends this option's value is `bury' unless the
|
|
|
|
variable `erc-skip-displaying-selected-window-buffer' is nil or
|
|
|
|
the value of this option is DISPLAY-FUNCTION."
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:package-version '(ERC . "5.5")
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-buffers
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
:type (cons 'choice (nthcdr 2 erc--buffer-display-choices)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Extend erc-interactive-display to cover /JOINs
* lisp/erc/erc.el (erc-display): Mention that buffer-related display
options live in the customization group `erc-buffers'.
(erc-buffer-display, erc-join-buffer): Swap alias and aliased so that
the favored name, `erc-buffer-display', appears in the definition and
in the Customize menu. Also note related buffer-display options in
the doc string.
(erc-query-display, erc-interactive-display): Make the former an alias
of the latter, new in ERC 5.6, because their roles were functionally
redundant and thus confusing. Inherit the default value from
`erc-query-display' because users are more familiar with the pop-up
window behavior than a single-window replacement.
(erc-reconnect-display): Use preferred name for cross-referencing
fallback option `erc-buffer-display' in doc string, and explain how
/reconnect handling differs.
(erc--setup-buffer-hook): Add new internal hook for modules that
operate on windows and frames, such as erc-speedbar and
erc-status-sidebar.
(erc-open): Run `erc--setup-buffer-hook' after `erc-setup-buffer' so
hook members know their code isn't tied to `erc-setup-buffer' itself,
which may be used in other contexts, but rather to a new ERC buffer on
which some display-related action has just been performed.
(erc--called-as-input-p): New variable for "slash" commands, like
`erc-cmd-FOO', to detect whether they're being called "interactively"
as a result of input given at ERC's prompt.
(erc-process-input-line): Bind `erc--called-as-input-p' when running
slash commands.
(erc-cmd-JOIN): When called interactively, schedule a callback to wrap
the response handler and control how new buffers are thus displayed.
(erc-cmd-QUERY): Use preferred alias for `erc-query-display'.
* test/lisp/erc/erc-scenarios-base-buffer-display.el:
(erc-scenarios-base-buffer-display--interactive-default): New test.
* test/lisp/erc/erc-tests.el (erc-process-input-line,
erc-select-read-args, erc-tls, erc--interactive): Change expected
default value of `erc-interactive-display' from `buffer' to
`window'. (Bug#62833)
2023-04-10 17:58:05 -07:00
|
|
|
(defvaralias 'erc-query-display 'erc-interactive-display)
|
|
|
|
(defcustom erc-interactive-display 'window
|
|
|
|
"How to display buffers as a result of user interaction.
|
|
|
|
This affects commands like /QUERY and /JOIN when issued
|
|
|
|
interactively at the prompt. It does not apply when calling a
|
|
|
|
handler for such a command, like `erc-cmd-JOIN', from lisp code.
|
|
|
|
See `erc-buffer-display' for a full description of available
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
values.
|
|
|
|
|
|
|
|
When the value is a user-provided function, ERC may inject a hint
|
|
|
|
about the invocation context as an extra item in the \"action
|
|
|
|
alist\" included as part of the second argument. The item's key
|
|
|
|
is the symbol `erc-interactive-display' and its value one of
|
|
|
|
|
|
|
|
`/QUERY', `/JOIN', `/RECONNECT', `url', `erc', or `erc-tls'.
|
|
|
|
|
|
|
|
All are symbols indicating an inciting user action, such as the
|
|
|
|
issuance of a slash command, the clicking of a URL hyperlink, or
|
|
|
|
the invocation of an entry-point command. See Info node `(erc)
|
|
|
|
display-buffer' for more."
|
2023-11-07 23:51:27 -08:00
|
|
|
:package-version '(ERC . "5.6")
|
2022-12-29 06:43:19 -08:00
|
|
|
:group 'erc-buffers
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
:type erc--buffer-display-choices)
|
|
|
|
|
|
|
|
(defvaralias 'erc-reconnect-display 'erc-auto-reconnect-display)
|
|
|
|
(defcustom erc-auto-reconnect-display nil
|
|
|
|
"How to display a channel buffer when automatically reconnecting.
|
|
|
|
ERC ignores this option when a user issues a /RECONNECT or
|
|
|
|
successfully reinvokes `erc-tls' with similar arguments to those
|
|
|
|
from the prior connection. See `erc-buffer-display' for a
|
|
|
|
description of possible values.
|
|
|
|
|
|
|
|
When the value is function, ERC may inject a hint about the
|
|
|
|
calling context as an extra item in the alist making up the tail
|
|
|
|
of the second, \"action\" argument. The item's key is the symbol
|
|
|
|
`erc-auto-reconnect-display' and its value something non-nil."
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:package-version '(ERC . "5.5")
|
2021-11-18 23:39:54 -08:00
|
|
|
:group 'erc-buffers
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
:type erc--buffer-display-choices)
|
|
|
|
|
|
|
|
(defcustom erc-auto-reconnect-display-timeout 10
|
|
|
|
"Duration `erc-auto-reconnect-display' remains active.
|
2023-04-20 19:20:59 -07:00
|
|
|
The countdown starts on MOTD and is canceled early by any
|
|
|
|
\"slash\" command."
|
2023-11-07 23:51:27 -08:00
|
|
|
:package-version '(ERC . "5.6")
|
2023-04-20 19:20:59 -07:00
|
|
|
:type 'integer
|
|
|
|
:group 'erc-buffers)
|
|
|
|
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(defcustom erc-reconnect-display-server-buffers nil
|
|
|
|
"Apply buffer-display options to server buffers when reconnecting.
|
|
|
|
By default, ERC does not consider `erc-auto-reconnect-display'
|
|
|
|
for server buffers when automatically reconnecting, nor does it
|
|
|
|
consider `erc-interactive-display' when users issue a /RECONNECT.
|
|
|
|
Enabling this tells ERC to always display server buffers
|
|
|
|
according to those options."
|
2023-11-07 23:51:27 -08:00
|
|
|
:package-version '(ERC . "5.6")
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
:type 'boolean
|
|
|
|
:group 'erc-buffers)
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defcustom erc-frame-alist nil
|
2012-04-09 21:05:48 +08:00
|
|
|
"Alist of frame parameters for creating erc frames.
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
A value of nil means to use `default-frame-alist'."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-buffers
|
|
|
|
:type '(repeat (cons :format "%v"
|
2014-11-08 20:51:43 -05:00
|
|
|
(symbol :tag "Parameter")
|
|
|
|
(sexp :tag "Value"))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defcustom erc-frame-dedicated-flag nil
|
2012-04-09 21:05:48 +08:00
|
|
|
"Non-nil means the erc frames are dedicated to that buffer.
|
2006-01-29 13:08:58 +00:00
|
|
|
This only has effect when `erc-join-buffer' is set to `frame'."
|
|
|
|
:group 'erc-buffers
|
|
|
|
:type 'boolean)
|
|
|
|
|
2007-09-08 03:07:09 +00:00
|
|
|
(defcustom erc-reuse-frames t
|
2012-04-09 21:05:48 +08:00
|
|
|
"Determines whether new frames are always created.
|
2023-06-19 23:14:40 -07:00
|
|
|
Non-nil means only create a frame for undisplayed buffers. Nil
|
|
|
|
means always create a new frame. Regardless of its value, ERC
|
|
|
|
ignores this option unless `erc-join-buffer' is `frame'. And
|
|
|
|
like most options in the `erc-buffer' customize group, this has
|
|
|
|
no effect on server buffers while reconnecting because ERC always
|
|
|
|
buries those."
|
2007-09-08 03:07:09 +00:00
|
|
|
:group 'erc-buffers
|
2023-06-19 23:14:40 -07:00
|
|
|
:type 'boolean)
|
2007-09-08 03:07:09 +00:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-channel-p (channel)
|
|
|
|
"Return non-nil if CHANNEL seems to be an IRC channel name."
|
|
|
|
(cond ((stringp channel)
|
2023-02-18 19:32:36 -08:00
|
|
|
(memq (aref channel 0)
|
|
|
|
(if-let ((types (erc--get-isupport-entry 'CHANTYPES 'single)))
|
|
|
|
(append types nil)
|
|
|
|
'(?# ?& ?+ ?!))))
|
|
|
|
((and-let* (((bufferp channel))
|
|
|
|
((buffer-live-p channel))
|
|
|
|
(target (buffer-local-value 'erc--target channel)))
|
|
|
|
(erc-channel-p (erc--target-string target))))
|
2014-11-08 20:51:43 -05:00
|
|
|
(t nil)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
;; For the sake of compatibility, a historical quirk concerning this
|
|
|
|
;; option, when nil, has been preserved: all buffers are suffixed with
|
|
|
|
;; the original dialed host name, which is usually something like
|
|
|
|
;; irc.libera.chat. Collisions are handled by adding a uniquifying
|
|
|
|
;; numeric suffix of the form <N>. Note that channel reassociation
|
|
|
|
;; behavior involving this option (when nil) was inverted in 28.1 (ERC
|
|
|
|
;; 5.4 and 5.4.1). This was regrettable and has since been undone.
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defcustom erc-reuse-buffers t
|
2012-04-09 21:05:48 +08:00
|
|
|
"If nil, create new buffers on joining a channel/query.
|
2006-01-29 13:08:58 +00:00
|
|
|
If non-nil, a new buffer will only be created when you join
|
|
|
|
channels with same names on different servers, or have query buffers
|
|
|
|
open with nicks of the same name on different servers. Otherwise,
|
|
|
|
the existing buffers will be reused."
|
|
|
|
:group 'erc-buffers
|
|
|
|
:type 'boolean)
|
|
|
|
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(make-obsolete-variable 'erc-reuse-buffers
|
|
|
|
"old behavior when t now permanent" "29.1")
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-normalize-port (port)
|
|
|
|
"Normalize the port specification PORT to integer form.
|
|
|
|
PORT may be an integer, a string or a symbol. If it is a string or a
|
|
|
|
symbol, it may have these values:
|
|
|
|
* irc -> 194
|
|
|
|
* ircs -> 994
|
|
|
|
* ircd -> 6667
|
|
|
|
* ircd-dalnet -> 7000"
|
2022-07-11 05:14:57 -07:00
|
|
|
;; These were updated somewhat in 2022 to reflect modern standards
|
|
|
|
;; and practices. See also:
|
|
|
|
;;
|
|
|
|
;; https://datatracker.ietf.org/doc/html/rfc7194#section-1
|
|
|
|
;; https://www.iana.org/assignments/service-names-port-numbers
|
2006-01-29 13:08:58 +00:00
|
|
|
(cond
|
|
|
|
((symbolp port)
|
|
|
|
(erc-normalize-port (symbol-name port)))
|
|
|
|
((stringp port)
|
|
|
|
(let ((port-nr (string-to-number port)))
|
|
|
|
(cond
|
|
|
|
((> port-nr 0)
|
2014-11-08 20:51:43 -05:00
|
|
|
port-nr)
|
2006-01-29 13:08:58 +00:00
|
|
|
((string-equal port "irc")
|
2014-11-08 20:51:43 -05:00
|
|
|
194)
|
2006-01-29 13:08:58 +00:00
|
|
|
((string-equal port "ircs")
|
2014-11-08 20:51:43 -05:00
|
|
|
994)
|
2022-07-11 05:14:57 -07:00
|
|
|
((string-equal port "ircu") 6667) ; 6665-6669
|
|
|
|
((string-equal port "ircd") ; nonstandard (irc-serv is 529)
|
2014-11-08 20:51:43 -05:00
|
|
|
6667)
|
2022-07-11 05:14:57 -07:00
|
|
|
((string-equal port "ircs-u") 6697)
|
2006-01-29 13:08:58 +00:00
|
|
|
((string-equal port "ircd-dalnet")
|
2014-11-08 20:51:43 -05:00
|
|
|
7000)
|
2006-01-29 13:08:58 +00:00
|
|
|
(t
|
2014-11-08 20:51:43 -05:00
|
|
|
nil))))
|
2006-01-29 13:08:58 +00:00
|
|
|
((numberp port)
|
|
|
|
port)
|
|
|
|
(t
|
|
|
|
nil)))
|
|
|
|
|
|
|
|
(defun erc-port-equal (a b)
|
|
|
|
"Check whether ports A and B are equal."
|
|
|
|
(= (erc-normalize-port a) (erc-normalize-port b)))
|
|
|
|
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(defun erc-generate-new-buffer-name (server port target &optional tgt-info id)
|
|
|
|
"Determine the name of an ERC buffer.
|
|
|
|
When TGT-INFO is nil, assume this is a server buffer. If ID is non-nil,
|
|
|
|
return ID as a string unless a buffer already exists with a live server
|
|
|
|
process, in which case signal an error. When ID is nil, return a
|
|
|
|
temporary name based on SERVER and PORT to be replaced with the network
|
|
|
|
name when discovered (see `erc-networks--rename-server-buffer'). Allow
|
|
|
|
either SERVER or PORT (but not both) to be nil to accommodate oddball
|
|
|
|
`erc-server-connect-function's.
|
|
|
|
|
|
|
|
When TGT-INFO is non-nil, expect its string field to match the redundant
|
|
|
|
param TARGET (retained for compatibility). Whenever possibly, prefer
|
|
|
|
returning TGT-INFO's string unmodified. But when a case-insensitive
|
|
|
|
collision prevents that, return target@ID when ID is non-nil or
|
|
|
|
target@network otherwise after renaming the conflicting buffer in the
|
|
|
|
same manner."
|
|
|
|
(when target ; compat
|
|
|
|
(setq tgt-info (erc--target-from-string target)))
|
|
|
|
(if tgt-info
|
2022-12-25 21:36:53 -08:00
|
|
|
(let* ((esid (and erc-networks--id
|
|
|
|
(erc-networks--id-symbol erc-networks--id)))
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(name (if esid
|
|
|
|
(erc-networks--reconcile-buffer-names tgt-info
|
|
|
|
erc-networks--id)
|
|
|
|
(erc--target-string tgt-info))))
|
|
|
|
(if (and esid (with-suppressed-warnings ((obsolete erc-reuse-buffers))
|
|
|
|
erc-reuse-buffers))
|
|
|
|
name
|
|
|
|
(generate-new-buffer-name name)))
|
|
|
|
(if (and (with-suppressed-warnings ((obsolete erc-reuse-buffers))
|
|
|
|
erc-reuse-buffers)
|
|
|
|
id)
|
2022-12-11 19:41:43 -08:00
|
|
|
(let ((string (symbol-name (erc-networks--id-symbol
|
|
|
|
(erc-networks--id-create id)))))
|
|
|
|
(when-let* ((buf (get-buffer string))
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
((erc-server-process-alive buf)))
|
2022-12-11 19:41:43 -08:00
|
|
|
(user-error "Session with ID %S already exists" string))
|
|
|
|
string)
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(generate-new-buffer-name (if (and server port)
|
|
|
|
(if (with-suppressed-warnings
|
|
|
|
((obsolete erc-reuse-buffers))
|
|
|
|
erc-reuse-buffers)
|
|
|
|
(format "%s:%s" server port)
|
|
|
|
(format "%s:%s/%s" server port server))
|
|
|
|
(or server port))))))
|
|
|
|
|
|
|
|
(defun erc-get-buffer-create (server port target &optional tgt-info id)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Create a new buffer based on the arguments."
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(when target ; compat
|
|
|
|
(setq tgt-info (erc--target-from-string target)))
|
|
|
|
(if (and erc--server-reconnecting
|
|
|
|
(not tgt-info)
|
|
|
|
(with-suppressed-warnings ((obsolete erc-reuse-buffers))
|
|
|
|
erc-reuse-buffers))
|
|
|
|
(current-buffer)
|
|
|
|
(get-buffer-create
|
|
|
|
(erc-generate-new-buffer-name server port nil tgt-info id))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-member-ignore-case (string list)
|
|
|
|
"Return non-nil if STRING is a member of LIST.
|
|
|
|
|
|
|
|
All strings are compared according to IRC protocol case rules, see
|
|
|
|
`erc-downcase'."
|
|
|
|
(setq string (erc-downcase string))
|
|
|
|
(catch 'result
|
|
|
|
(while list
|
|
|
|
(if (string= string (erc-downcase (car list)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(throw 'result list)
|
|
|
|
(setq list (cdr list))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-get-buffer (target &optional proc)
|
|
|
|
"Return the buffer matching TARGET in the process PROC.
|
2023-10-15 07:22:31 -07:00
|
|
|
Without PROC, search all ERC buffers. For historical reasons,
|
|
|
|
skip buffers for channels the client has \"PART\"ed or from which
|
|
|
|
it's been \"KICK\"ed. Expect users to use a different function
|
|
|
|
for finding targets independent of \"JOIN\"edness."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((downcased-target (erc-downcase target)))
|
|
|
|
(catch 'buffer
|
|
|
|
(erc-buffer-filter
|
|
|
|
(lambda ()
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((current (erc-default-target)))
|
|
|
|
(and (stringp current)
|
|
|
|
(string-equal downcased-target (erc-downcase current))
|
|
|
|
(throw 'buffer (current-buffer)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
proc))))
|
|
|
|
|
2015-03-16 14:49:01 -04:00
|
|
|
(defun erc--buffer-p (buf predicate proc)
|
|
|
|
(with-current-buffer buf
|
|
|
|
(and (derived-mode-p 'erc-mode)
|
|
|
|
(or (not proc)
|
|
|
|
(eq proc erc-server-process))
|
|
|
|
(funcall predicate)
|
|
|
|
buf)))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-buffer-filter (predicate &optional proc)
|
|
|
|
"Return a list of `erc-mode' buffers matching certain criteria.
|
2023-06-01 22:07:03 -07:00
|
|
|
Call PREDICATE without arguments in all ERC buffers or only those
|
|
|
|
belonging to a non-nil PROC. Expect it to return non-nil in
|
|
|
|
buffers that should be included in the returned list.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
PROC is either an `erc-server-process', identifying a certain
|
|
|
|
server connection, or nil which means all open connections."
|
|
|
|
(save-excursion
|
|
|
|
(delq
|
|
|
|
nil
|
|
|
|
(mapcar (lambda (buf)
|
2014-11-08 20:51:43 -05:00
|
|
|
(when (buffer-live-p buf)
|
2015-03-16 14:49:01 -04:00
|
|
|
(erc--buffer-p buf predicate proc)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(buffer-list)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-06-01 22:07:03 -07:00
|
|
|
(defalias 'erc-buffer-do 'erc-buffer-filter
|
|
|
|
"Call FUNCTION in all ERC buffers or only those for PROC.
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
Expect to be preferred over `erc-buffer-filter' in cases where
|
|
|
|
the return value goes unused.
|
2023-06-01 22:07:03 -07:00
|
|
|
|
|
|
|
\(fn FUNCTION &optional PROC)")
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-buffer-list (&optional predicate proc)
|
|
|
|
"Return a list of ERC buffers.
|
|
|
|
PREDICATE is a function which executes with every buffer satisfying
|
|
|
|
the predicate. If PREDICATE is passed as nil, return a list of all ERC
|
|
|
|
buffers. If PROC is given, the buffers local variable `erc-server-process'
|
|
|
|
needs to match PROC."
|
2023-06-01 22:07:03 -07:00
|
|
|
(erc-buffer-filter (or predicate #'always) proc))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(define-obsolete-function-alias 'erc-iswitchb #'erc-switch-to-buffer "25.1")
|
2020-04-13 23:21:34 -04:00
|
|
|
(defun erc--switch-to-buffer (&optional arg)
|
|
|
|
(read-buffer "Switch to ERC buffer: "
|
|
|
|
(when (boundp 'erc-modified-channels-alist)
|
|
|
|
(buffer-name (caar (last erc-modified-channels-alist))))
|
|
|
|
t
|
|
|
|
;; Only allow ERC buffers in the same session.
|
|
|
|
(let ((proc (unless arg erc-server-process)))
|
|
|
|
(lambda (bufname)
|
|
|
|
(let ((buf (if (consp bufname)
|
|
|
|
(cdr bufname) (get-buffer bufname))))
|
2022-01-28 23:12:42 -05:00
|
|
|
(and buf (erc--buffer-p buf (lambda () t) proc)))))))
|
2015-03-16 14:49:01 -04:00
|
|
|
(defun erc-switch-to-buffer (&optional arg)
|
2020-04-13 23:21:34 -04:00
|
|
|
"Prompt for an ERC buffer to switch to.
|
|
|
|
When invoked with prefix argument, use all ERC buffers. Without
|
|
|
|
prefix ARG, allow only buffers related to same session server.
|
2006-01-29 13:08:58 +00:00
|
|
|
If `erc-track-mode' is in enabled, put the last element of
|
2015-03-16 14:49:01 -04:00
|
|
|
`erc-modified-channels-alist' in front of the buffer list."
|
2006-01-29 13:08:58 +00:00
|
|
|
(interactive "P")
|
2020-04-13 23:21:34 -04:00
|
|
|
(switch-to-buffer (erc--switch-to-buffer arg)))
|
|
|
|
(defun erc-switch-to-buffer-other-window (&optional arg)
|
|
|
|
"Prompt for an ERC buffer to switch to in another window.
|
|
|
|
When invoked with prefix argument, use all ERC buffers. Without
|
|
|
|
prefix ARG, allow only buffers related to same session server.
|
|
|
|
If `erc-track-mode' is in enabled, put the last element of
|
|
|
|
`erc-modified-channels-alist' in front of the buffer list."
|
|
|
|
(interactive "P")
|
|
|
|
(switch-to-buffer-other-window (erc--switch-to-buffer arg)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-channel-list (proc)
|
|
|
|
"Return a list of channel buffers.
|
|
|
|
PROC is the process for the server connection. If PROC is nil, return
|
|
|
|
all channel buffers on all servers."
|
|
|
|
(erc-buffer-filter
|
|
|
|
(lambda ()
|
|
|
|
(and (erc-default-target)
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-channel-p (erc-default-target))))
|
2006-01-29 13:08:58 +00:00
|
|
|
proc))
|
|
|
|
|
|
|
|
(defun erc-buffer-list-with-nick (nick proc)
|
|
|
|
"Return buffers containing NICK in the `erc-channel-users' list."
|
|
|
|
(with-current-buffer (process-buffer proc)
|
|
|
|
(let ((user (gethash (erc-downcase nick) erc-server-users)))
|
|
|
|
(if user
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-server-user-buffers user)
|
|
|
|
nil))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; Some local variables
|
|
|
|
|
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.
2021-10-20 03:52:18 -07:00
|
|
|
;; TODO eventually deprecate this variable
|
|
|
|
;;
|
|
|
|
;; In the ancient, pre-CVS days (prior to June 2001), this list may
|
|
|
|
;; have been used for supporting the changing of a buffer's target on
|
|
|
|
;; the fly (mid-session). Such usage, which allowed cons cells like
|
|
|
|
;; (QUERY . bob) to serve as the list's head, was either never fully
|
|
|
|
;; integrated or was partially clobbered prior to the introduction of
|
|
|
|
;; version control. But vestiges remain (see `erc-dcc-chat-mode').
|
|
|
|
;; And despite appearances, no evidence has emerged that ERC ever
|
|
|
|
;; supported one-to-many target buffers. If such a thing was aspired
|
|
|
|
;; to, it was never realized.
|
|
|
|
;;
|
|
|
|
;; New library code should use the `erc--target' struct instead.
|
2022-12-11 19:16:07 -08:00
|
|
|
;; Third-party code can continue to use this and `erc-default-target'.
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-default-recipients nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"List of default recipients of the current buffer.")
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-channel-user-limit nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"Limit of users per channel.")
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-channel-key nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"Key needed to join channel.")
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-invitation nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"Last invitation channel.")
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-away nil
|
2007-04-01 13:36:38 +00:00
|
|
|
"Non-nil indicates that we are away.
|
|
|
|
|
|
|
|
Use `erc-away-time' to access this if you might be in a channel
|
|
|
|
buffer rather than a server buffer.")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-channel-list nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"Server channel list.")
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-bad-nick nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"Non-nil indicates that we got a `nick in use' error while connecting.")
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-logged-in nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"Non-nil indicates that we are logged in.")
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-default-nicks nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"The local copy of `erc-nick' - the list of nicks to choose from.")
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-nick-change-attempt-count 0
|
2006-01-29 13:08:58 +00:00
|
|
|
"Used to keep track of how many times an attempt at changing nick is made.")
|
|
|
|
|
2006-02-08 02:41:23 +00:00
|
|
|
(defun erc-migrate-modules (mods)
|
|
|
|
"Migrate old names of ERC modules to new ones."
|
|
|
|
;; modify `transforms' to specify what needs to be changed
|
2006-02-12 12:02:53 +00:00
|
|
|
;; each item is in the format '(old . new)
|
2021-07-12 03:44:28 -07:00
|
|
|
(delete-dups (mapcar #'erc--normalize-module-symbol mods)))
|
2006-02-12 12:02:53 +00:00
|
|
|
|
Sort and dedupe when loading modules in erc-open
* doc/misc/erc.texi: Add new subheading "Module Loading" under the
"Modules" chapter.
* lisp/erc/erc.el (erc--sort-modules): New utility function to sort
and dedupe modules.
(erc-modules): In `custom-set' function, factor out collation into
separate utility `erc--sort-modules'.
(erc-update-modules): Call `erc--update-modules' with an argument, the
current value of `erc-modules'.
(erc--aberrant-modules): New variable, a list of symbols whose modules
ERC suspects of being incorrectly defined.
(erc--warn-about-aberrant-modules): New function to print an error
message and emit a warning prior to connecting when
`erc--aberrant-modules' is non-nil.
(erc--find-mode): Make heuristic more robust by always checking for a
mode activation command rather than just a state variable. This fixes
a compatibility bug, new in 5.6, affecting third-party modules that
autoload module definitions instead of their corresponding
mode-activation commands.
(erc--update-modules): Add new positional argument `modules'.
(erc--setup-buffer-hook): Add new default member,
`erc--warn-about-aberrant-modules'.
(erc-open): Pass sorted `erc-modules' to `erc--update-modules'.
* test/lisp/erc/erc-tests.el (erc--sort-modules): New test.
(erc-tests--update-modules): New fixture.
(erc--update-modules): Remove and rework as three separate tests
dedicated to specific contexts. The existing one had poor coverage
and was difficult, if not impossible, to follow.
(erc--update-modules/unknown, erc--update-modules/local,
erc--update-modules/realistic): New tests. (Bug#57955)
2023-10-06 17:34:04 -07:00
|
|
|
(defun erc--sort-modules (modules)
|
|
|
|
"Return a copy of MODULES, deduped and led by sorted built-ins."
|
|
|
|
(let (built-in third-party)
|
|
|
|
(dolist (mod modules)
|
|
|
|
(setq mod (erc--normalize-module-symbol mod))
|
|
|
|
(cl-pushnew mod (if (get mod 'erc--module) built-in third-party)))
|
|
|
|
`(,@(sort built-in #'string-lessp) ,@(nreverse third-party))))
|
|
|
|
|
2023-01-19 21:07:27 -08:00
|
|
|
(defcustom erc-modules '( autojoin button completion fill imenu irccontrols
|
2023-02-04 06:24:59 -08:00
|
|
|
list match menu move-to-prompt netsplit
|
Revive erc-command-indicator as new module
* doc/misc/erc.texi: Add entry for `command-indicator' to Modules
chapter.
* etc/ERC-NEWS: Mention new module `command-indicator'.
* lisp/erc/erc-goodies.el (erc-noncommands-list): Replace the
nonexistent `erc-cmd-SMV' with function `erc-cmd-SAY'.
(erc-noncommands-mode, erc-noncommands-enable,
erc-noncommands-disable): Deprecate this module because it's a no-op.
(erc-command-indicator-face, erc-command-indicator): Migrate from main
library.
(erc-command-indicator-mode, erc-command-indicator-enable,
erc-command-indicator-disable): New module to take the spiritual place
of `noncommands'.
(erc-command-indicator): Move function here from main library, along
with option namesake mentioned above.
(erc-command-indicator-toggle-hidden): New command to toggle echoed
command-line visibility.
(erc--command-indicator-permit-insertion): New function.
(erc--command-indicator-display): New function, a slightly revised
version of the old `erc-display-command' from the main library. Its
only call site was removed back in d1036d288de "backport: erc
bugfixes". However, references were left behind to associated assets,
like `erc-command-indicator', etc. The function was later commented
out in 0c599ee2e2c "* lisp/erc/erc.el: Use `run-hook-with-args` for
`erc-pre-send-functions`", and then removed by a63ed6f78a6 "Remove
duplicate ERC prompt on reconnect".
* lisp/erc/erc-match.el (erc-match-toggle-hidden-fools): Use new
non-module-specific name for `erc-match--toggle-hidden'.
(erc-match--toggle-hidden): Move to main library for shared use by
other modules.
* lisp/erc/erc.el (erc-hide-prompt): Leave note explaining updated
role.
(erc-command-indicator): Move option and function of same name to
erc-goodies.
(erc-command-indicator-face): Move to erc-goodies.
(erc-modules): Remove module `noncommands' from standard value and
Custom set. Add `command-indicator' to set.
(erc--toggle-hidden): "New" function, a rebranded version of the
utility `erc-match--toggle-hidden' from erc-match.
(erc--send-input-lines): Accommodate modules wanting alternate
insertion functions.
(erc-load-irc-script-lines): Account for `erc-command-indicator' no
longer being defined in this library.
* test/lisp/erc/erc-scenarios-base-send-message.el
(erc-scenarios-base-send-message--command-indicator): New test.
* test/lisp/erc/erc-tests.el (erc-tests--modules): Remove
deprecated module `noncommands' from manifest. (Bug#67031)
2023-11-10 13:34:31 -08:00
|
|
|
networks readonly ring stamp track)
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
"A list of modules which ERC should enable.
|
2006-01-29 13:08:58 +00:00
|
|
|
If you set the value of this without using `customize' remember to call
|
|
|
|
\(erc-update-modules) after you change it. When using `customize', modules
|
|
|
|
removed from the list will be disabled."
|
2006-02-08 02:41:23 +00:00
|
|
|
:get (lambda (sym)
|
2014-11-08 20:51:43 -05:00
|
|
|
;; replace outdated names with their newer equivalents
|
|
|
|
(erc-migrate-modules (symbol-value sym)))
|
2023-02-04 06:24:59 -08:00
|
|
|
;; Expect every built-in module to have the symbol property
|
|
|
|
;; `erc--module' set to its canonical symbol (often itself).
|
|
|
|
:initialize (lambda (symbol exp)
|
|
|
|
;; Use `cdddr' because (set :greedy t . ,entries)
|
|
|
|
(dolist (entry (cdddr (get 'erc-modules 'custom-type)))
|
|
|
|
(when-let* (((eq (car entry) 'const))
|
|
|
|
(s (cadddr entry))) ; (const :tag "..." ,s)
|
|
|
|
(put s 'erc--module s)))
|
|
|
|
(custom-initialize-reset symbol exp))
|
2006-01-29 13:08:58 +00:00
|
|
|
:set (lambda (sym val)
|
2014-11-08 20:51:43 -05:00
|
|
|
;; disable modules which have just been removed
|
|
|
|
(when (and (boundp 'erc-modules) erc-modules val)
|
|
|
|
(dolist (module erc-modules)
|
2023-02-04 06:24:59 -08:00
|
|
|
(unless (memq module val)
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((f (intern-soft (format "erc-%s-mode" module))))
|
2021-07-12 03:44:28 -07:00
|
|
|
(when (and (fboundp f) (boundp f))
|
|
|
|
(when (symbol-value f)
|
|
|
|
(message "Disabling `erc-%s'" module)
|
|
|
|
(funcall f 0))
|
2023-10-17 23:36:12 -07:00
|
|
|
;; Disable local module in all ERC buffers.
|
2021-07-12 03:44:28 -07:00
|
|
|
(unless (or (custom-variable-p f)
|
|
|
|
(not (fboundp 'erc-buffer-filter)))
|
|
|
|
(erc-buffer-filter (lambda ()
|
|
|
|
(when (symbol-value f)
|
|
|
|
(funcall f 0))
|
|
|
|
(kill-local-variable f)))))))))
|
Sort and dedupe when loading modules in erc-open
* doc/misc/erc.texi: Add new subheading "Module Loading" under the
"Modules" chapter.
* lisp/erc/erc.el (erc--sort-modules): New utility function to sort
and dedupe modules.
(erc-modules): In `custom-set' function, factor out collation into
separate utility `erc--sort-modules'.
(erc-update-modules): Call `erc--update-modules' with an argument, the
current value of `erc-modules'.
(erc--aberrant-modules): New variable, a list of symbols whose modules
ERC suspects of being incorrectly defined.
(erc--warn-about-aberrant-modules): New function to print an error
message and emit a warning prior to connecting when
`erc--aberrant-modules' is non-nil.
(erc--find-mode): Make heuristic more robust by always checking for a
mode activation command rather than just a state variable. This fixes
a compatibility bug, new in 5.6, affecting third-party modules that
autoload module definitions instead of their corresponding
mode-activation commands.
(erc--update-modules): Add new positional argument `modules'.
(erc--setup-buffer-hook): Add new default member,
`erc--warn-about-aberrant-modules'.
(erc-open): Pass sorted `erc-modules' to `erc--update-modules'.
* test/lisp/erc/erc-tests.el (erc--sort-modules): New test.
(erc-tests--update-modules): New fixture.
(erc--update-modules): Remove and rework as three separate tests
dedicated to specific contexts. The existing one had poor coverage
and was difficult, if not impossible, to follow.
(erc--update-modules/unknown, erc--update-modules/local,
erc--update-modules/realistic): New tests. (Bug#57955)
2023-10-06 17:34:04 -07:00
|
|
|
;; Calling `set-default-toplevel-value' complicates testing.
|
|
|
|
(set sym (erc--sort-modules val))
|
2023-10-17 23:36:12 -07:00
|
|
|
;; Don't initialize modules on load, even though the rare
|
|
|
|
;; third-party module may need it.
|
2014-11-08 20:51:43 -05:00
|
|
|
(when (fboundp 'erc-update-modules)
|
2023-01-14 19:08:11 -08:00
|
|
|
(unless erc--inside-mode-toggle-p
|
|
|
|
(erc-update-modules))))
|
2006-02-12 12:02:53 +00:00
|
|
|
:type
|
|
|
|
'(set
|
|
|
|
:greedy t
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "autoaway: Set away status automatically" autoaway)
|
|
|
|
(const :tag "autojoin: Join channels automatically" autojoin)
|
2023-05-04 00:01:11 -07:00
|
|
|
(const :tag "bufbar: Show ERC buffers in a side window" bufbar)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "button: Buttonize URLs, nicknames, and other text" button)
|
|
|
|
(const :tag "capab: Mark unidentified users on servers supporting CAPAB"
|
2014-11-08 20:51:43 -05:00
|
|
|
capab-identify)
|
Revive erc-command-indicator as new module
* doc/misc/erc.texi: Add entry for `command-indicator' to Modules
chapter.
* etc/ERC-NEWS: Mention new module `command-indicator'.
* lisp/erc/erc-goodies.el (erc-noncommands-list): Replace the
nonexistent `erc-cmd-SMV' with function `erc-cmd-SAY'.
(erc-noncommands-mode, erc-noncommands-enable,
erc-noncommands-disable): Deprecate this module because it's a no-op.
(erc-command-indicator-face, erc-command-indicator): Migrate from main
library.
(erc-command-indicator-mode, erc-command-indicator-enable,
erc-command-indicator-disable): New module to take the spiritual place
of `noncommands'.
(erc-command-indicator): Move function here from main library, along
with option namesake mentioned above.
(erc-command-indicator-toggle-hidden): New command to toggle echoed
command-line visibility.
(erc--command-indicator-permit-insertion): New function.
(erc--command-indicator-display): New function, a slightly revised
version of the old `erc-display-command' from the main library. Its
only call site was removed back in d1036d288de "backport: erc
bugfixes". However, references were left behind to associated assets,
like `erc-command-indicator', etc. The function was later commented
out in 0c599ee2e2c "* lisp/erc/erc.el: Use `run-hook-with-args` for
`erc-pre-send-functions`", and then removed by a63ed6f78a6 "Remove
duplicate ERC prompt on reconnect".
* lisp/erc/erc-match.el (erc-match-toggle-hidden-fools): Use new
non-module-specific name for `erc-match--toggle-hidden'.
(erc-match--toggle-hidden): Move to main library for shared use by
other modules.
* lisp/erc/erc.el (erc-hide-prompt): Leave note explaining updated
role.
(erc-command-indicator): Move option and function of same name to
erc-goodies.
(erc-command-indicator-face): Move to erc-goodies.
(erc-modules): Remove module `noncommands' from standard value and
Custom set. Add `command-indicator' to set.
(erc--toggle-hidden): "New" function, a rebranded version of the
utility `erc-match--toggle-hidden' from erc-match.
(erc--send-input-lines): Accommodate modules wanting alternate
insertion functions.
(erc-load-irc-script-lines): Account for `erc-command-indicator' no
longer being defined in this library.
* test/lisp/erc/erc-scenarios-base-send-message.el
(erc-scenarios-base-send-message--command-indicator): New test.
* test/lisp/erc/erc-tests.el (erc-tests--modules): Remove
deprecated module `noncommands' from manifest. (Bug#67031)
2023-11-10 13:34:31 -08:00
|
|
|
(const :tag "command-indicator: Echo command lines." command-indicator)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "completion: Complete nicknames and commands (programmable)"
|
2014-11-08 20:51:43 -05:00
|
|
|
completion)
|
2008-01-25 03:28:10 +00:00
|
|
|
(const :tag "dcc: Provide Direct Client-to-Client support" dcc)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "fill: Wrap long lines" fill)
|
|
|
|
(const :tag "identd: Launch an identd server on port 8113" identd)
|
2023-01-19 21:07:27 -08:00
|
|
|
(const :tag "imenu: A simple Imenu integration" imenu)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "irccontrols: Highlight or remove IRC control characters"
|
2014-11-08 20:51:43 -05:00
|
|
|
irccontrols)
|
2008-01-25 03:28:10 +00:00
|
|
|
(const :tag "keep-place: Leave point above un-viewed text" keep-place)
|
|
|
|
(const :tag "list: List channels in a separate buffer" list)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "log: Save buffers in logs" log)
|
|
|
|
(const :tag "match: Highlight pals, fools, and other keywords" match)
|
|
|
|
(const :tag "menu: Display a menu in ERC buffers" menu)
|
2008-01-25 03:28:10 +00:00
|
|
|
(const :tag "move-to-prompt: Move to the prompt when typing text"
|
2014-11-08 20:51:43 -05:00
|
|
|
move-to-prompt)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "netsplit: Detect netsplits" netsplit)
|
2008-01-25 03:28:10 +00:00
|
|
|
(const :tag "networks: Provide data about IRC networks" networks)
|
2023-12-10 14:05:34 +01:00
|
|
|
(const :tag "nickbar: Show nicknames in a dynamic side window" nickbar)
|
2022-12-18 19:01:40 -08:00
|
|
|
(const :tag "nicks: Uniquely colorize nicknames in target buffers" nicks)
|
Revive erc-command-indicator as new module
* doc/misc/erc.texi: Add entry for `command-indicator' to Modules
chapter.
* etc/ERC-NEWS: Mention new module `command-indicator'.
* lisp/erc/erc-goodies.el (erc-noncommands-list): Replace the
nonexistent `erc-cmd-SMV' with function `erc-cmd-SAY'.
(erc-noncommands-mode, erc-noncommands-enable,
erc-noncommands-disable): Deprecate this module because it's a no-op.
(erc-command-indicator-face, erc-command-indicator): Migrate from main
library.
(erc-command-indicator-mode, erc-command-indicator-enable,
erc-command-indicator-disable): New module to take the spiritual place
of `noncommands'.
(erc-command-indicator): Move function here from main library, along
with option namesake mentioned above.
(erc-command-indicator-toggle-hidden): New command to toggle echoed
command-line visibility.
(erc--command-indicator-permit-insertion): New function.
(erc--command-indicator-display): New function, a slightly revised
version of the old `erc-display-command' from the main library. Its
only call site was removed back in d1036d288de "backport: erc
bugfixes". However, references were left behind to associated assets,
like `erc-command-indicator', etc. The function was later commented
out in 0c599ee2e2c "* lisp/erc/erc.el: Use `run-hook-with-args` for
`erc-pre-send-functions`", and then removed by a63ed6f78a6 "Remove
duplicate ERC prompt on reconnect".
* lisp/erc/erc-match.el (erc-match-toggle-hidden-fools): Use new
non-module-specific name for `erc-match--toggle-hidden'.
(erc-match--toggle-hidden): Move to main library for shared use by
other modules.
* lisp/erc/erc.el (erc-hide-prompt): Leave note explaining updated
role.
(erc-command-indicator): Move option and function of same name to
erc-goodies.
(erc-command-indicator-face): Move to erc-goodies.
(erc-modules): Remove module `noncommands' from standard value and
Custom set. Add `command-indicator' to set.
(erc--toggle-hidden): "New" function, a rebranded version of the
utility `erc-match--toggle-hidden' from erc-match.
(erc--send-input-lines): Accommodate modules wanting alternate
insertion functions.
(erc-load-irc-script-lines): Account for `erc-command-indicator' no
longer being defined in this library.
* test/lisp/erc/erc-scenarios-base-send-message.el
(erc-scenarios-base-send-message--command-indicator): New test.
* test/lisp/erc/erc-tests.el (erc-tests--modules): Remove
deprecated module `noncommands' from manifest. (Bug#67031)
2023-11-10 13:34:31 -08:00
|
|
|
(const :tag "noncommands: Deprecated. See module `command-indicator'."
|
2014-11-08 20:51:43 -05:00
|
|
|
noncommands)
|
2023-02-04 06:24:59 -08:00
|
|
|
(const :tag "notifications: Desktop alerts on PRIVMSG or mentions"
|
|
|
|
notifications)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag
|
2014-11-08 20:51:43 -05:00
|
|
|
"notify: Notify when the online status of certain users changes"
|
|
|
|
notify)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "page: Process CTCP PAGE requests from IRC" page)
|
|
|
|
(const :tag "readonly: Make displayed lines read-only" readonly)
|
|
|
|
(const :tag "replace: Replace text in messages" replace)
|
|
|
|
(const :tag "ring: Enable an input history" ring)
|
2021-07-12 03:44:28 -07:00
|
|
|
(const :tag "sasl: Enable SASL authentication" sasl)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "scrolltobottom: Scroll to the bottom of the buffer"
|
2014-11-08 20:51:43 -05:00
|
|
|
scrolltobottom)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "services: Identify to Nickserv (IRC Services) automatically"
|
2014-11-08 20:51:43 -05:00
|
|
|
services)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "smiley: Convert smileys to pretty icons" smiley)
|
|
|
|
(const :tag "sound: Play sounds when you receive CTCP SOUND requests"
|
2014-11-08 20:51:43 -05:00
|
|
|
sound)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "spelling: Check spelling" spelling)
|
2023-02-04 06:24:59 -08:00
|
|
|
(const :tag "stamp: Add timestamps to messages" stamp)
|
2007-04-01 13:36:38 +00:00
|
|
|
(const :tag "track: Track channel activity in the mode-line" track)
|
|
|
|
(const :tag "truncate: Truncate buffers to a certain size" truncate)
|
|
|
|
(const :tag "unmorse: Translate morse code in messages" unmorse)
|
2008-01-25 03:28:10 +00:00
|
|
|
(const :tag "xdcc: Act as an XDCC file-server" xdcc)
|
2006-02-12 12:02:53 +00:00
|
|
|
(repeat :tag "Others" :inline t symbol))
|
2023-11-07 23:51:27 -08:00
|
|
|
:package-version '(ERC . "5.6")
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc)
|
|
|
|
|
|
|
|
(defun erc-update-modules ()
|
2021-07-12 03:44:28 -07:00
|
|
|
"Enable minor mode for every module in `erc-modules'.
|
|
|
|
Except ignore all local modules, which were introduced in ERC 5.5."
|
Sort and dedupe when loading modules in erc-open
* doc/misc/erc.texi: Add new subheading "Module Loading" under the
"Modules" chapter.
* lisp/erc/erc.el (erc--sort-modules): New utility function to sort
and dedupe modules.
(erc-modules): In `custom-set' function, factor out collation into
separate utility `erc--sort-modules'.
(erc-update-modules): Call `erc--update-modules' with an argument, the
current value of `erc-modules'.
(erc--aberrant-modules): New variable, a list of symbols whose modules
ERC suspects of being incorrectly defined.
(erc--warn-about-aberrant-modules): New function to print an error
message and emit a warning prior to connecting when
`erc--aberrant-modules' is non-nil.
(erc--find-mode): Make heuristic more robust by always checking for a
mode activation command rather than just a state variable. This fixes
a compatibility bug, new in 5.6, affecting third-party modules that
autoload module definitions instead of their corresponding
mode-activation commands.
(erc--update-modules): Add new positional argument `modules'.
(erc--setup-buffer-hook): Add new default member,
`erc--warn-about-aberrant-modules'.
(erc-open): Pass sorted `erc-modules' to `erc--update-modules'.
* test/lisp/erc/erc-tests.el (erc--sort-modules): New test.
(erc-tests--update-modules): New fixture.
(erc--update-modules): Remove and rework as three separate tests
dedicated to specific contexts. The existing one had poor coverage
and was difficult, if not impossible, to follow.
(erc--update-modules/unknown, erc--update-modules/local,
erc--update-modules/realistic): New tests. (Bug#57955)
2023-10-06 17:34:04 -07:00
|
|
|
(erc--update-modules erc-modules)
|
2021-07-12 03:44:28 -07:00
|
|
|
nil)
|
|
|
|
|
Sort and dedupe when loading modules in erc-open
* doc/misc/erc.texi: Add new subheading "Module Loading" under the
"Modules" chapter.
* lisp/erc/erc.el (erc--sort-modules): New utility function to sort
and dedupe modules.
(erc-modules): In `custom-set' function, factor out collation into
separate utility `erc--sort-modules'.
(erc-update-modules): Call `erc--update-modules' with an argument, the
current value of `erc-modules'.
(erc--aberrant-modules): New variable, a list of symbols whose modules
ERC suspects of being incorrectly defined.
(erc--warn-about-aberrant-modules): New function to print an error
message and emit a warning prior to connecting when
`erc--aberrant-modules' is non-nil.
(erc--find-mode): Make heuristic more robust by always checking for a
mode activation command rather than just a state variable. This fixes
a compatibility bug, new in 5.6, affecting third-party modules that
autoload module definitions instead of their corresponding
mode-activation commands.
(erc--update-modules): Add new positional argument `modules'.
(erc--setup-buffer-hook): Add new default member,
`erc--warn-about-aberrant-modules'.
(erc-open): Pass sorted `erc-modules' to `erc--update-modules'.
* test/lisp/erc/erc-tests.el (erc--sort-modules): New test.
(erc-tests--update-modules): New fixture.
(erc--update-modules): Remove and rework as three separate tests
dedicated to specific contexts. The existing one had poor coverage
and was difficult, if not impossible, to follow.
(erc--update-modules/unknown, erc--update-modules/local,
erc--update-modules/realistic): New tests. (Bug#57955)
2023-10-06 17:34:04 -07:00
|
|
|
(defvar erc--aberrant-modules nil
|
|
|
|
"Modules suspected of being improperly loaded.")
|
|
|
|
|
|
|
|
(defun erc--warn-about-aberrant-modules ()
|
|
|
|
(when (and erc--aberrant-modules (not erc--target))
|
|
|
|
(erc-button--display-error-notice-with-keys-and-warn
|
2023-10-17 23:36:12 -07:00
|
|
|
"The following modules likely engage in unfavorable loading practices: "
|
Sort and dedupe when loading modules in erc-open
* doc/misc/erc.texi: Add new subheading "Module Loading" under the
"Modules" chapter.
* lisp/erc/erc.el (erc--sort-modules): New utility function to sort
and dedupe modules.
(erc-modules): In `custom-set' function, factor out collation into
separate utility `erc--sort-modules'.
(erc-update-modules): Call `erc--update-modules' with an argument, the
current value of `erc-modules'.
(erc--aberrant-modules): New variable, a list of symbols whose modules
ERC suspects of being incorrectly defined.
(erc--warn-about-aberrant-modules): New function to print an error
message and emit a warning prior to connecting when
`erc--aberrant-modules' is non-nil.
(erc--find-mode): Make heuristic more robust by always checking for a
mode activation command rather than just a state variable. This fixes
a compatibility bug, new in 5.6, affecting third-party modules that
autoload module definitions instead of their corresponding
mode-activation commands.
(erc--update-modules): Add new positional argument `modules'.
(erc--setup-buffer-hook): Add new default member,
`erc--warn-about-aberrant-modules'.
(erc-open): Pass sorted `erc-modules' to `erc--update-modules'.
* test/lisp/erc/erc-tests.el (erc--sort-modules): New test.
(erc-tests--update-modules): New fixture.
(erc--update-modules): Remove and rework as three separate tests
dedicated to specific contexts. The existing one had poor coverage
and was difficult, if not impossible, to follow.
(erc--update-modules/unknown, erc--update-modules/local,
erc--update-modules/realistic): New tests. (Bug#57955)
2023-10-06 17:34:04 -07:00
|
|
|
(mapconcat (lambda (s) (format "`%s'" s)) erc--aberrant-modules ", ")
|
|
|
|
". Please contact ERC with \\[erc-bug] if you believe this to be untrue."
|
|
|
|
" See Info:\"(erc) Module Loading\" for more.")
|
|
|
|
(setq erc--aberrant-modules nil)))
|
|
|
|
|
2023-10-17 23:36:12 -07:00
|
|
|
(defvar erc--requiring-module-mode-p nil
|
|
|
|
"Non-nil while doing (require \\='erc-mymod) for `mymod' in `erc-modules'.
|
|
|
|
Used for inhibiting potentially recursive `erc-update-modules'
|
|
|
|
invocations by third-party packages.")
|
|
|
|
|
2023-02-04 06:24:59 -08:00
|
|
|
(defun erc--find-mode (sym)
|
|
|
|
(setq sym (erc--normalize-module-symbol sym))
|
Sort and dedupe when loading modules in erc-open
* doc/misc/erc.texi: Add new subheading "Module Loading" under the
"Modules" chapter.
* lisp/erc/erc.el (erc--sort-modules): New utility function to sort
and dedupe modules.
(erc-modules): In `custom-set' function, factor out collation into
separate utility `erc--sort-modules'.
(erc-update-modules): Call `erc--update-modules' with an argument, the
current value of `erc-modules'.
(erc--aberrant-modules): New variable, a list of symbols whose modules
ERC suspects of being incorrectly defined.
(erc--warn-about-aberrant-modules): New function to print an error
message and emit a warning prior to connecting when
`erc--aberrant-modules' is non-nil.
(erc--find-mode): Make heuristic more robust by always checking for a
mode activation command rather than just a state variable. This fixes
a compatibility bug, new in 5.6, affecting third-party modules that
autoload module definitions instead of their corresponding
mode-activation commands.
(erc--update-modules): Add new positional argument `modules'.
(erc--setup-buffer-hook): Add new default member,
`erc--warn-about-aberrant-modules'.
(erc-open): Pass sorted `erc-modules' to `erc--update-modules'.
* test/lisp/erc/erc-tests.el (erc--sort-modules): New test.
(erc-tests--update-modules): New fixture.
(erc--update-modules): Remove and rework as three separate tests
dedicated to specific contexts. The existing one had poor coverage
and was difficult, if not impossible, to follow.
(erc--update-modules/unknown, erc--update-modules/local,
erc--update-modules/realistic): New tests. (Bug#57955)
2023-10-06 17:34:04 -07:00
|
|
|
(if-let ((mode (intern-soft (concat "erc-" (symbol-name sym) "-mode")))
|
|
|
|
((and (fboundp mode)
|
|
|
|
(autoload-do-load (symbol-function mode) mode)))
|
|
|
|
((or (get sym 'erc--module)
|
|
|
|
(symbol-file mode)
|
|
|
|
(ignore (cl-pushnew sym erc--aberrant-modules)))))
|
2023-02-04 06:24:59 -08:00
|
|
|
mode
|
2023-10-17 23:36:12 -07:00
|
|
|
(and (or (and erc--requiring-module-mode-p
|
|
|
|
;; Also likely non-nil: (eq sym (car features))
|
|
|
|
(cl-pushnew sym erc--aberrant-modules))
|
|
|
|
(let ((erc--requiring-module-mode-p t))
|
|
|
|
(require (or (get sym 'erc--feature)
|
|
|
|
(intern (concat "erc-" (symbol-name sym))))
|
|
|
|
nil 'noerror))
|
|
|
|
(memq sym erc--aberrant-modules))
|
|
|
|
(or mode (setq mode (intern-soft (concat "erc-" (symbol-name sym)
|
|
|
|
"-mode"))))
|
2023-02-04 06:24:59 -08:00
|
|
|
(fboundp mode)
|
|
|
|
mode)))
|
|
|
|
|
Sort and dedupe when loading modules in erc-open
* doc/misc/erc.texi: Add new subheading "Module Loading" under the
"Modules" chapter.
* lisp/erc/erc.el (erc--sort-modules): New utility function to sort
and dedupe modules.
(erc-modules): In `custom-set' function, factor out collation into
separate utility `erc--sort-modules'.
(erc-update-modules): Call `erc--update-modules' with an argument, the
current value of `erc-modules'.
(erc--aberrant-modules): New variable, a list of symbols whose modules
ERC suspects of being incorrectly defined.
(erc--warn-about-aberrant-modules): New function to print an error
message and emit a warning prior to connecting when
`erc--aberrant-modules' is non-nil.
(erc--find-mode): Make heuristic more robust by always checking for a
mode activation command rather than just a state variable. This fixes
a compatibility bug, new in 5.6, affecting third-party modules that
autoload module definitions instead of their corresponding
mode-activation commands.
(erc--update-modules): Add new positional argument `modules'.
(erc--setup-buffer-hook): Add new default member,
`erc--warn-about-aberrant-modules'.
(erc-open): Pass sorted `erc-modules' to `erc--update-modules'.
* test/lisp/erc/erc-tests.el (erc--sort-modules): New test.
(erc-tests--update-modules): New fixture.
(erc--update-modules): Remove and rework as three separate tests
dedicated to specific contexts. The existing one had poor coverage
and was difficult, if not impossible, to follow.
(erc--update-modules/unknown, erc--update-modules/local,
erc--update-modules/realistic): New tests. (Bug#57955)
2023-10-06 17:34:04 -07:00
|
|
|
(defun erc--update-modules (modules)
|
2021-07-12 03:44:28 -07:00
|
|
|
(let (local-modes)
|
Sort and dedupe when loading modules in erc-open
* doc/misc/erc.texi: Add new subheading "Module Loading" under the
"Modules" chapter.
* lisp/erc/erc.el (erc--sort-modules): New utility function to sort
and dedupe modules.
(erc-modules): In `custom-set' function, factor out collation into
separate utility `erc--sort-modules'.
(erc-update-modules): Call `erc--update-modules' with an argument, the
current value of `erc-modules'.
(erc--aberrant-modules): New variable, a list of symbols whose modules
ERC suspects of being incorrectly defined.
(erc--warn-about-aberrant-modules): New function to print an error
message and emit a warning prior to connecting when
`erc--aberrant-modules' is non-nil.
(erc--find-mode): Make heuristic more robust by always checking for a
mode activation command rather than just a state variable. This fixes
a compatibility bug, new in 5.6, affecting third-party modules that
autoload module definitions instead of their corresponding
mode-activation commands.
(erc--update-modules): Add new positional argument `modules'.
(erc--setup-buffer-hook): Add new default member,
`erc--warn-about-aberrant-modules'.
(erc-open): Pass sorted `erc-modules' to `erc--update-modules'.
* test/lisp/erc/erc-tests.el (erc--sort-modules): New test.
(erc-tests--update-modules): New fixture.
(erc--update-modules): Remove and rework as three separate tests
dedicated to specific contexts. The existing one had poor coverage
and was difficult, if not impossible, to follow.
(erc--update-modules/unknown, erc--update-modules/local,
erc--update-modules/realistic): New tests. (Bug#57955)
2023-10-06 17:34:04 -07:00
|
|
|
(dolist (module modules local-modes)
|
2023-02-04 06:24:59 -08:00
|
|
|
(if-let ((mode (erc--find-mode module)))
|
|
|
|
(if (custom-variable-p mode)
|
|
|
|
(funcall mode 1)
|
|
|
|
(push mode local-modes))
|
|
|
|
(error "`%s' is not a known ERC module" module)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Make some module toggles more resilient in ERC
* lisp/erc/erc-goodies.el (erc-scrolltobottom-mode,
erc-scrolltobottom-enable, erc-move-to-prompt-mode,
erc-move-to-prompt-enable): Guard setup procedure behind
`erc--updating-modules-p'.
* lisp/erc/erc-imenu.el (erc-imenu-mode, erc-imenu-enable,
erc-imenu-disable): Don't run setup when `erc--updating-modules-p' is
non-nil. Also, don't restrict teardown to buffers of the same
process.
* lisp/erc/erc-match.el (erc-match-mode, erc-match-enable): Run
major-mode hook member immediately outside of `erc-update-modules' in
`erc-open'.
* lisp/erc/erc-spelling.el (erc-spelling-mode, erc-spelling-enable):
Only conditionally run setup immediately.
* lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-enable,
erc-stamp-disable): Run setup hook immediately. Don't forget to
kill local vars in all ERC buffers during teardown.
* lisp/erc/erc.el (erc--updating-modules-p): New variable that global
modules can use to provide their `erc-mode-hook'-deferred code on
demand while shielding it from running during early ERC buffer
initialization.
(erc-open): Make `erc--updating-modules-p' non-nil while activating
global modules. (Bug#60936)
2023-05-07 19:43:57 -07:00
|
|
|
(defvar erc--updating-modules-p nil
|
|
|
|
"Non-nil when running `erc--update-modules' in `erc-open'.
|
|
|
|
This allows global modules with known or likely dependents (or
|
|
|
|
some other reason for activating after session initialization) to
|
|
|
|
conditionally run setup code traditionally reserved for
|
|
|
|
`erc-mode-hook' in the setup portion of their mode toggle. Note
|
|
|
|
that being \"global\", they'll likely want to do so in all ERC
|
|
|
|
buffers and ensure the code is idempotent. For example:
|
|
|
|
|
|
|
|
(add-hook \\='erc-mode-hook #\\='erc-foo-setup-fn)
|
|
|
|
(unless erc--updating-modules-p
|
|
|
|
(erc-with-all-buffers-of-server nil
|
|
|
|
(lambda () some-condition-p)
|
|
|
|
(erc-foo-setup-fn)))
|
|
|
|
|
|
|
|
This means that when a dependent module is initializing and
|
|
|
|
realizes it's missing some required module \"foo\", it can
|
|
|
|
confidently call (erc-foo-mode 1) without having to learn
|
|
|
|
anything about the dependency's implementation.")
|
|
|
|
|
Sort and dedupe when loading modules in erc-open
* doc/misc/erc.texi: Add new subheading "Module Loading" under the
"Modules" chapter.
* lisp/erc/erc.el (erc--sort-modules): New utility function to sort
and dedupe modules.
(erc-modules): In `custom-set' function, factor out collation into
separate utility `erc--sort-modules'.
(erc-update-modules): Call `erc--update-modules' with an argument, the
current value of `erc-modules'.
(erc--aberrant-modules): New variable, a list of symbols whose modules
ERC suspects of being incorrectly defined.
(erc--warn-about-aberrant-modules): New function to print an error
message and emit a warning prior to connecting when
`erc--aberrant-modules' is non-nil.
(erc--find-mode): Make heuristic more robust by always checking for a
mode activation command rather than just a state variable. This fixes
a compatibility bug, new in 5.6, affecting third-party modules that
autoload module definitions instead of their corresponding
mode-activation commands.
(erc--update-modules): Add new positional argument `modules'.
(erc--setup-buffer-hook): Add new default member,
`erc--warn-about-aberrant-modules'.
(erc-open): Pass sorted `erc-modules' to `erc--update-modules'.
* test/lisp/erc/erc-tests.el (erc--sort-modules): New test.
(erc-tests--update-modules): New fixture.
(erc--update-modules): Remove and rework as three separate tests
dedicated to specific contexts. The existing one had poor coverage
and was difficult, if not impossible, to follow.
(erc--update-modules/unknown, erc--update-modules/local,
erc--update-modules/realistic): New tests. (Bug#57955)
2023-10-06 17:34:04 -07:00
|
|
|
(defvar erc--setup-buffer-hook '(erc--warn-about-aberrant-modules)
|
Extend erc-interactive-display to cover /JOINs
* lisp/erc/erc.el (erc-display): Mention that buffer-related display
options live in the customization group `erc-buffers'.
(erc-buffer-display, erc-join-buffer): Swap alias and aliased so that
the favored name, `erc-buffer-display', appears in the definition and
in the Customize menu. Also note related buffer-display options in
the doc string.
(erc-query-display, erc-interactive-display): Make the former an alias
of the latter, new in ERC 5.6, because their roles were functionally
redundant and thus confusing. Inherit the default value from
`erc-query-display' because users are more familiar with the pop-up
window behavior than a single-window replacement.
(erc-reconnect-display): Use preferred name for cross-referencing
fallback option `erc-buffer-display' in doc string, and explain how
/reconnect handling differs.
(erc--setup-buffer-hook): Add new internal hook for modules that
operate on windows and frames, such as erc-speedbar and
erc-status-sidebar.
(erc-open): Run `erc--setup-buffer-hook' after `erc-setup-buffer' so
hook members know their code isn't tied to `erc-setup-buffer' itself,
which may be used in other contexts, but rather to a new ERC buffer on
which some display-related action has just been performed.
(erc--called-as-input-p): New variable for "slash" commands, like
`erc-cmd-FOO', to detect whether they're being called "interactively"
as a result of input given at ERC's prompt.
(erc-process-input-line): Bind `erc--called-as-input-p' when running
slash commands.
(erc-cmd-JOIN): When called interactively, schedule a callback to wrap
the response handler and control how new buffers are thus displayed.
(erc-cmd-QUERY): Use preferred alias for `erc-query-display'.
* test/lisp/erc/erc-scenarios-base-buffer-display.el:
(erc-scenarios-base-buffer-display--interactive-default): New test.
* test/lisp/erc/erc-tests.el (erc-process-input-line,
erc-select-read-args, erc-tls, erc--interactive): Change expected
default value of `erc-interactive-display' from `buffer' to
`window'. (Bug#62833)
2023-04-10 17:58:05 -07:00
|
|
|
"Internal hook for module setup involving windows and frames.")
|
|
|
|
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(defvar erc--display-context nil
|
|
|
|
"Extra action alist items passed to `display-buffer'.
|
|
|
|
Non-nil when a user specifies a custom display action for certain
|
|
|
|
buffer-display options, like `erc-auto-reconnect-display'. ERC
|
|
|
|
pairs the option's symbol with a context-dependent value and adds
|
|
|
|
the entry to the user-provided alist when calling `pop-to-buffer'
|
|
|
|
or `display-buffer'.")
|
|
|
|
|
|
|
|
(defvar erc-skip-displaying-selected-window-buffer t
|
|
|
|
"Whether to forgo showing a buffer that's already being displayed.
|
|
|
|
But only in the selected window. This is intended as a crutch
|
|
|
|
for non-user third-party code that might be slow to adopt the
|
|
|
|
`display-buffer' function variant available to all buffer-display
|
|
|
|
options starting in ERC 5.6. Users with rare requirements, like
|
|
|
|
wanting to change the window buffer to something other than the
|
|
|
|
one being processed, should see the Info node `(erc)
|
|
|
|
display-buffer'.")
|
|
|
|
(make-obsolete 'erc-show-already-displayed-buffer
|
|
|
|
"non-nil behavior to be made permanent" "30.1")
|
|
|
|
|
|
|
|
(defvar-local erc--display-buffer-overriding-action nil
|
|
|
|
"The value of `display-buffer-overriding-action' when non-nil.
|
|
|
|
Influences the displaying of new or reassociated ERC buffers.
|
|
|
|
Reserved for use by built-in modules.")
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-setup-buffer (buffer)
|
|
|
|
"Consults `erc-join-buffer' to find out how to display `BUFFER'."
|
2021-11-18 23:39:54 -08:00
|
|
|
(pcase (if (zerop (erc-with-server-buffer
|
|
|
|
erc--server-last-reconnect-count))
|
|
|
|
erc-join-buffer
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(or erc-auto-reconnect-display erc-join-buffer))
|
|
|
|
((and (pred functionp) disp-fn (let context erc--display-context))
|
|
|
|
(unless (zerop erc--server-last-reconnect-count)
|
|
|
|
(push '(erc-auto-reconnect-display . t) context))
|
|
|
|
(funcall disp-fn buffer (cons nil context)))
|
|
|
|
((guard (and erc-skip-displaying-selected-window-buffer
|
|
|
|
(eq (window-buffer) buffer))))
|
2018-11-05 01:22:15 +01:00
|
|
|
('window
|
2013-08-22 00:06:45 -04:00
|
|
|
(if (active-minibuffer-window)
|
2014-11-08 20:51:43 -05:00
|
|
|
(display-buffer buffer)
|
2013-08-22 00:06:45 -04:00
|
|
|
(switch-to-buffer-other-window buffer)))
|
2018-11-05 01:22:15 +01:00
|
|
|
('window-noselect
|
2022-09-06 19:09:54 -07:00
|
|
|
(display-buffer buffer '(nil (inhibit-same-window . t))))
|
2018-11-05 01:22:15 +01:00
|
|
|
('bury
|
2013-08-22 00:06:45 -04:00
|
|
|
nil)
|
2018-11-05 01:22:15 +01:00
|
|
|
('frame
|
2023-06-19 23:14:40 -07:00
|
|
|
(when (or (not erc-reuse-frames)
|
|
|
|
(not (get-buffer-window buffer t)))
|
2013-08-22 00:06:45 -04:00
|
|
|
(let ((frame (make-frame (or erc-frame-alist
|
2014-11-08 20:51:43 -05:00
|
|
|
default-frame-alist))))
|
|
|
|
(raise-frame frame)
|
|
|
|
(select-frame frame))
|
2013-08-22 00:06:45 -04:00
|
|
|
(switch-to-buffer buffer)
|
|
|
|
(when erc-frame-dedicated-flag
|
2023-06-19 23:14:40 -07:00
|
|
|
(set-window-dedicated-p (selected-window) t))))
|
2013-08-22 00:06:45 -04:00
|
|
|
(_
|
|
|
|
(if (active-minibuffer-window)
|
2014-11-08 20:51:43 -05:00
|
|
|
(display-buffer buffer)
|
2013-08-22 00:06:45 -04:00
|
|
|
(switch-to-buffer buffer)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2021-07-12 03:44:28 -07:00
|
|
|
(defun erc--merge-local-modes (new-modes old-vars)
|
|
|
|
"Return a cons of two lists, each containing local-module modes.
|
|
|
|
In the first, put modes to be enabled in a new ERC buffer by
|
|
|
|
calling their associated functions. In the second, put modes to
|
|
|
|
be marked as disabled by setting their associated variables to
|
|
|
|
nil."
|
|
|
|
(if old-vars
|
|
|
|
(let ((out (list (reverse new-modes))))
|
|
|
|
(pcase-dolist (`(,k . ,v) old-vars)
|
|
|
|
(when (and (string-prefix-p "erc-" (symbol-name k))
|
2023-01-13 06:03:15 -08:00
|
|
|
(string-suffix-p "-mode" (symbol-name k))
|
|
|
|
(get k 'erc-module))
|
2021-07-12 03:44:28 -07:00
|
|
|
(if v
|
|
|
|
(cl-pushnew k (car out))
|
|
|
|
(setf (car out) (delq k (car out)))
|
|
|
|
(cl-pushnew k (cdr out)))))
|
|
|
|
(cons (nreverse (car out)) (nreverse (cdr out))))
|
|
|
|
(list new-modes)))
|
|
|
|
|
2023-01-23 20:48:24 -08:00
|
|
|
;; This function doubles as a convenient helper for use in unit tests.
|
|
|
|
;; Prior to 5.6, its contents lived in `erc-open'.
|
|
|
|
|
|
|
|
(defun erc--initialize-markers (old-point continued-session)
|
|
|
|
"Ensure prompt and its bounding markers have been initialized."
|
|
|
|
;; FIXME erase assertions after code review and additional testing.
|
|
|
|
(setq erc-insert-marker (make-marker)
|
|
|
|
erc-input-marker (make-marker))
|
|
|
|
(if continued-session
|
|
|
|
(progn
|
|
|
|
;; Trust existing markers.
|
|
|
|
(set-marker erc-insert-marker
|
|
|
|
(alist-get 'erc-insert-marker continued-session))
|
|
|
|
(set-marker erc-input-marker
|
|
|
|
(alist-get 'erc-input-marker continued-session))
|
Don't insert prompt input before markers in ERC
* etc/ERC-NEWS: Update entry in 5.6 section announcing a persistent
prompt.
* lisp/erc/erc-dcc.el (erc-dcc-chat-setup): Use helper
`erc--initialize-markers' to set up prompt.
* lisp/erc/erc.el (erc--initialize-markers): Change
`erc-insert-marker' type to t. Do this to spare modules that want to
remember the current message location from resorting to workarounds,
like leaving a marker one char before the end of a message, which is
not foolproof.
(erc--refresh-prompt): Temporarily change type of `erc-insert-marker'
when inserting prompt.
(erc-display-line-1): Insert incoming message normally instead of
forcing before markers, thus respecting markers left by third parties.
Strictly speaking, this is a breaking change.
(erc-display-msg): Insert normally instead of calling
`insert-before-markers', which was a regression introduced by 05f6fdb9
"Preserve ERC prompt and its bounding markers".
* test/lisp/erc/erc-dcc-tests.el
(erc-dcc-tests--dcc-handle-ctcp-send,
erc-dcc-tests--erc-dcc-do-GET-command): Use helper to initialize
prompt and markers.
* test/lisp/erc/erc-networks-tests.el
(erc-networks--ensure-announced,
erc-networks--rename-server-buffer--existing--reuse,
erc-networks--rename-server-buffer--existing--noreuse,
erc-networks--rename-server-buffer--reconnecting,
erc-networks--rename-server-buffer--id,
erc-networks--rename-server-buffer--existing--live,
erc-networks--rename-server-buffer--local-match,
erc-networks--rename-server-buffer--local-nomatch): Use helper to
initialize prompt and bounding markers.
* test/lisp/erc/erc-stamp-tests.el (erc-stamp-tests--insert-right):
Use `erc--initialize-markers' for setting up prompt.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Adjust assertions
for expected prompt content. (Bug#60936)
2023-06-10 00:17:44 -07:00
|
|
|
(set-marker-insertion-type erc-insert-marker t)
|
|
|
|
(cl-assert (= (field-end erc-insert-marker) erc-input-marker))
|
2023-01-23 20:48:24 -08:00
|
|
|
(goto-char old-point)
|
2023-11-25 19:23:55 -08:00
|
|
|
(let ((erc--hidden-prompt-overlay
|
|
|
|
(alist-get 'erc--hidden-prompt-overlay continued-session)))
|
|
|
|
(erc--unhide-prompt)))
|
2023-01-23 20:48:24 -08:00
|
|
|
(cl-assert (not (get-text-property (point) 'erc-prompt)))
|
|
|
|
;; In the original version from `erc-open', the snippet that
|
|
|
|
;; handled these newline insertions appeared twice close in
|
|
|
|
;; proximity, which was probably unintended. Nevertheless, we
|
|
|
|
;; preserve the double newlines here for historical reasons.
|
|
|
|
(insert "\n\n")
|
|
|
|
(set-marker erc-insert-marker (point))
|
|
|
|
(erc-display-prompt)
|
Don't insert prompt input before markers in ERC
* etc/ERC-NEWS: Update entry in 5.6 section announcing a persistent
prompt.
* lisp/erc/erc-dcc.el (erc-dcc-chat-setup): Use helper
`erc--initialize-markers' to set up prompt.
* lisp/erc/erc.el (erc--initialize-markers): Change
`erc-insert-marker' type to t. Do this to spare modules that want to
remember the current message location from resorting to workarounds,
like leaving a marker one char before the end of a message, which is
not foolproof.
(erc--refresh-prompt): Temporarily change type of `erc-insert-marker'
when inserting prompt.
(erc-display-line-1): Insert incoming message normally instead of
forcing before markers, thus respecting markers left by third parties.
Strictly speaking, this is a breaking change.
(erc-display-msg): Insert normally instead of calling
`insert-before-markers', which was a regression introduced by 05f6fdb9
"Preserve ERC prompt and its bounding markers".
* test/lisp/erc/erc-dcc-tests.el
(erc-dcc-tests--dcc-handle-ctcp-send,
erc-dcc-tests--erc-dcc-do-GET-command): Use helper to initialize
prompt and markers.
* test/lisp/erc/erc-networks-tests.el
(erc-networks--ensure-announced,
erc-networks--rename-server-buffer--existing--reuse,
erc-networks--rename-server-buffer--existing--noreuse,
erc-networks--rename-server-buffer--reconnecting,
erc-networks--rename-server-buffer--id,
erc-networks--rename-server-buffer--existing--live,
erc-networks--rename-server-buffer--local-match,
erc-networks--rename-server-buffer--local-nomatch): Use helper to
initialize prompt and bounding markers.
* test/lisp/erc/erc-stamp-tests.el (erc-stamp-tests--insert-right):
Use `erc--initialize-markers' for setting up prompt.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Adjust assertions
for expected prompt content. (Bug#60936)
2023-06-10 00:17:44 -07:00
|
|
|
(set-marker-insertion-type erc-insert-marker t)
|
2023-01-23 20:48:24 -08:00
|
|
|
(cl-assert (= (point) (point-max)))))
|
|
|
|
|
2006-11-20 06:50:29 +00:00
|
|
|
(defun erc-open (&optional server port nick full-name
|
2021-04-22 20:22:38 -04:00
|
|
|
connect passwd tgt-list channel process
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
client-certificate user id)
|
2022-04-03 14:24:24 -07:00
|
|
|
"Connect to SERVER on PORT as NICK with USER and FULL-NAME.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
If CONNECT is non-nil, connect to the server. Otherwise assume
|
|
|
|
already connected and just create a separate buffer for the new
|
2022-07-11 05:14:57 -07:00
|
|
|
target given by CHANNEL, meaning these parameters are mutually
|
|
|
|
exclusive. Note that CHANNEL may also be a query; its name has
|
|
|
|
been retained for historical reasons.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
Use PASSWD as user password on the server. If TGT-LIST is
|
2007-11-15 16:45:18 +00:00
|
|
|
non-nil, use it to initialize `erc-default-recipients'.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2021-04-22 20:22:38 -04:00
|
|
|
CLIENT-CERTIFICATE, if non-nil, should either be a list where the
|
|
|
|
first element is the file name of the private key corresponding
|
|
|
|
to a client certificate and the second element is the file name
|
|
|
|
of the client certificate itself to use when connecting over TLS,
|
|
|
|
or t, which means that `auth-source' will be queried for the
|
|
|
|
private key and the certificate.
|
|
|
|
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
When non-nil, ID should be a symbol for identifying the connection.
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
Returns the buffer for the given server or channel."
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(let* ((target (and channel (erc--target-from-string channel)))
|
|
|
|
(buffer (erc-get-buffer-create server port nil target id))
|
|
|
|
(old-buffer (current-buffer))
|
2023-01-16 23:05:16 -08:00
|
|
|
(erc--target-priors (and target ; buf from prior session
|
|
|
|
(buffer-local-value 'erc--target buffer)
|
|
|
|
(buffer-local-variables buffer)))
|
2021-07-12 03:44:28 -07:00
|
|
|
(old-recon-count erc-server-reconnect-count)
|
|
|
|
(old-point nil)
|
|
|
|
(delayed-modules nil)
|
2023-01-23 20:48:24 -08:00
|
|
|
(continued-session (or erc--server-reconnecting
|
|
|
|
erc--target-priors
|
|
|
|
(and-let* (((not target))
|
|
|
|
(m (buffer-local-value
|
|
|
|
'erc-input-marker buffer))
|
|
|
|
((marker-position m)))
|
|
|
|
(buffer-local-variables buffer)))))
|
2007-01-17 18:17:25 +00:00
|
|
|
(when connect (run-hook-with-args 'erc-before-connect server port nick))
|
2006-01-29 13:08:58 +00:00
|
|
|
(set-buffer buffer)
|
2007-01-05 02:09:07 +00:00
|
|
|
(setq old-point (point))
|
2021-07-12 03:44:28 -07:00
|
|
|
(setq delayed-modules
|
Make some module toggles more resilient in ERC
* lisp/erc/erc-goodies.el (erc-scrolltobottom-mode,
erc-scrolltobottom-enable, erc-move-to-prompt-mode,
erc-move-to-prompt-enable): Guard setup procedure behind
`erc--updating-modules-p'.
* lisp/erc/erc-imenu.el (erc-imenu-mode, erc-imenu-enable,
erc-imenu-disable): Don't run setup when `erc--updating-modules-p' is
non-nil. Also, don't restrict teardown to buffers of the same
process.
* lisp/erc/erc-match.el (erc-match-mode, erc-match-enable): Run
major-mode hook member immediately outside of `erc-update-modules' in
`erc-open'.
* lisp/erc/erc-spelling.el (erc-spelling-mode, erc-spelling-enable):
Only conditionally run setup immediately.
* lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-enable,
erc-stamp-disable): Run setup hook immediately. Don't forget to
kill local vars in all ERC buffers during teardown.
* lisp/erc/erc.el (erc--updating-modules-p): New variable that global
modules can use to provide their `erc-mode-hook'-deferred code on
demand while shielding it from running during early ERC buffer
initialization.
(erc-open): Make `erc--updating-modules-p' non-nil while activating
global modules. (Bug#60936)
2023-05-07 19:43:57 -07:00
|
|
|
(erc--merge-local-modes (let ((erc--updating-modules-p t))
|
Sort and dedupe when loading modules in erc-open
* doc/misc/erc.texi: Add new subheading "Module Loading" under the
"Modules" chapter.
* lisp/erc/erc.el (erc--sort-modules): New utility function to sort
and dedupe modules.
(erc-modules): In `custom-set' function, factor out collation into
separate utility `erc--sort-modules'.
(erc-update-modules): Call `erc--update-modules' with an argument, the
current value of `erc-modules'.
(erc--aberrant-modules): New variable, a list of symbols whose modules
ERC suspects of being incorrectly defined.
(erc--warn-about-aberrant-modules): New function to print an error
message and emit a warning prior to connecting when
`erc--aberrant-modules' is non-nil.
(erc--find-mode): Make heuristic more robust by always checking for a
mode activation command rather than just a state variable. This fixes
a compatibility bug, new in 5.6, affecting third-party modules that
autoload module definitions instead of their corresponding
mode-activation commands.
(erc--update-modules): Add new positional argument `modules'.
(erc--setup-buffer-hook): Add new default member,
`erc--warn-about-aberrant-modules'.
(erc-open): Pass sorted `erc-modules' to `erc--update-modules'.
* test/lisp/erc/erc-tests.el (erc--sort-modules): New test.
(erc-tests--update-modules): New fixture.
(erc--update-modules): Remove and rework as three separate tests
dedicated to specific contexts. The existing one had poor coverage
and was difficult, if not impossible, to follow.
(erc--update-modules/unknown, erc--update-modules/local,
erc--update-modules/realistic): New tests. (Bug#57955)
2023-10-06 17:34:04 -07:00
|
|
|
(erc--update-modules
|
|
|
|
(erc--sort-modules erc-modules)))
|
2023-01-16 23:05:16 -08:00
|
|
|
(or erc--server-reconnecting
|
|
|
|
erc--target-priors)))
|
2021-07-12 03:44:28 -07:00
|
|
|
|
|
|
|
(delay-mode-hooks (erc-mode))
|
|
|
|
|
|
|
|
(setq erc-server-reconnect-count old-recon-count)
|
|
|
|
|
2021-06-14 23:40:45 -07:00
|
|
|
(when (setq erc-server-connected (not connect))
|
|
|
|
(setq erc-server-announced-name
|
|
|
|
(buffer-local-value 'erc-server-announced-name old-buffer)))
|
2006-01-29 13:08:58 +00:00
|
|
|
;; connection parameters
|
|
|
|
(setq erc-server-process process)
|
|
|
|
;; stack of default recipients
|
|
|
|
(setq erc-default-recipients tgt-list)
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(when target
|
|
|
|
(setq erc--target target
|
|
|
|
erc-network (erc-network)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(setq erc-server-current-nick nil)
|
|
|
|
;; Initialize erc-server-users and erc-channel-users
|
|
|
|
(if connect
|
2014-11-08 20:51:43 -05:00
|
|
|
(progn ;; server buffer
|
|
|
|
(setq erc-server-users
|
|
|
|
(make-hash-table :test 'equal))
|
|
|
|
(setq erc-channel-users nil))
|
2006-01-29 13:08:58 +00:00
|
|
|
(progn ;; target buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq erc-server-users nil)
|
|
|
|
(setq erc-channel-users
|
|
|
|
(make-hash-table :test 'equal))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(setq erc-channel-topic "")
|
|
|
|
;; limit on the number of users on the channel (mode +l)
|
|
|
|
(setq erc-channel-user-limit nil)
|
|
|
|
(setq erc-channel-key nil)
|
|
|
|
;; last active buffer, defaults to this one
|
|
|
|
(erc-set-active-buffer buffer)
|
|
|
|
;; last invitation channel
|
|
|
|
(setq erc-invitation nil)
|
|
|
|
;; Server channel list
|
|
|
|
(setq erc-channel-list ())
|
|
|
|
;; login-time 'nick in use' error
|
|
|
|
(setq erc-bad-nick nil)
|
|
|
|
;; whether we have logged in
|
|
|
|
(setq erc-logged-in nil)
|
|
|
|
;; The local copy of `erc-nick' - the list of nicks to choose
|
|
|
|
(setq erc-default-nicks (if (consp erc-nick) erc-nick (list erc-nick)))
|
2021-04-22 20:22:38 -04:00
|
|
|
;; client certificate (only useful if connecting over TLS)
|
|
|
|
(setq erc-session-client-certificate client-certificate)
|
2022-11-13 01:52:48 -08:00
|
|
|
(setq erc-networks--id
|
|
|
|
(if connect
|
2021-07-12 03:44:28 -07:00
|
|
|
(or (and erc--server-reconnecting
|
|
|
|
(alist-get 'erc-networks--id erc--server-reconnecting))
|
2022-11-13 01:52:48 -08:00
|
|
|
(and id (erc-networks--id-create id)))
|
|
|
|
(buffer-local-value 'erc-networks--id old-buffer)))
|
2006-01-29 13:08:58 +00:00
|
|
|
;; debug output buffer
|
|
|
|
(setq erc-dbuf
|
2014-11-08 20:51:43 -05:00
|
|
|
(when erc-log-p
|
|
|
|
(get-buffer-create (concat "*ERC-DEBUG: " server "*"))))
|
2021-07-12 03:44:28 -07:00
|
|
|
|
|
|
|
(erc-determine-parameters server port nick full-name user passwd)
|
2023-01-23 20:48:24 -08:00
|
|
|
(erc--initialize-markers old-point continued-session)
|
2023-01-13 06:03:15 -08:00
|
|
|
(save-excursion (run-mode-hooks)
|
|
|
|
(dolist (mod (car delayed-modules)) (funcall mod +1))
|
|
|
|
(dolist (var (cdr delayed-modules)) (set var nil)))
|
|
|
|
|
2007-04-01 13:36:38 +00:00
|
|
|
;; Saving log file on exit
|
|
|
|
(run-hook-with-args 'erc-connect-pre-hook buffer)
|
|
|
|
|
2022-10-27 00:21:10 -07:00
|
|
|
(if connect
|
|
|
|
(erc-server-connect erc-session-server
|
|
|
|
erc-session-port
|
|
|
|
buffer
|
|
|
|
erc-session-client-certificate)
|
|
|
|
(erc-update-mode-line))
|
2007-04-01 13:36:38 +00:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
;; Now display the buffer in a window as per user wishes.
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(when (eq buffer old-buffer) (cl-assert (and connect (not target))))
|
|
|
|
(unless (and (not erc-reconnect-display-server-buffers)
|
|
|
|
(eq buffer old-buffer))
|
2006-01-29 13:08:58 +00:00
|
|
|
(when erc-log-p
|
2014-11-08 20:51:43 -05:00
|
|
|
;; we can't log to debug buffer, it may not exist yet
|
|
|
|
(message "erc: old buffer %s, switching to %s"
|
|
|
|
old-buffer buffer))
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(let ((display-buffer-overriding-action
|
|
|
|
(or erc--display-buffer-overriding-action
|
|
|
|
display-buffer-overriding-action)))
|
|
|
|
(erc-setup-buffer buffer)
|
|
|
|
(run-hooks 'erc--setup-buffer-hook)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
buffer))
|
|
|
|
|
2007-04-01 13:36:38 +00:00
|
|
|
(defun erc-initialize-log-marker (buffer)
|
|
|
|
"Initialize the `erc-last-saved-position' marker to a sensible position.
|
|
|
|
BUFFER is the current buffer."
|
|
|
|
(with-current-buffer buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(unless (markerp erc-last-saved-position)
|
|
|
|
(setq erc-last-saved-position (make-marker))
|
|
|
|
(move-marker erc-last-saved-position
|
|
|
|
(1- (marker-position erc-insert-marker))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; interactive startup
|
|
|
|
|
|
|
|
(defvar erc-server-history-list nil
|
|
|
|
"IRC server interactive selection history list.")
|
|
|
|
|
|
|
|
(defvar erc-nick-history-list nil
|
|
|
|
"Nickname interactive selection history list.")
|
|
|
|
|
|
|
|
(defun erc-already-logged-in (server port nick)
|
|
|
|
"Return the buffers corresponding to a NICK on PORT of a session SERVER.
|
|
|
|
This is determined by looking for the appropriate buffer and checking
|
|
|
|
whether the connection is still alive.
|
|
|
|
If no buffer matches, return nil."
|
|
|
|
(erc-buffer-list
|
|
|
|
(lambda ()
|
|
|
|
(and (erc-server-process-alive)
|
2014-11-08 20:51:43 -05:00
|
|
|
(string= erc-session-server server)
|
|
|
|
(erc-port-equal erc-session-port port)
|
|
|
|
(erc-current-nick-p nick)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defcustom erc-before-connect nil
|
2021-02-27 05:43:06 +01:00
|
|
|
"Functions called before connecting to a server.
|
|
|
|
The functions in this variable gets executed before `erc'
|
|
|
|
actually invokes `erc-mode' with your input data. The functions
|
|
|
|
in here get called with three parameters, SERVER, PORT and NICK."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-hooks
|
2021-02-27 05:43:06 +01:00
|
|
|
:type '(repeat function))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defcustom erc-after-connect nil
|
2023-10-15 13:20:07 -07:00
|
|
|
"Abnormal hook run upon establishing a logical IRC connection.
|
|
|
|
Runs on MOTD's end when `erc-server-connected' becomes non-nil.
|
|
|
|
ERC calls members with `erc-server-announced-name', falling back
|
|
|
|
to the 376/422 message's \"sender\", as well as the current nick,
|
|
|
|
as given by the 376/422 message's \"target\" parameter, which is
|
|
|
|
typically the same as that reported by `erc-current-nick'."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-hooks
|
2021-02-27 05:43:06 +01:00
|
|
|
:type '(repeat function))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2022-07-11 05:14:57 -07:00
|
|
|
(defun erc--ensure-url (input)
|
|
|
|
(unless (string-match (rx bot "irc" (? "6") (? "s") "://") input)
|
2023-05-30 10:04:48 +02:00
|
|
|
(when (and (string-match (rx (? (+ nonl) "@")
|
|
|
|
(or (group (* (not "[")) ":" (* nonl))
|
|
|
|
(+ nonl))
|
2022-07-11 05:14:57 -07:00
|
|
|
":" (+ (not (any ":]"))) eot)
|
|
|
|
input)
|
|
|
|
(match-beginning 1))
|
|
|
|
(setq input (concat "[" (substring input (match-beginning 1)) "]")))
|
|
|
|
(setq input (concat "irc://" input)))
|
|
|
|
input)
|
|
|
|
|
2023-06-29 07:12:46 -07:00
|
|
|
(defvar erc--prompt-for-server-function nil)
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun erc-select-read-args ()
|
2022-12-29 06:43:19 -08:00
|
|
|
"Prompt the user for values of nick, server, port, and password.
|
|
|
|
With prefix arg, also prompt for user and full name."
|
2022-07-11 05:14:57 -07:00
|
|
|
(let* ((input (let ((d (erc-compute-server)))
|
2023-06-29 07:12:46 -07:00
|
|
|
(if erc--prompt-for-server-function
|
|
|
|
(funcall erc--prompt-for-server-function)
|
|
|
|
(read-string (format "Server or URL (default is %S): " d)
|
|
|
|
nil 'erc-server-history-list d))))
|
2022-07-11 05:14:57 -07:00
|
|
|
;; For legacy reasons, also accept a URL without a scheme.
|
|
|
|
(url (url-generic-parse-url (erc--ensure-url input)))
|
|
|
|
(server (url-host url))
|
2022-12-29 06:43:19 -08:00
|
|
|
(sp (and (string-suffix-p "s" (url-type url)) erc-default-port-tls))
|
2022-07-11 05:14:57 -07:00
|
|
|
(port (or (url-portspec url)
|
|
|
|
(erc-compute-port
|
|
|
|
(let ((d (erc-compute-port sp))) ; may be a string
|
|
|
|
(read-string (format "Port (default is %s): " d)
|
|
|
|
nil nil d)))))
|
|
|
|
;; Trust the user not to connect twice accidentally. We
|
|
|
|
;; can't use `erc-already-logged-in' to check for an existing
|
|
|
|
;; connection without modifying it to consider USER and PASS.
|
|
|
|
(nick (or (url-user url)
|
|
|
|
(let ((d (erc-compute-nick)))
|
|
|
|
(read-string (format "Nickname (default is %S): " d)
|
|
|
|
nil 'erc-nick-history-list d))))
|
2022-12-29 06:43:19 -08:00
|
|
|
(user (and current-prefix-arg
|
|
|
|
(let ((d (erc-compute-user (url-user url))))
|
|
|
|
(read-string (format "User (default is %S): " d)
|
|
|
|
nil nil d))))
|
|
|
|
(full (and current-prefix-arg
|
|
|
|
(let ((d (erc-compute-full-name (url-user url))))
|
|
|
|
(read-string (format "Full name (default is %S): " d)
|
|
|
|
nil nil d))))
|
2022-12-29 06:43:19 -08:00
|
|
|
(passwd (let* ((p (with-suppressed-warnings ((obsolete erc-password))
|
|
|
|
(or (url-password url) erc-password)))
|
|
|
|
(m (if p
|
|
|
|
(format "Server password (default is %S): " p)
|
|
|
|
"Server password (optional): ")))
|
2022-12-29 06:43:19 -08:00
|
|
|
(if erc-prompt-for-password (read-passwd m nil p) p)))
|
|
|
|
(opener (and (or sp (eql port erc-default-port-tls)
|
|
|
|
(and (equal server erc-default-server)
|
|
|
|
(not (string-prefix-p "irc://" input))
|
|
|
|
(eql port erc-default-port)
|
|
|
|
(y-or-n-p "Connect using TLS instead? ")
|
|
|
|
(setq port erc-default-port-tls)))
|
|
|
|
#'erc-open-tls-stream))
|
|
|
|
env)
|
2022-12-29 06:43:19 -08:00
|
|
|
(when erc-interactive-display
|
|
|
|
(push `(erc-join-buffer . ,erc-interactive-display) env))
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(when erc--display-context
|
|
|
|
(push `(erc--display-context . ,erc--display-context) env))
|
2022-12-29 06:43:19 -08:00
|
|
|
(when opener
|
|
|
|
(push `(erc-server-connect-function . ,opener) env))
|
2006-01-29 13:08:58 +00:00
|
|
|
(when (and passwd (string= "" passwd))
|
|
|
|
(setq passwd nil))
|
2022-12-29 06:43:19 -08:00
|
|
|
`( :server ,server :port ,port :nick ,nick ,@(and user `(:user ,user))
|
|
|
|
,@(and passwd `(:password ,passwd)) ,@(and full `(:full-name ,full))
|
2022-12-29 06:43:19 -08:00
|
|
|
,@(and env `(&interactive-env ,env)))))
|
|
|
|
|
|
|
|
(defmacro erc--with-entrypoint-environment (env &rest body)
|
|
|
|
"Run BODY with bindings from ENV alist."
|
|
|
|
(declare (indent 1))
|
|
|
|
(let ((syms (make-symbol "syms"))
|
|
|
|
(vals (make-symbol "vals")))
|
|
|
|
`(let (,syms ,vals)
|
|
|
|
(pcase-dolist (`(,k . ,v) ,env) (push k ,syms) (push v ,vals))
|
|
|
|
(cl-progv ,syms ,vals
|
|
|
|
,@body))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-06-29 07:12:46 -07:00
|
|
|
;;;###autoload
|
|
|
|
(defun erc-server-select ()
|
|
|
|
"Interactively connect to a server from `erc-server-alist'."
|
|
|
|
(declare (obsolete erc-tls "30.1"))
|
|
|
|
(interactive)
|
|
|
|
(let ((erc--prompt-for-server-function #'erc-networks--server-select))
|
|
|
|
(call-interactively #'erc)))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
;;;###autoload
|
Use cl-lib instead of cl, and interactive-p => called-interactively-p.
* lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
called-interactively-p instead of cl.
* lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
* lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
* lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
* lisp/erc/erc-capab.el: Don't require cl since we don't use it.
* lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
(erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
* lisp/json.el: Don't require cl since we don't use it.
* lisp/color.el: Don't require cl.
(color-complement): `caddr' -> `nth 2'.
* test/automated/ert-x-tests.el: Use cl-lib.
* test/automated/ert-tests.el: Use lexical-binding and cl-lib.
2012-11-19 12:24:12 -05:00
|
|
|
(cl-defun erc (&key (server (erc-compute-server))
|
2014-11-08 20:51:43 -05:00
|
|
|
(port (erc-compute-port))
|
|
|
|
(nick (erc-compute-nick))
|
2022-04-03 14:24:24 -07:00
|
|
|
(user (erc-compute-user))
|
2014-11-08 20:51:43 -05:00
|
|
|
password
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(full-name (erc-compute-full-name))
|
2022-12-29 06:43:19 -08:00
|
|
|
id
|
|
|
|
;; Used by interactive form
|
|
|
|
((&interactive-env --interactive-env--)))
|
2007-04-01 13:36:38 +00:00
|
|
|
"ERC is a powerful, modular, and extensible IRC client.
|
|
|
|
This function is the main entry point for ERC.
|
|
|
|
|
2021-04-22 20:22:38 -04:00
|
|
|
It allows selecting connection parameters, and then starts ERC.
|
2007-04-01 13:36:38 +00:00
|
|
|
|
|
|
|
Non-interactively, it takes the keyword arguments
|
2006-01-29 13:08:58 +00:00
|
|
|
(server (erc-compute-server))
|
|
|
|
(port (erc-compute-port))
|
|
|
|
(nick (erc-compute-nick))
|
2022-04-03 14:24:24 -07:00
|
|
|
(user (erc-compute-user))
|
2006-01-29 13:08:58 +00:00
|
|
|
password
|
2021-04-22 20:22:38 -04:00
|
|
|
(full-name (erc-compute-full-name))
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
id
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
That is, if called with
|
2006-07-14 02:29:50 +00:00
|
|
|
|
2021-07-03 23:39:18 -04:00
|
|
|
(erc :server \"irc.libera.chat\" :full-name \"J. Random Hacker\")
|
2006-07-14 02:29:50 +00:00
|
|
|
|
2021-04-22 20:22:38 -04:00
|
|
|
then the server and full-name will be set to those values,
|
|
|
|
whereas `erc-compute-port' and `erc-compute-nick' will be invoked
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
for the values of the other parameters.
|
|
|
|
|
2022-12-29 06:43:19 -08:00
|
|
|
See `erc-tls' for the meaning of ID.
|
|
|
|
|
|
|
|
\(fn &key SERVER PORT NICK USER PASSWORD FULL-NAME ID)"
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(interactive (let ((erc--display-context `((erc-interactive-display . erc)
|
|
|
|
,@erc--display-context)))
|
|
|
|
(erc-select-read-args)))
|
|
|
|
(unless (assq 'erc--display-context --interactive-env--)
|
|
|
|
(push '(erc--display-context . ((erc-buffer-display . erc)))
|
|
|
|
--interactive-env--))
|
2022-12-29 06:43:19 -08:00
|
|
|
(erc--with-entrypoint-environment --interactive-env--
|
|
|
|
(erc-open server port nick full-name t password nil nil nil nil user id)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2007-04-01 13:36:38 +00:00
|
|
|
;;;###autoload
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-select #'erc)
|
|
|
|
(defalias 'erc-ssl #'erc-tls)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2012-01-05 23:48:47 -08:00
|
|
|
;;;###autoload
|
2021-04-22 20:22:38 -04:00
|
|
|
(cl-defun erc-tls (&key (server (erc-compute-server))
|
2022-07-11 05:14:57 -07:00
|
|
|
(port (erc-compute-port 'ircs-u))
|
2021-04-22 20:22:38 -04:00
|
|
|
(nick (erc-compute-nick))
|
2022-04-03 14:24:24 -07:00
|
|
|
(user (erc-compute-user))
|
2021-04-22 20:22:38 -04:00
|
|
|
password
|
|
|
|
(full-name (erc-compute-full-name))
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
client-certificate
|
2022-12-29 06:43:19 -08:00
|
|
|
id
|
|
|
|
;; Used by interactive form
|
|
|
|
((&interactive-env --interactive-env--)))
|
2021-04-22 20:22:38 -04:00
|
|
|
"ERC is a powerful, modular, and extensible IRC client.
|
|
|
|
This function is the main entry point for ERC over TLS.
|
|
|
|
|
|
|
|
It allows selecting connection parameters, and then starts ERC
|
|
|
|
over TLS.
|
|
|
|
|
|
|
|
Non-interactively, it takes the keyword arguments
|
|
|
|
(server (erc-compute-server))
|
|
|
|
(port (erc-compute-port))
|
|
|
|
(nick (erc-compute-nick))
|
2022-12-12 07:38:44 -08:00
|
|
|
(user (erc-compute-user))
|
2021-04-22 20:22:38 -04:00
|
|
|
password
|
|
|
|
(full-name (erc-compute-full-name))
|
|
|
|
client-certificate
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
id
|
2021-04-22 20:22:38 -04:00
|
|
|
|
|
|
|
That is, if called with
|
|
|
|
|
2021-07-04 01:18:19 -04:00
|
|
|
(erc-tls :server \"irc.libera.chat\" :full-name \"J. Random Hacker\")
|
2021-04-22 20:22:38 -04:00
|
|
|
|
|
|
|
then the server and full-name will be set to those values,
|
|
|
|
whereas `erc-compute-port' and `erc-compute-nick' will be invoked
|
|
|
|
for the values of their respective parameters.
|
|
|
|
|
|
|
|
CLIENT-CERTIFICATE, if non-nil, should either be a list where the
|
|
|
|
first element is the certificate key file name, and the second
|
|
|
|
element is the certificate file name itself, or t, which means
|
|
|
|
that `auth-source' will be queried for the key and the
|
|
|
|
certificate. Authenticating using a TLS client certificate is
|
2021-09-03 11:13:53 +02:00
|
|
|
also referred to as \"CertFP\" (Certificate Fingerprint)
|
2021-04-22 20:22:38 -04:00
|
|
|
authentication by various IRC networks.
|
|
|
|
|
|
|
|
Example usage:
|
|
|
|
|
2021-07-04 01:18:19 -04:00
|
|
|
(erc-tls :server \"irc.libera.chat\" :port 6697
|
2021-04-22 20:22:38 -04:00
|
|
|
:client-certificate
|
2022-04-22 17:16:42 +02:00
|
|
|
\\='(\"/home/bandali/my-cert.key\"
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
\"/home/bandali/my-cert.crt\"))
|
|
|
|
|
2022-12-12 07:38:44 -08:00
|
|
|
When present, ID should be a symbol or a string to use for naming
|
|
|
|
the server buffer and identifying the connection unequivocally.
|
2022-12-29 06:43:19 -08:00
|
|
|
See Info node `(erc) Network Identifier' for details. Like
|
|
|
|
CLIENT-CERTIFICATE, this parameter cannot be specified
|
2022-12-29 06:43:19 -08:00
|
|
|
interactively.
|
|
|
|
|
|
|
|
\(fn &key SERVER PORT NICK USER PASSWORD FULL-NAME CLIENT-CERTIFICATE ID)"
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(interactive
|
|
|
|
(let ((erc-default-port erc-default-port-tls)
|
|
|
|
(erc--display-context `((erc-interactive-display . erc-tls)
|
|
|
|
,@erc--display-context)))
|
|
|
|
(erc-select-read-args)))
|
2022-12-29 06:43:19 -08:00
|
|
|
;; Bind `erc-server-connect-function' to `erc-open-tls-stream'
|
|
|
|
;; around `erc-open' when a non-default value hasn't been specified
|
|
|
|
;; by the user or the interactive form. And don't bother checking
|
|
|
|
;; for advice, indirect functions, autoloads, etc.
|
|
|
|
(unless (or (assq 'erc-server-connect-function --interactive-env--)
|
|
|
|
(not (eq erc-server-connect-function #'erc-open-network-stream)))
|
|
|
|
(push '(erc-server-connect-function . erc-open-tls-stream)
|
|
|
|
--interactive-env--))
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(unless (assq 'erc--display-context --interactive-env--)
|
|
|
|
(push '(erc--display-context . ((erc-buffer-display . erc-tls)))
|
|
|
|
--interactive-env--))
|
2022-12-29 06:43:19 -08:00
|
|
|
(erc--with-entrypoint-environment --interactive-env--
|
2021-04-22 20:22:38 -04:00
|
|
|
(erc-open server port nick full-name t password
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
nil nil nil client-certificate user id)))
|
2007-09-08 03:07:09 +00:00
|
|
|
|
2021-04-22 20:22:38 -04:00
|
|
|
(defun erc-open-tls-stream (name buffer host port &rest parameters)
|
2007-09-08 03:07:09 +00:00
|
|
|
"Open an TLS stream to an IRC server.
|
2021-04-22 20:22:38 -04:00
|
|
|
The process will be given the name NAME, its target buffer will
|
|
|
|
be BUFFER. HOST and PORT specify the connection target.
|
|
|
|
PARAMETERS should be a sequence of keywords and values, per
|
|
|
|
`open-network-stream'."
|
|
|
|
(let ((p (plist-put parameters :type 'tls))
|
|
|
|
args)
|
|
|
|
(unless (plist-member p :nowait)
|
|
|
|
(setq p (plist-put p :nowait t)))
|
|
|
|
(setq args `(,name ,buffer ,host ,port ,@p))
|
|
|
|
(apply #'open-network-stream args)))
|
2007-09-08 03:07:09 +00:00
|
|
|
|
2023-05-22 21:43:29 -07:00
|
|
|
(defun erc-open-socks-tls-stream (name buffer host service &rest parameters)
|
|
|
|
"Connect to an IRC server via SOCKS proxy over TLS.
|
|
|
|
Bind `erc-server-connect-function' to this function around calls
|
|
|
|
to `erc-tls'. See `erc-open-network-stream' for the meaning of
|
|
|
|
NAME and BUFFER. HOST should be a \".onion\" URL, SERVICE a TLS
|
|
|
|
port number, and PARAMETERS a sequence of key/value pairs, per
|
|
|
|
`open-network-stream'. See Info node `(erc) SOCKS' for more
|
|
|
|
info."
|
|
|
|
(require 'gnutls)
|
|
|
|
(require 'socks)
|
|
|
|
(let ((proc (socks-open-network-stream name buffer host service))
|
|
|
|
(cert-info (plist-get parameters :client-certificate)))
|
|
|
|
(gnutls-negotiate :process proc
|
|
|
|
:hostname host
|
|
|
|
:keylist (and cert-info (list cert-info)))))
|
|
|
|
|
2007-09-08 03:07:09 +00:00
|
|
|
;;; Displaying error messages
|
|
|
|
|
|
|
|
(defun erc-error (&rest args)
|
|
|
|
"Pass ARGS to `format', and display the result as an error message.
|
|
|
|
If `debug-on-error' is set to non-nil, then throw a real error with this
|
|
|
|
message instead, to make debugging easier."
|
|
|
|
(if debug-on-error
|
|
|
|
(apply #'error args)
|
|
|
|
(apply #'message args)
|
|
|
|
(beep)))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
;;; Debugging the protocol
|
|
|
|
|
2021-09-16 15:35:55 +02:00
|
|
|
(defvar erc-debug-irc-protocol-time-format "%FT%T.%6N%z "
|
|
|
|
"Timestamp format string for protocol logger.")
|
|
|
|
|
2022-12-14 20:03:15 -08:00
|
|
|
(defconst erc-debug-irc-protocol-version "2"
|
2021-09-16 15:35:55 +02:00
|
|
|
"Protocol log format version number.
|
|
|
|
This exists to help tooling track changes to the format.
|
|
|
|
|
|
|
|
In version 1, everything before and including the first double CRLF is
|
|
|
|
front matter, which must also be CRLF terminated. Lines beginning with
|
|
|
|
three asterisks must be ignored as comments. Other lines should be
|
|
|
|
interpreted as email-style headers. Folding is not supported. A second
|
|
|
|
double CRLF, if present, signals the end of a log. Session resumption
|
|
|
|
is not supported. Logger lines must adhere to the following format:
|
|
|
|
TIMESTAMP PEER-NAME FLOW-INDICATOR IRC-MESSAGE CRLF. Outgoing messages
|
2022-12-14 20:03:15 -08:00
|
|
|
are indicated with a >> and incoming with a <<.
|
|
|
|
|
|
|
|
In version 2, certain outgoing passwords are replaced by a string
|
|
|
|
of ten question marks.")
|
2021-09-16 15:35:55 +02:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defvar erc-debug-irc-protocol nil
|
|
|
|
"If non-nil, log all IRC protocol traffic to the buffer \"*erc-protocol*\".
|
|
|
|
|
|
|
|
The buffer is created if it doesn't exist.
|
|
|
|
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
NOTE: If this variable is non-nil, and you kill the only
|
2006-01-29 13:08:58 +00:00
|
|
|
visible \"*erc-protocol*\" buffer, it will be recreated shortly,
|
|
|
|
but you won't see it.
|
|
|
|
|
|
|
|
WARNING: Do not set this variable directly! Instead, use the
|
|
|
|
function `erc-toggle-debug-irc-protocol' to toggle its value.")
|
|
|
|
|
2022-11-13 01:52:48 -08:00
|
|
|
(defvar erc--debug-irc-protocol-mask-secrets t
|
|
|
|
"Whether to hide secrets in a debug log.
|
|
|
|
They are still visible on screen but are replaced by question
|
|
|
|
marks when yanked.")
|
|
|
|
|
|
|
|
(defun erc--mask-secrets (string)
|
|
|
|
(when-let* ((eot (length string))
|
|
|
|
(beg (text-property-any 0 eot 'erc-secret t string))
|
|
|
|
(end (text-property-not-all beg eot 'erc-secret t string))
|
|
|
|
(sec (substring string beg end)))
|
|
|
|
(setq string (concat (substring string 0 beg)
|
|
|
|
(make-string 10 ??)
|
|
|
|
(substring string end eot)))
|
|
|
|
(put-text-property beg (+ 10 beg) 'face 'erc-inverse-face string)
|
|
|
|
(put-text-property beg (+ 10 beg) 'display sec string))
|
|
|
|
string)
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-log-irc-protocol (string &optional outbound)
|
|
|
|
"Append STRING to the buffer *erc-protocol*.
|
|
|
|
|
|
|
|
This only has any effect if `erc-debug-irc-protocol' is non-nil.
|
|
|
|
|
|
|
|
The buffer is created if it doesn't exist.
|
|
|
|
|
2021-09-16 15:35:55 +02:00
|
|
|
If OUTBOUND is non-nil, STRING is being sent to the IRC server and
|
|
|
|
appears in face `erc-input-face' in the buffer. Lines must already
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
contain CRLF endings. A peer is identified by the most precise label
|
|
|
|
available, starting with the session ID followed by the server-reported
|
|
|
|
hostname, and falling back to the dialed <server>:<port> pair.
|
|
|
|
|
|
|
|
When capturing logs for multiple peers and sorting them into buckets,
|
|
|
|
such inconsistent labeling may pose a problem until the MOTD is
|
|
|
|
received. Setting a fixed `erc-networks--id' can serve as a
|
|
|
|
workaround."
|
2006-01-29 13:08:58 +00:00
|
|
|
(when erc-debug-irc-protocol
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(let ((esid (if-let ((erc-networks--id)
|
|
|
|
(esid (erc-networks--id-symbol erc-networks--id)))
|
|
|
|
(symbol-name esid)
|
|
|
|
(or erc-server-announced-name
|
|
|
|
(format "%s:%s" erc-session-server erc-session-port))))
|
2021-09-16 15:35:55 +02:00
|
|
|
(ts (when erc-debug-irc-protocol-time-format
|
|
|
|
(format-time-string erc-debug-irc-protocol-time-format))))
|
2022-12-14 20:03:15 -08:00
|
|
|
(when (and outbound erc--debug-irc-protocol-mask-secrets)
|
2022-11-13 01:52:48 -08:00
|
|
|
(setq string (erc--mask-secrets string)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(with-current-buffer (get-buffer-create "*erc-protocol*")
|
2014-11-08 20:51:43 -05:00
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-max))
|
2022-09-02 21:57:57 -07:00
|
|
|
(let ((buffer-undo-list t)
|
|
|
|
(inhibit-read-only t))
|
2021-09-16 15:35:55 +02:00
|
|
|
(insert (if outbound
|
|
|
|
(concat ts esid " >> " string)
|
|
|
|
;; Cope with multi-line messages
|
|
|
|
(let ((lines (split-string string "[\r\n]+" t))
|
|
|
|
result)
|
|
|
|
(dolist (line lines)
|
|
|
|
(setq result (concat result ts esid
|
|
|
|
" << " line "\r\n")))
|
|
|
|
result)))))
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((orig-win (selected-window))
|
|
|
|
(debug-buffer-window (get-buffer-window (current-buffer) t)))
|
|
|
|
(when debug-buffer-window
|
|
|
|
(select-window debug-buffer-window)
|
|
|
|
(when (= 1 (count-lines (point) (point-max)))
|
|
|
|
(goto-char (point-max))
|
|
|
|
(recenter -1))
|
|
|
|
(select-window orig-win)))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-toggle-debug-irc-protocol (&optional arg)
|
|
|
|
"Toggle the value of `erc-debug-irc-protocol'.
|
|
|
|
|
|
|
|
If ARG is non-nil, show the *erc-protocol* buffer."
|
|
|
|
(interactive "P")
|
|
|
|
(let* ((buf (get-buffer-create "*erc-protocol*")))
|
|
|
|
(with-current-buffer buf
|
Make more erc function aliases obsolete
* lisp/erc/erc-compat.el (erc-propertize, erc-view-mode-enter)
(erc-function-arglist, erc-delete-dups)
(erc-replace-regexp-in-string): Make these aliases obsolete.
* lisp/erc/erc-capab.el (erc-capab-identify-add-prefix)
(erc-capab-identify-remove/set-identified-flag):
* lisp/erc/erc-dcc.el (erc-dcc-chat-parse-output)
(erc-dcc-unquote-filename, pcomplete/erc-mode/DCC):
* lisp/erc/erc-list.el (erc-list-menu-mode, erc-list-button)
(erc-list-make-string):
* lisp/erc/erc-log.el (erc-log-standardize-name):
* lisp/erc/erc-match.el (erc-log-matches-make-buffer):
* lisp/erc/erc-networks.el (erc-server-select):
* lisp/erc/erc.el (erc-message-english-PART)
(erc-update-mode-line-buffer, erc-format-my-nick)
(erc-format-@nick, erc-get-user-mode-prefix, erc-display-prompt)
(erc-part-reason-zippy, erc-quit-reason-zippy, erc-get-arglist)
(erc-toggle-debug-irc-protocol, erc-log-irc-protocol)
(erc-migrate-modules): Adjust callers.
2020-08-07 13:54:50 +02:00
|
|
|
(view-mode-enter)
|
2006-01-29 13:08:58 +00:00
|
|
|
(when (null (current-local-map))
|
2021-09-16 15:35:55 +02:00
|
|
|
(let ((inhibit-read-only t)
|
|
|
|
(msg (list
|
|
|
|
(concat "Version: " erc-debug-irc-protocol-version)
|
2021-10-09 14:59:43 +02:00
|
|
|
(concat "ERC-Version: " erc-version)
|
2021-09-16 15:35:55 +02:00
|
|
|
(concat "Emacs-Version: " emacs-version)
|
|
|
|
(erc-make-notice
|
|
|
|
(concat "This buffer displays all IRC protocol "
|
|
|
|
"traffic exchanged with servers."))
|
|
|
|
(erc-make-notice "Kill it to disable logging.")
|
2021-11-22 11:45:44 +01:00
|
|
|
(erc-make-notice (substitute-command-keys
|
|
|
|
"Press \\`t' to toggle.")))))
|
2021-09-16 15:35:55 +02:00
|
|
|
(insert (string-join msg "\r\n")))
|
2014-11-08 20:51:43 -05:00
|
|
|
(use-local-map (make-sparse-keymap))
|
|
|
|
(local-set-key (kbd "t") 'erc-toggle-debug-irc-protocol))
|
2006-01-29 13:08:58 +00:00
|
|
|
(add-hook 'kill-buffer-hook
|
2021-04-09 00:04:13 +02:00
|
|
|
(lambda () (setq erc-debug-irc-protocol nil))
|
2014-11-08 20:51:43 -05:00
|
|
|
nil 'local)
|
2006-01-29 13:08:58 +00:00
|
|
|
(goto-char (point-max))
|
|
|
|
(let ((inhibit-read-only t))
|
2021-09-16 15:35:55 +02:00
|
|
|
(insert (if erc-debug-irc-protocol "\r\n" "")
|
|
|
|
(erc-make-notice
|
|
|
|
(format "IRC protocol logging %s at %s"
|
2014-11-08 20:51:43 -05:00
|
|
|
(if erc-debug-irc-protocol "disabled" "enabled")
|
2021-09-16 15:35:55 +02:00
|
|
|
(current-time-string)))
|
|
|
|
(if erc-debug-irc-protocol "\r\n" "\r\n\r\n"))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(setq erc-debug-irc-protocol (not erc-debug-irc-protocol))
|
|
|
|
(if (and arg
|
2014-11-08 20:51:43 -05:00
|
|
|
(not (get-buffer-window "*erc-protocol*" t)))
|
|
|
|
(display-buffer buf t))
|
2006-01-29 13:08:58 +00:00
|
|
|
(message "IRC protocol traffic logging %s (see buffer *erc-protocol*)."
|
2014-11-08 20:51:43 -05:00
|
|
|
(if erc-debug-irc-protocol "enabled" "disabled"))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;;; I/O interface
|
|
|
|
|
|
|
|
;; send interface
|
|
|
|
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(defvar erc--send-action-function #'erc--send-action
|
|
|
|
"Function to display and send an outgoing CTCP ACTION message.
|
|
|
|
Called with three arguments: the submitted input, the current
|
|
|
|
target, and an `erc-server-send' FORCE flag.")
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-send-action (tgt str &optional force)
|
|
|
|
"Send CTCP ACTION information described by STR to TGT."
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(funcall erc--send-action-function tgt str force))
|
|
|
|
|
|
|
|
;; Sending and displaying are provided separately to afford modules
|
|
|
|
;; more flexibility, e.g., to forgo displaying on the way out when
|
|
|
|
;; expecting the server to echo messages back and/or to associate
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
;; outgoing messages with IDs generated for `erc--ephemeral'
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
;; placeholders.
|
|
|
|
(defun erc--send-action-perform-ctcp (target string force)
|
|
|
|
"Send STRING to TARGET, possibly immediately, with FORCE."
|
|
|
|
(erc-send-ctcp-message target (format "ACTION %s" string) force))
|
|
|
|
|
|
|
|
(defun erc--send-action-display (string)
|
|
|
|
"Display STRING as an outgoing \"CTCP ACTION\" message."
|
|
|
|
;; Allow hooks acting on inserted PRIVMSG and NOTICES to process us.
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(let ((erc--msg-prop-overrides `((erc--msg . msg)
|
|
|
|
(erc--ctcp . ACTION)
|
2023-09-02 13:43:22 -07:00
|
|
|
,@erc--msg-prop-overrides))
|
2023-06-24 18:33:20 -07:00
|
|
|
(nick (erc-current-nick)))
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(setq nick (propertize nick 'erc--speaker nick
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
'font-lock-face 'erc-my-nick-face))
|
2023-06-24 18:33:20 -07:00
|
|
|
(erc-display-message nil '(t action input) (current-buffer)
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
'ACTION ?n nick ?a string ?u "" ?h "")))
|
|
|
|
|
|
|
|
(defun erc--send-action (target string force)
|
|
|
|
"Display STRING, then send to TARGET as a \"CTCP ACTION\" message."
|
|
|
|
(erc--send-action-display string)
|
|
|
|
(erc--send-action-perform-ctcp target string force))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; Display interface
|
|
|
|
|
|
|
|
(defun erc-string-invisible-p (string)
|
|
|
|
"Check whether STRING is invisible or not.
|
|
|
|
I.e. any char in it has the `invisible' property set."
|
|
|
|
(text-property-any 0 (length string) 'invisible t string))
|
|
|
|
|
2008-01-25 03:28:10 +00:00
|
|
|
(defcustom erc-remove-parsed-property t
|
|
|
|
"Whether to remove the erc-parsed text property after displaying a message.
|
|
|
|
|
|
|
|
The default is to remove it, since it causes ERC to take up extra
|
|
|
|
memory. If you have code that relies on this property, then set
|
2023-10-03 00:00:19 -07:00
|
|
|
this option to nil.
|
|
|
|
|
|
|
|
Note that this option is deprecated because a value of nil is
|
|
|
|
impractical in prolonged sessions with more than a few channels.
|
|
|
|
Use `erc-insert-post-hook' or similar and the helper function
|
|
|
|
`erc-find-parsed-property' and friends to stash the current
|
|
|
|
`erc-response' object as needed. And instead of using this for
|
|
|
|
debugging purposes, try `erc-debug-irc-protocol'."
|
2008-01-25 03:28:10 +00:00
|
|
|
:type 'boolean
|
|
|
|
:group 'erc)
|
2023-10-03 00:00:19 -07:00
|
|
|
(make-obsolete-variable 'erc-remove-parsed-property
|
|
|
|
"impractical when non-nil" "30.1")
|
2008-01-25 03:28:10 +00:00
|
|
|
|
2023-02-19 21:33:36 -08:00
|
|
|
(define-inline erc--assert-input-bounds ()
|
|
|
|
(inline-quote
|
|
|
|
(progn (when (and (processp erc-server-process)
|
|
|
|
(eq (current-buffer) (process-buffer erc-server-process)))
|
|
|
|
;; It's believed that these only need syncing immediately
|
|
|
|
;; following the first two insertions in a server buffer.
|
|
|
|
(set-marker (process-mark erc-server-process) erc-insert-marker))
|
|
|
|
(cl-assert (< erc-insert-marker erc-input-marker))
|
|
|
|
(cl-assert (= (field-end erc-insert-marker) erc-input-marker)))))
|
|
|
|
|
2023-11-18 23:04:50 -08:00
|
|
|
(defvar erc--merge-prop-behind-p nil
|
|
|
|
"When non-nil, put merged prop(s) behind existing.")
|
|
|
|
|
|
|
|
(defvar erc--refresh-prompt-hook nil
|
|
|
|
"Hook called after refreshing the prompt in the affected buffer.")
|
|
|
|
|
|
|
|
(defvar-local erc--inhibit-prompt-display-property-p nil
|
|
|
|
"Tell `erc-prompt' related functions to avoid the `display' text prop.
|
|
|
|
Modules can enable this when needing to reserve the prompt's
|
|
|
|
display property for some other purpose, such as displaying it
|
|
|
|
elsewhere, abbreviating it, etc.")
|
|
|
|
|
|
|
|
(defconst erc--prompt-properties '( rear-nonsticky t
|
|
|
|
erc-prompt t ; t or `hidden'
|
|
|
|
field erc-prompt
|
|
|
|
front-sticky t
|
|
|
|
read-only t)
|
|
|
|
"Mandatory text properties added to ERC's prompt.")
|
|
|
|
|
|
|
|
(defvar erc--refresh-prompt-continue-request nil
|
|
|
|
"State flag for refreshing prompt in all buffers.
|
|
|
|
When the value is zero, functions assigned to the variable
|
|
|
|
`erc-prompt' can set this to run `erc--refresh-prompt-hook' (1)
|
|
|
|
or `erc--refresh-prompt' (2) in all buffers of the server.")
|
|
|
|
|
|
|
|
(defun erc--refresh-prompt-continue (&optional hooks-only-p)
|
|
|
|
"Ask ERC to refresh the prompt in all buffers.
|
|
|
|
Functions assigned to `erc-prompt' can call this if needing to
|
|
|
|
recreate the prompt in other buffers as well. With HOOKS-ONLY-P,
|
|
|
|
run `erc--refresh-prompt-hook' in other buffers instead of doing
|
|
|
|
a full refresh."
|
|
|
|
(when (and erc--refresh-prompt-continue-request
|
|
|
|
(zerop erc--refresh-prompt-continue-request))
|
|
|
|
(setq erc--refresh-prompt-continue-request (if hooks-only-p 1 2))))
|
Make erc-fill-wrap work with left-sided stamps
* etc/ERC-NEWS: Remove all mention of option `erc-timestamp-align-to'
supporting a value of `margin', which has been abandoned. Do mention
leading white space before stamps now having stamp-related properties.
* lisp/erc/erc-backend.el (erc--reveal-prompt, erc--conceal-prompt):
New generic functions with default implementations factored out from
`erc--unhide-prompt' and `erc--hide-prompt'.
(erc--prompt-hidden-p): New internal predicate function.
(erc--unhide-prompt): Defer to `erc--reveal-prompt', and set
`erc-prompt' text property to t.
(erc--hide-prompt): Defer to `erc--conceal-prompt', and set
`erc-prompt' text property to `hidden'.
* lisp/erc/erc-compat.el (erc-compat--29-browse-url-irc): Don't
use `function-equal'.
* lisp/erc/erc-fill.el (erc-fill-wrap-margin-width,
erc-fill-wrap-margin-side): New options to control side and initial
width of `fill-wrap' margin.
(erc-fill--wrap-beginning-of-line): Fix bug involving non-string
valued `display' props.
(erc-fill-wrap-toggle-truncate-lines): New command to re-enable
`visual-line-mode' when toggling off `truncate-lines'.
(erc-fill-wrap-mode-map): Remap `toggle-truncate-lines' to
`erc-fill-wrap-toggle-truncate-lines'.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Update doc string, persist a few local vars, and conditionally set
`erc-stamp--margin-left-p'. When deactivating, disable
`visual-line-mode' first.
(erc-fill--wrap-continued-message-p): Use `erc-speaker' instead of
heuristics when comparing nicks between consecutive messages.
(erc-fill-wrap-nudge): Update doc string and account for left-sided
stamps.
(erc-timestamp-offset): Add comment regarding conditional guard based
on function-valued option.
* lisp/erc/erc-stamp.el (erc-timestamp-use-align-to): Remove value
variant `margin', which was originally intended to be new in ERC 5.6.
This functionality was all but useless without the internal minor mode
`erc-stamp--display-margin-mode' active.
(erc-stamp-right-margin-width): Remove unused option new in 5.6.
(erc-stamp--display-margin-force): Remove unused function.
(erc-stamp--margin-width, erc-stamp--margin-left-p): New internal
variables.
(erc-stamp--init-margins-on-connect): New function for initializing
mode-managed margin after connecting.
(erc-stamp--adjust-right-margin, erc-stamp--adjust-margin): Rename
function to latter and accommodate left-hand stamps.
(erc-stamp--inherited-props): Move definition higher up in same file.
(erc-stamp--display-margin-mode): Update function name, and adjust
setup and teardown to accommodate left-handed stamps. Don't add
advice around `erc-insert-timestamp-function'.
(erc-stamp--last-prompt, erc-stamp--display-prompt-in-left-margin):
New function and helper var to convert a normal inserted prompt so
that it appears in the left margin.
(erc-stamp--refresh-left-margin-prompt): Helper for other modules to
quickly refresh prompt outside of insert hooks.
(erc--reveal-prompt, erc--conceal-prompt): New implementations for
when `erc-stamp--display-margin-mode' is active.
(erc-insert-timestamp-left): Convert to generic function and provide
implementation for `erc-stamp--display-margin-mode'.
(erc-stamp--omit-properties-on-folded-lines): New variable, an escape
hatch for propertizing white space before right-side stamps folded
over onto another line.
(erc-insert-timestamp-right): Don't expect `erc-timestamp-align-to' to
ever be the symbol `margin'. Move handling for that case to one
contingent on the internal minor mode `erc-stamp--display-margin-mode'
being active. Add text properties preceding stamps that occupy a line
by their lonesome. See related news entry for rationale. This is
arguably a breaking change.
* lisp/erc/erc.el (erc--refresh-prompt-hook): New hook variable for
modules to adjust prompt properties whenever it's refreshed.
(erc--refresh-prompt): Fix bug in which user-defined prompt functions
failed to hide when quitting in server buffers. Run new hook
`erc--refresh-prompt-hook'.
(erc-display-prompt): Add comment noting that the text property
`erc-prompt' now actually matters: it's t while a session is running
and `hidden' when disconnected.
* test/lisp/erc/erc-fill-tests.el (erc-fill--left-hand-stamps): New
test.
* test/lisp/erc/erc-stamp-tests.el
(erc-stamp-tests--use-align-to--nil,
erc-stamp-tests--use-align-to--t): New functions forged from old test
bodies to allow optionally asserting pre-5.6 behavior regarding
leading white space on right-hand stamps that exist on their own line.
(erc-timestamp-use-align-to--nil, erc-timestamp-use-align-to--t):
Parameterize with compatibility flag.
(erc-timestamp-use-align-to--margin,
erc-stamp--display-margin-mode--right): Rename test to latter.
* test/lisp/erc/erc-tests.el (erc-hide-prompt): Add some assertions
for new possible value of `erc-prompt' text property.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: New test
data file. (Bug#60936)
2023-07-14 06:12:30 -07:00
|
|
|
|
2023-05-18 23:47:27 -07:00
|
|
|
(defun erc--refresh-prompt ()
|
|
|
|
"Re-render ERC's prompt when the option `erc-prompt' is a function."
|
|
|
|
(erc--assert-input-bounds)
|
Make erc-fill-wrap work with left-sided stamps
* etc/ERC-NEWS: Remove all mention of option `erc-timestamp-align-to'
supporting a value of `margin', which has been abandoned. Do mention
leading white space before stamps now having stamp-related properties.
* lisp/erc/erc-backend.el (erc--reveal-prompt, erc--conceal-prompt):
New generic functions with default implementations factored out from
`erc--unhide-prompt' and `erc--hide-prompt'.
(erc--prompt-hidden-p): New internal predicate function.
(erc--unhide-prompt): Defer to `erc--reveal-prompt', and set
`erc-prompt' text property to t.
(erc--hide-prompt): Defer to `erc--conceal-prompt', and set
`erc-prompt' text property to `hidden'.
* lisp/erc/erc-compat.el (erc-compat--29-browse-url-irc): Don't
use `function-equal'.
* lisp/erc/erc-fill.el (erc-fill-wrap-margin-width,
erc-fill-wrap-margin-side): New options to control side and initial
width of `fill-wrap' margin.
(erc-fill--wrap-beginning-of-line): Fix bug involving non-string
valued `display' props.
(erc-fill-wrap-toggle-truncate-lines): New command to re-enable
`visual-line-mode' when toggling off `truncate-lines'.
(erc-fill-wrap-mode-map): Remap `toggle-truncate-lines' to
`erc-fill-wrap-toggle-truncate-lines'.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Update doc string, persist a few local vars, and conditionally set
`erc-stamp--margin-left-p'. When deactivating, disable
`visual-line-mode' first.
(erc-fill--wrap-continued-message-p): Use `erc-speaker' instead of
heuristics when comparing nicks between consecutive messages.
(erc-fill-wrap-nudge): Update doc string and account for left-sided
stamps.
(erc-timestamp-offset): Add comment regarding conditional guard based
on function-valued option.
* lisp/erc/erc-stamp.el (erc-timestamp-use-align-to): Remove value
variant `margin', which was originally intended to be new in ERC 5.6.
This functionality was all but useless without the internal minor mode
`erc-stamp--display-margin-mode' active.
(erc-stamp-right-margin-width): Remove unused option new in 5.6.
(erc-stamp--display-margin-force): Remove unused function.
(erc-stamp--margin-width, erc-stamp--margin-left-p): New internal
variables.
(erc-stamp--init-margins-on-connect): New function for initializing
mode-managed margin after connecting.
(erc-stamp--adjust-right-margin, erc-stamp--adjust-margin): Rename
function to latter and accommodate left-hand stamps.
(erc-stamp--inherited-props): Move definition higher up in same file.
(erc-stamp--display-margin-mode): Update function name, and adjust
setup and teardown to accommodate left-handed stamps. Don't add
advice around `erc-insert-timestamp-function'.
(erc-stamp--last-prompt, erc-stamp--display-prompt-in-left-margin):
New function and helper var to convert a normal inserted prompt so
that it appears in the left margin.
(erc-stamp--refresh-left-margin-prompt): Helper for other modules to
quickly refresh prompt outside of insert hooks.
(erc--reveal-prompt, erc--conceal-prompt): New implementations for
when `erc-stamp--display-margin-mode' is active.
(erc-insert-timestamp-left): Convert to generic function and provide
implementation for `erc-stamp--display-margin-mode'.
(erc-stamp--omit-properties-on-folded-lines): New variable, an escape
hatch for propertizing white space before right-side stamps folded
over onto another line.
(erc-insert-timestamp-right): Don't expect `erc-timestamp-align-to' to
ever be the symbol `margin'. Move handling for that case to one
contingent on the internal minor mode `erc-stamp--display-margin-mode'
being active. Add text properties preceding stamps that occupy a line
by their lonesome. See related news entry for rationale. This is
arguably a breaking change.
* lisp/erc/erc.el (erc--refresh-prompt-hook): New hook variable for
modules to adjust prompt properties whenever it's refreshed.
(erc--refresh-prompt): Fix bug in which user-defined prompt functions
failed to hide when quitting in server buffers. Run new hook
`erc--refresh-prompt-hook'.
(erc-display-prompt): Add comment noting that the text property
`erc-prompt' now actually matters: it's t while a session is running
and `hidden' when disconnected.
* test/lisp/erc/erc-fill-tests.el (erc-fill--left-hand-stamps): New
test.
* test/lisp/erc/erc-stamp-tests.el
(erc-stamp-tests--use-align-to--nil,
erc-stamp-tests--use-align-to--t): New functions forged from old test
bodies to allow optionally asserting pre-5.6 behavior regarding
leading white space on right-hand stamps that exist on their own line.
(erc-timestamp-use-align-to--nil, erc-timestamp-use-align-to--t):
Parameterize with compatibility flag.
(erc-timestamp-use-align-to--margin,
erc-stamp--display-margin-mode--right): Rename test to latter.
* test/lisp/erc/erc-tests.el (erc-hide-prompt): Add some assertions
for new possible value of `erc-prompt' text property.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: New test
data file. (Bug#60936)
2023-07-14 06:12:30 -07:00
|
|
|
(unless (erc--prompt-hidden-p)
|
2023-11-18 23:04:50 -08:00
|
|
|
(let ((erc--refresh-prompt-continue-request
|
|
|
|
(or erc--refresh-prompt-continue-request 0)))
|
|
|
|
(when (functionp erc-prompt)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (1- erc-input-marker))
|
|
|
|
;; Avoid `erc-prompt' (the named function), which appends a
|
|
|
|
;; space, and `erc-display-prompt', which propertizes all
|
|
|
|
;; but that space.
|
|
|
|
(let ((s (funcall erc-prompt))
|
|
|
|
(p (point))
|
|
|
|
(erc--merge-prop-behind-p t))
|
|
|
|
(erc--merge-prop 0 (length s) 'font-lock-face 'erc-prompt-face s)
|
|
|
|
(add-text-properties 0 (length s) erc--prompt-properties s)
|
|
|
|
(insert s)
|
|
|
|
(delete-region erc-insert-marker p))))
|
|
|
|
(run-hooks 'erc--refresh-prompt-hook)
|
|
|
|
(when-let (((> erc--refresh-prompt-continue-request 0))
|
|
|
|
(n erc--refresh-prompt-continue-request)
|
|
|
|
(erc--refresh-prompt-continue-request -1)
|
|
|
|
(b (current-buffer)))
|
|
|
|
(erc-with-all-buffers-of-server erc-server-process
|
|
|
|
(lambda () (not (eq b (current-buffer))))
|
|
|
|
(if (= n 1)
|
|
|
|
(run-hooks 'erc--refresh-prompt-hook)
|
|
|
|
(erc--refresh-prompt)))))))
|
2023-05-18 23:47:27 -07:00
|
|
|
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(defun erc--check-msg-prop (prop &optional val)
|
|
|
|
"Return PROP's value in `erc--msg-props' when populated.
|
|
|
|
If VAL is a list, return non-nil if PROP appears in VAL. If VAL
|
|
|
|
is otherwise non-nil, return non-nil if VAL compares `eq' to the
|
|
|
|
stored value. Otherwise, return the stored value."
|
|
|
|
(and-let* ((erc--msg-props)
|
|
|
|
(v (gethash prop erc--msg-props)))
|
|
|
|
(if (consp val) (memq v val) (if val (eq v val) v))))
|
|
|
|
|
|
|
|
(defmacro erc--get-inserted-msg-bounds (&optional only point)
|
|
|
|
"Return the bounds of a message in an ERC buffer.
|
|
|
|
Return ONLY one side when the first arg is `end' or `beg'. With
|
|
|
|
POINT, search from POINT instead of `point'."
|
2023-11-03 16:07:20 -07:00
|
|
|
;; TODO add edebug spec.
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
`(let* ((point ,(or point '(point)))
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(at-start-p (get-text-property point 'erc--msg)))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(and-let*
|
2023-11-03 16:07:20 -07:00
|
|
|
(,@(and (member only '(nil beg 'beg))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
'((b (or (and at-start-p point)
|
|
|
|
(and-let*
|
|
|
|
((p (previous-single-property-change point
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
'erc--msg)))
|
2023-11-03 16:07:20 -07:00
|
|
|
(if (= p (1- point))
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(if (get-text-property p 'erc--msg) p (1- p))
|
2023-11-03 16:07:20 -07:00
|
|
|
(1- p)))))))
|
|
|
|
,@(and (member only '(nil end 'end))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
'((e (1- (next-single-property-change
|
|
|
|
(if at-start-p (1+ point) point)
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
'erc--msg nil erc-insert-marker))))))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
,(pcase only
|
|
|
|
('(quote beg) 'b)
|
|
|
|
('(quote end) 'e)
|
|
|
|
(_ '(cons b e))))))
|
|
|
|
|
|
|
|
(defun erc--get-inserted-msg-prop (prop)
|
|
|
|
"Return the value of text property PROP for some message at point."
|
|
|
|
(and-let* ((stack-pos (erc--get-inserted-msg-bounds 'beg)))
|
|
|
|
(get-text-property stack-pos prop)))
|
|
|
|
|
|
|
|
(defmacro erc--with-inserted-msg (&rest body)
|
|
|
|
"Simulate narrowing performed for send and insert hooks, and run BODY.
|
|
|
|
Expect callers to know that this doesn't wrap BODY in
|
|
|
|
`with-silent-modifications' or bind a temporary `erc--msg-props'."
|
|
|
|
`(when-let ((bounds (erc--get-inserted-msg-bounds)))
|
|
|
|
(save-restriction
|
|
|
|
(narrow-to-region (car bounds) (1+ (cdr bounds)))
|
|
|
|
,@body)))
|
|
|
|
|
|
|
|
(defun erc--traverse-inserted (beg end fn)
|
2023-10-21 13:53:46 -07:00
|
|
|
"Visit messages between BEG and END and run FN in narrowed buffer.
|
|
|
|
If END is a marker, possibly update its position."
|
|
|
|
(unless (markerp end)
|
|
|
|
(setq end (set-marker (make-marker) (or end erc-insert-marker))))
|
|
|
|
(unless (eq end erc-insert-marker)
|
|
|
|
(set-marker end (min erc-insert-marker end)))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(save-excursion
|
|
|
|
(goto-char beg)
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(let ((b (if (get-text-property (point) 'erc--msg)
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(point)
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(next-single-property-change (point) 'erc--msg nil end))))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(while-let ((b)
|
|
|
|
((< b end))
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(e (next-single-property-change (1+ b) 'erc--msg nil end)))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(save-restriction
|
|
|
|
(narrow-to-region b e)
|
|
|
|
(funcall fn))
|
2023-10-21 13:53:46 -07:00
|
|
|
(setq b e))))
|
|
|
|
(unless (eq end erc-insert-marker)
|
|
|
|
(set-marker end nil)))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
|
2023-11-04 11:08:22 -07:00
|
|
|
(defvar erc--insert-line-function nil
|
|
|
|
"When non-nil, an alterntive to `insert' for inserting messages.")
|
|
|
|
|
2023-10-02 22:59:22 -07:00
|
|
|
(defvar erc--insert-marker nil
|
|
|
|
"Internal override for `erc-insert-marker'.")
|
|
|
|
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
(define-obsolete-function-alias 'erc-display-line-1 'erc-insert-line "30.1")
|
|
|
|
(defun erc-insert-line (string buffer)
|
|
|
|
"Insert STRING in an `erc-mode' BUFFER.
|
|
|
|
When STRING is nil, do nothing. Otherwise, start off by running
|
|
|
|
`erc-insert-pre-hook' in BUFFER with `erc-insert-this' bound to
|
|
|
|
t. If the latter remains non-nil afterward, insert STRING into
|
|
|
|
BUFFER, ensuring a trailing newline. After that, narrow BUFFER
|
|
|
|
around STRING, along with its final line ending, and run
|
|
|
|
`erc-insert-modify' and `erc-insert-post-hook', respectively. In
|
|
|
|
all cases, run `erc-insert-done-hook' unnarrowed before exiting,
|
|
|
|
and update positions in `buffer-undo-list'.
|
|
|
|
|
|
|
|
In general, expect to be called from a higher-level insertion
|
|
|
|
function, like `erc-display-message', especially when modules
|
|
|
|
should consider STRING as a candidate for formatting with
|
|
|
|
enhancements like indentation, fontification, timestamping, etc.
|
|
|
|
Otherwise, when called directly, allow built-in modules to ignore
|
|
|
|
STRING, which may make it appear incongruous in situ (unless
|
|
|
|
preformatted or anticipated by third-party members of the various
|
|
|
|
modification hooks)."
|
2006-01-29 13:08:58 +00:00
|
|
|
(when string
|
* url-util.el (url-insert-entities-in-string):
* url-nfs.el (url-nfs-unescape):
* url-ldap.el (url-ldap):
* url-imap.el (url-imap):
* url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer.
* erc.el (erc-display-line-1, erc-process-away):
* erc-truncate.el (erc-truncate-buffer-to-size):
Use with-current-buffer.
* term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos):
* play/mpuz.el (mpuz-create-buffer):
* play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell)
(lm-print-y,s,noise, lm-print-w0, lm-init):
* play/gomoku.el (gomoku-prompt-for-move):
* play/fortune.el (fortune-in-buffer):
* play/dissociate.el (dissociated-press):
* play/decipher.el (decipher-adjacency-list, decipher-display-regexp)
(decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer):
* mail/supercite.el (sc-eref-show):
* mail/smtpmail.el (smtpmail-send-it):
* mail/rmailsum.el (rmail-summary-next-labeled-message)
(rmail-summary-previous-labeled-message, rmail-summary-wipe)
(rmail-summary-undelete-many, rmail-summary-rmail-update)
(rmail-summary-goto-msg, rmail-summary-expunge)
(rmail-summary-get-new-mail, rmail-summary-search-backward)
(rmail-summary-add-label, rmail-summary-output-menu)
(rmail-summary-output-body):
* mail/rfc822.el (rfc822-addresses):
* mail/reporter.el (reporter-dump-variable, reporter-dump-state):
* mail/mailpost.el (post-mail-send-it):
* mail/hashcash.el (hashcash-generate-payment):
* mail/feedmail.el (feedmail-run-the-queue)
(feedmail-queue-send-edit-prompt-help-first)
(feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater)
(feedmail-deduce-address-list):
* eshell/esh-ext.el (eshell-remote-command):
* eshell/em-unix.el (eshell-occur-mode-mouse-goto):
* emulation/viper-util.el (viper-glob-unix-files, viper-save-setting)
(viper-wildcard-to-regexp, viper-glob-mswindows-files)
(viper-save-string-in-file, viper-valid-marker):
* emulation/viper-keym.el (viper-toggle-key):
* emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file)
(ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit)
(ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile):
* emulation/viper-cmd.el (viper-exec-form-in-vi)
(viper-exec-form-in-emacs, viper-brac-function):
* emulation/viper.el (viper-delocalize-var):
* emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat)
(vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer)
(vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark)
(ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command):
* emulation/vi.el (vi-switch-mode, vi-ex-cmd):
* emulation/edt.el (edt-electric-helpify):
* emulation/cua-rect.el (cua--rectangle-aux-replace):
* emulation/cua-gmrk.el (cua--insert-at-global-mark)
(cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark)
(cua-indent-to-global-mark-column):
* calendar/diary-lib.el (calendar-mark-1):
* calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern):
Use with-current-buffer.
* emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
|
|
|
(with-current-buffer (or buffer (process-buffer erc-server-process))
|
2023-02-19 21:33:36 -08:00
|
|
|
(let ((insert-position (marker-position erc-insert-marker)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((string string) ;; FIXME! Can this be removed?
|
|
|
|
(buffer-undo-list t)
|
|
|
|
(inhibit-read-only t))
|
|
|
|
(unless (string-match "\n$" string)
|
|
|
|
(setq string (concat string "\n"))
|
|
|
|
(when (erc-string-invisible-p string)
|
|
|
|
(erc-put-text-properties 0 (length string)
|
|
|
|
'(invisible intangible) string)))
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
(erc-log (concat "erc-display-message: " string
|
2014-11-08 20:51:43 -05:00
|
|
|
(format "(%S)" string) " in buffer "
|
|
|
|
(format "%s" buffer)))
|
|
|
|
(setq erc-insert-this t)
|
|
|
|
(run-hook-with-args 'erc-insert-pre-hook string)
|
2023-10-02 22:59:22 -07:00
|
|
|
(setq insert-position (marker-position (or erc--insert-marker
|
|
|
|
erc-insert-marker)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(if (null erc-insert-this)
|
|
|
|
;; Leave erc-insert-this set to t as much as possible. Fran
|
|
|
|
;; Litterio <franl> has seen erc-insert-this set to nil while
|
|
|
|
;; erc-send-pre-hook is running, which should never happen. This
|
|
|
|
;; may cure it.
|
|
|
|
(setq erc-insert-this t)
|
|
|
|
(save-excursion ;; to restore point in the new buffer
|
|
|
|
(save-restriction
|
|
|
|
(widen)
|
|
|
|
(goto-char insert-position)
|
2023-11-04 11:08:22 -07:00
|
|
|
(if erc--insert-line-function
|
|
|
|
(funcall erc--insert-line-function string)
|
|
|
|
(insert string))
|
2023-02-19 21:33:36 -08:00
|
|
|
(erc--assert-input-bounds)
|
2014-11-08 20:51:43 -05:00
|
|
|
;; run insertion hook, with point at restored location
|
|
|
|
(save-restriction
|
|
|
|
(narrow-to-region insert-position (point))
|
|
|
|
(run-hooks 'erc-insert-modify-hook)
|
|
|
|
(run-hooks 'erc-insert-post-hook)
|
|
|
|
(when erc-remove-parsed-property
|
|
|
|
(remove-text-properties (point-min) (point-max)
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
'(erc-parsed nil tags nil)))
|
|
|
|
(cl-assert (> (- (point-max) (point-min)) 1))
|
|
|
|
(let ((props (if erc--msg-props
|
|
|
|
(erc--order-text-properties-from-hash
|
|
|
|
erc--msg-props)
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
'(erc--msg unknown))))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(add-text-properties (point-min) (1+ (point-min)) props)))
|
2023-05-18 23:47:27 -07:00
|
|
|
(erc--refresh-prompt)))))
|
2019-10-23 11:55:13 +02:00
|
|
|
(run-hooks 'erc-insert-done-hook)
|
2023-10-02 22:59:22 -07:00
|
|
|
(erc-update-undo-list (- (or (marker-position (or erc--insert-marker
|
|
|
|
erc-insert-marker))
|
2014-11-08 20:51:43 -05:00
|
|
|
(point-max))
|
|
|
|
insert-position))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-update-undo-list (shift)
|
|
|
|
;; Translate buffer positions in buffer-undo-list by SHIFT.
|
|
|
|
(unless (or (zerop shift) (atom buffer-undo-list))
|
|
|
|
(let ((list buffer-undo-list) elt)
|
|
|
|
(while list
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq elt (car list))
|
|
|
|
(cond ((integerp elt) ; POSITION
|
|
|
|
(cl-incf (car list) shift))
|
|
|
|
((or (atom elt) ; nil, EXTENT
|
|
|
|
;; (eq t (car elt)) ; (t . TIME)
|
|
|
|
(markerp (car elt))) ; (MARKER . DISTANCE)
|
|
|
|
nil)
|
|
|
|
((integerp (car elt)) ; (BEGIN . END)
|
|
|
|
(cl-incf (car elt) shift)
|
|
|
|
(cl-incf (cdr elt) shift))
|
|
|
|
((stringp (car elt)) ; (TEXT . POSITION)
|
|
|
|
(cl-incf (cdr elt) (* (if (natnump (cdr elt)) 1 -1) shift)))
|
|
|
|
((null (car elt)) ; (nil PROPERTY VALUE BEG . END)
|
|
|
|
(let ((cons (nthcdr 3 elt)))
|
|
|
|
(cl-incf (car cons) shift)
|
2019-06-20 01:44:19 +02:00
|
|
|
(cl-incf (cdr cons) shift))))
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq list (cdr list))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defvar erc-valid-nick-regexp "[]a-zA-Z^[;\\`_{}|][]^[;\\`_{}|a-zA-Z0-9-]*"
|
2008-02-05 13:00:43 +00:00
|
|
|
"Regexp which matches all valid characters in a IRC nickname.")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-is-valid-nick-p (nick)
|
|
|
|
"Check if NICK is a valid IRC nickname."
|
2015-03-16 14:49:01 -04:00
|
|
|
(string-match (concat "\\`" erc-valid-nick-regexp "\\'") nick))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
(defun erc--route-insertion (string buffer)
|
|
|
|
"Insert STRING in BUFFER.
|
|
|
|
See `erc-display-message' for acceptable BUFFER types."
|
|
|
|
(let (seen msg-props)
|
2006-01-29 13:08:58 +00:00
|
|
|
(dolist (buf (cond
|
2014-11-08 20:51:43 -05:00
|
|
|
((bufferp buffer) (list buffer))
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
((consp buffer)
|
|
|
|
(setq msg-props erc--msg-props)
|
|
|
|
buffer)
|
2014-11-08 20:51:43 -05:00
|
|
|
((processp buffer) (list (process-buffer buffer)))
|
|
|
|
((eq 'all buffer)
|
|
|
|
;; Hmm, or all of the same session server?
|
|
|
|
(erc-buffer-list nil erc-server-process))
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
((and-let* (((eq 'active buffer))
|
|
|
|
(b (erc-active-buffer)))
|
|
|
|
(list b)))
|
2014-11-08 20:51:43 -05:00
|
|
|
((erc-server-buffer-live-p)
|
|
|
|
(list (process-buffer erc-server-process)))
|
|
|
|
(t (list (current-buffer)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(when (buffer-live-p buf)
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
(when msg-props
|
|
|
|
(setq erc--msg-props (copy-hash-table msg-props)))
|
|
|
|
(erc-insert-line string buf)
|
|
|
|
(setq seen t)))
|
|
|
|
(unless (or seen (null buffer))
|
|
|
|
(erc--route-insertion string nil))))
|
|
|
|
|
|
|
|
(defun erc-display-line (string &optional buffer)
|
|
|
|
"Insert STRING in BUFFER as a plain \"local\" message.
|
|
|
|
Take pains to ensure modification hooks see messages created by
|
|
|
|
the old pattern (erc-display-line (erc-make-notice) my-buffer) as
|
|
|
|
being equivalent to a `erc-display-message' TYPE of `notice'."
|
|
|
|
(let ((erc--msg-prop-overrides erc--msg-prop-overrides))
|
|
|
|
(when (eq 'erc-notice-face (get-text-property 0 'font-lock-face string))
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(unless (assq 'erc--msg erc--msg-prop-overrides)
|
|
|
|
(push '(erc--msg . notice) erc--msg-prop-overrides)))
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
(erc-display-message nil nil buffer string)))
|
|
|
|
|
|
|
|
(defvar erc--merge-text-properties-p nil
|
2023-06-24 18:33:20 -07:00
|
|
|
"Non-nil when `erc-put-text-property' defers to `erc--merge-prop'.")
|
|
|
|
|
Improve ERC's internal invisibility API
* etc/ERC-NEWS: Mention that line endings have moved from the end to
the beginning of hidden messages.
* lisp/erc/erc-fill.el (erc-fill--wrap-ensure-dependencies): Warn when
users have `erc-legacy-invisible-bounds-p' enabled, and force it to
its default value of nil in the current buffer.
(erc-fill-wrap-mode, erc-fill-wrap-enable): Move business involving
compat variable for enabling legacy hidden-message behavior to helper.
* lisp/erc/erc-match.el (erc-match--hide-fools-offset-bounds): Move
internal variable from to main library file and rename to
`erc-legacy-invisible-bounds-p'. Also make obsolete and flip
semantics so a non-nil value enables the traditional behavior.
(erc-match--hide-message): Move to main library file and rename to
`erc--hide-message'. Add a property-value parameter instead of
hard-coding to `erc-match'. Also, condition behavior on renamed
compatibility flag `erc-legacy-invisible-bounds-p'.
(erc-hide-fools): Call `erc--hide-message' with own value for
`invisible' property specifically for fools. That is, use
`match-fools' rather than `erc-match' or `erc-match-fools' to save
room when visually inspecting. This retains the module name as a
prefix to hopefully minimize collisions with invisibility spec members
owned by non-ERC minor modes. The `timestamp' spec member owned by
erc-stamp likewise lacks a namespace prefix, but its feature/group
affiliation is self-evident.
(erc-match--modify-invisibility-spec): Use toggle command
non-interactively for adding and removing invisibility spec member.
(erc-match-toggle-hidden-fools): Add explicit override argument and
defer to general helper for actually modifying spec.
(erc-match--toggle-hidden): New helper for toggling invisibility
spec.
* lisp/erc/erc.el (erc--merge-prop): If new value is a list, prepend
onto existing. Add note about possible space optimization.
(erc-legacy-invisible-bounds-p): New obsolete compat variable to
enable traditional pre-5.6 invisibility interval on hidden messages.
Replaces `erc-match--hide-fools-offset-bounds-p' but has an inverted
meaning. The new default value of nil means invisibility covers a
shifted interval consisting of the message body plus the line ending
immediately preceding it.
(erc--hide-message): New function, formerly `erc-match--hide-message'
from erc-match.el introduced in ERC 5.6.
* test/lisp/erc/erc-scenarios-match.el:
(erc-scenarios-match--invisible-stamp): Fix comment and use API
function in interactive convenience setup.
(erc-scenarios-match--find-bol): New test helper.
(erc-scenarios-match--find-eol): Fix bug affecting interactive use.
(erc-scenarios-match--stamp-left-fools-invisible,
erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-right-invisible-fill-wrap,
erc-scenarios-match--stamp-both-invisible-fill-static): Update
`invisible' property from `erc-match' to `match-fools'.
(erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-both-invisible-fill-static): Move test
body to function of same name for use in multiple cases.
(erc-scenarios-match--stamp-right-fools-invisible--nooffset,
erc-scenarios-match--stamp-both-invisible-fill-static--nooffset): New
test variants asserting proper hiding with old pre-5.6 invisibility
interval.
* test/lisp/erc/erc-tests.el (erc-tests--equal-including-properties):
Relocate macro higher in same file.
(erc--merge-prop): New test. (Bug#64301)
2023-07-14 21:08:31 -07:00
|
|
|
;; To save space, we could maintain a map of all readable property
|
|
|
|
;; values and optionally dispense archetypal constants in their place
|
|
|
|
;; in order to ensure all occurrences of some list (a b) across all
|
|
|
|
;; text-properties in all ERC buffers are actually the same object.
|
2023-06-24 18:33:20 -07:00
|
|
|
(defun erc--merge-prop (from to prop val &optional object)
|
Improve ERC's internal invisibility API
* etc/ERC-NEWS: Mention that line endings have moved from the end to
the beginning of hidden messages.
* lisp/erc/erc-fill.el (erc-fill--wrap-ensure-dependencies): Warn when
users have `erc-legacy-invisible-bounds-p' enabled, and force it to
its default value of nil in the current buffer.
(erc-fill-wrap-mode, erc-fill-wrap-enable): Move business involving
compat variable for enabling legacy hidden-message behavior to helper.
* lisp/erc/erc-match.el (erc-match--hide-fools-offset-bounds): Move
internal variable from to main library file and rename to
`erc-legacy-invisible-bounds-p'. Also make obsolete and flip
semantics so a non-nil value enables the traditional behavior.
(erc-match--hide-message): Move to main library file and rename to
`erc--hide-message'. Add a property-value parameter instead of
hard-coding to `erc-match'. Also, condition behavior on renamed
compatibility flag `erc-legacy-invisible-bounds-p'.
(erc-hide-fools): Call `erc--hide-message' with own value for
`invisible' property specifically for fools. That is, use
`match-fools' rather than `erc-match' or `erc-match-fools' to save
room when visually inspecting. This retains the module name as a
prefix to hopefully minimize collisions with invisibility spec members
owned by non-ERC minor modes. The `timestamp' spec member owned by
erc-stamp likewise lacks a namespace prefix, but its feature/group
affiliation is self-evident.
(erc-match--modify-invisibility-spec): Use toggle command
non-interactively for adding and removing invisibility spec member.
(erc-match-toggle-hidden-fools): Add explicit override argument and
defer to general helper for actually modifying spec.
(erc-match--toggle-hidden): New helper for toggling invisibility
spec.
* lisp/erc/erc.el (erc--merge-prop): If new value is a list, prepend
onto existing. Add note about possible space optimization.
(erc-legacy-invisible-bounds-p): New obsolete compat variable to
enable traditional pre-5.6 invisibility interval on hidden messages.
Replaces `erc-match--hide-fools-offset-bounds-p' but has an inverted
meaning. The new default value of nil means invisibility covers a
shifted interval consisting of the message body plus the line ending
immediately preceding it.
(erc--hide-message): New function, formerly `erc-match--hide-message'
from erc-match.el introduced in ERC 5.6.
* test/lisp/erc/erc-scenarios-match.el:
(erc-scenarios-match--invisible-stamp): Fix comment and use API
function in interactive convenience setup.
(erc-scenarios-match--find-bol): New test helper.
(erc-scenarios-match--find-eol): Fix bug affecting interactive use.
(erc-scenarios-match--stamp-left-fools-invisible,
erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-right-invisible-fill-wrap,
erc-scenarios-match--stamp-both-invisible-fill-static): Update
`invisible' property from `erc-match' to `match-fools'.
(erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-both-invisible-fill-static): Move test
body to function of same name for use in multiple cases.
(erc-scenarios-match--stamp-right-fools-invisible--nooffset,
erc-scenarios-match--stamp-both-invisible-fill-static--nooffset): New
test variants asserting proper hiding with old pre-5.6 invisibility
interval.
* test/lisp/erc/erc-tests.el (erc-tests--equal-including-properties):
Relocate macro higher in same file.
(erc--merge-prop): New test. (Bug#64301)
2023-07-14 21:08:31 -07:00
|
|
|
"Combine existing PROP values with VAL between FROM and TO in OBJECT.
|
2023-06-24 18:33:20 -07:00
|
|
|
For spans where PROP is non-nil, cons VAL onto the existing
|
|
|
|
value, ensuring a proper list. Otherwise, just set PROP to VAL.
|
Improve ERC's internal invisibility API
* etc/ERC-NEWS: Mention that line endings have moved from the end to
the beginning of hidden messages.
* lisp/erc/erc-fill.el (erc-fill--wrap-ensure-dependencies): Warn when
users have `erc-legacy-invisible-bounds-p' enabled, and force it to
its default value of nil in the current buffer.
(erc-fill-wrap-mode, erc-fill-wrap-enable): Move business involving
compat variable for enabling legacy hidden-message behavior to helper.
* lisp/erc/erc-match.el (erc-match--hide-fools-offset-bounds): Move
internal variable from to main library file and rename to
`erc-legacy-invisible-bounds-p'. Also make obsolete and flip
semantics so a non-nil value enables the traditional behavior.
(erc-match--hide-message): Move to main library file and rename to
`erc--hide-message'. Add a property-value parameter instead of
hard-coding to `erc-match'. Also, condition behavior on renamed
compatibility flag `erc-legacy-invisible-bounds-p'.
(erc-hide-fools): Call `erc--hide-message' with own value for
`invisible' property specifically for fools. That is, use
`match-fools' rather than `erc-match' or `erc-match-fools' to save
room when visually inspecting. This retains the module name as a
prefix to hopefully minimize collisions with invisibility spec members
owned by non-ERC minor modes. The `timestamp' spec member owned by
erc-stamp likewise lacks a namespace prefix, but its feature/group
affiliation is self-evident.
(erc-match--modify-invisibility-spec): Use toggle command
non-interactively for adding and removing invisibility spec member.
(erc-match-toggle-hidden-fools): Add explicit override argument and
defer to general helper for actually modifying spec.
(erc-match--toggle-hidden): New helper for toggling invisibility
spec.
* lisp/erc/erc.el (erc--merge-prop): If new value is a list, prepend
onto existing. Add note about possible space optimization.
(erc-legacy-invisible-bounds-p): New obsolete compat variable to
enable traditional pre-5.6 invisibility interval on hidden messages.
Replaces `erc-match--hide-fools-offset-bounds-p' but has an inverted
meaning. The new default value of nil means invisibility covers a
shifted interval consisting of the message body plus the line ending
immediately preceding it.
(erc--hide-message): New function, formerly `erc-match--hide-message'
from erc-match.el introduced in ERC 5.6.
* test/lisp/erc/erc-scenarios-match.el:
(erc-scenarios-match--invisible-stamp): Fix comment and use API
function in interactive convenience setup.
(erc-scenarios-match--find-bol): New test helper.
(erc-scenarios-match--find-eol): Fix bug affecting interactive use.
(erc-scenarios-match--stamp-left-fools-invisible,
erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-right-invisible-fill-wrap,
erc-scenarios-match--stamp-both-invisible-fill-static): Update
`invisible' property from `erc-match' to `match-fools'.
(erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-both-invisible-fill-static): Move test
body to function of same name for use in multiple cases.
(erc-scenarios-match--stamp-right-fools-invisible--nooffset,
erc-scenarios-match--stamp-both-invisible-fill-static--nooffset): New
test variants asserting proper hiding with old pre-5.6 invisibility
interval.
* test/lisp/erc/erc-tests.el (erc-tests--equal-including-properties):
Relocate macro higher in same file.
(erc--merge-prop): New test. (Bug#64301)
2023-07-14 21:08:31 -07:00
|
|
|
When VAL is itself a list, prepend its members onto an existing
|
|
|
|
value. See also `erc-button-add-face'."
|
2023-06-24 18:33:20 -07:00
|
|
|
(let ((old (get-text-property from prop object))
|
|
|
|
(pos from)
|
|
|
|
(end (next-single-property-change from prop object to))
|
|
|
|
new)
|
|
|
|
(while (< pos to)
|
Improve ERC's internal invisibility API
* etc/ERC-NEWS: Mention that line endings have moved from the end to
the beginning of hidden messages.
* lisp/erc/erc-fill.el (erc-fill--wrap-ensure-dependencies): Warn when
users have `erc-legacy-invisible-bounds-p' enabled, and force it to
its default value of nil in the current buffer.
(erc-fill-wrap-mode, erc-fill-wrap-enable): Move business involving
compat variable for enabling legacy hidden-message behavior to helper.
* lisp/erc/erc-match.el (erc-match--hide-fools-offset-bounds): Move
internal variable from to main library file and rename to
`erc-legacy-invisible-bounds-p'. Also make obsolete and flip
semantics so a non-nil value enables the traditional behavior.
(erc-match--hide-message): Move to main library file and rename to
`erc--hide-message'. Add a property-value parameter instead of
hard-coding to `erc-match'. Also, condition behavior on renamed
compatibility flag `erc-legacy-invisible-bounds-p'.
(erc-hide-fools): Call `erc--hide-message' with own value for
`invisible' property specifically for fools. That is, use
`match-fools' rather than `erc-match' or `erc-match-fools' to save
room when visually inspecting. This retains the module name as a
prefix to hopefully minimize collisions with invisibility spec members
owned by non-ERC minor modes. The `timestamp' spec member owned by
erc-stamp likewise lacks a namespace prefix, but its feature/group
affiliation is self-evident.
(erc-match--modify-invisibility-spec): Use toggle command
non-interactively for adding and removing invisibility spec member.
(erc-match-toggle-hidden-fools): Add explicit override argument and
defer to general helper for actually modifying spec.
(erc-match--toggle-hidden): New helper for toggling invisibility
spec.
* lisp/erc/erc.el (erc--merge-prop): If new value is a list, prepend
onto existing. Add note about possible space optimization.
(erc-legacy-invisible-bounds-p): New obsolete compat variable to
enable traditional pre-5.6 invisibility interval on hidden messages.
Replaces `erc-match--hide-fools-offset-bounds-p' but has an inverted
meaning. The new default value of nil means invisibility covers a
shifted interval consisting of the message body plus the line ending
immediately preceding it.
(erc--hide-message): New function, formerly `erc-match--hide-message'
from erc-match.el introduced in ERC 5.6.
* test/lisp/erc/erc-scenarios-match.el:
(erc-scenarios-match--invisible-stamp): Fix comment and use API
function in interactive convenience setup.
(erc-scenarios-match--find-bol): New test helper.
(erc-scenarios-match--find-eol): Fix bug affecting interactive use.
(erc-scenarios-match--stamp-left-fools-invisible,
erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-right-invisible-fill-wrap,
erc-scenarios-match--stamp-both-invisible-fill-static): Update
`invisible' property from `erc-match' to `match-fools'.
(erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-both-invisible-fill-static): Move test
body to function of same name for use in multiple cases.
(erc-scenarios-match--stamp-right-fools-invisible--nooffset,
erc-scenarios-match--stamp-both-invisible-fill-static--nooffset): New
test variants asserting proper hiding with old pre-5.6 invisibility
interval.
* test/lisp/erc/erc-tests.el (erc-tests--equal-including-properties):
Relocate macro higher in same file.
(erc--merge-prop): New test. (Bug#64301)
2023-07-14 21:08:31 -07:00
|
|
|
(setq new (if old
|
2023-11-18 23:04:50 -08:00
|
|
|
;; Can't `nconc' without more info.
|
|
|
|
(if erc--merge-prop-behind-p
|
|
|
|
`(,@(ensure-list old) ,@(ensure-list val))
|
|
|
|
(if (listp val)
|
|
|
|
(append val (ensure-list old))
|
|
|
|
(cons val (ensure-list old))))
|
Improve ERC's internal invisibility API
* etc/ERC-NEWS: Mention that line endings have moved from the end to
the beginning of hidden messages.
* lisp/erc/erc-fill.el (erc-fill--wrap-ensure-dependencies): Warn when
users have `erc-legacy-invisible-bounds-p' enabled, and force it to
its default value of nil in the current buffer.
(erc-fill-wrap-mode, erc-fill-wrap-enable): Move business involving
compat variable for enabling legacy hidden-message behavior to helper.
* lisp/erc/erc-match.el (erc-match--hide-fools-offset-bounds): Move
internal variable from to main library file and rename to
`erc-legacy-invisible-bounds-p'. Also make obsolete and flip
semantics so a non-nil value enables the traditional behavior.
(erc-match--hide-message): Move to main library file and rename to
`erc--hide-message'. Add a property-value parameter instead of
hard-coding to `erc-match'. Also, condition behavior on renamed
compatibility flag `erc-legacy-invisible-bounds-p'.
(erc-hide-fools): Call `erc--hide-message' with own value for
`invisible' property specifically for fools. That is, use
`match-fools' rather than `erc-match' or `erc-match-fools' to save
room when visually inspecting. This retains the module name as a
prefix to hopefully minimize collisions with invisibility spec members
owned by non-ERC minor modes. The `timestamp' spec member owned by
erc-stamp likewise lacks a namespace prefix, but its feature/group
affiliation is self-evident.
(erc-match--modify-invisibility-spec): Use toggle command
non-interactively for adding and removing invisibility spec member.
(erc-match-toggle-hidden-fools): Add explicit override argument and
defer to general helper for actually modifying spec.
(erc-match--toggle-hidden): New helper for toggling invisibility
spec.
* lisp/erc/erc.el (erc--merge-prop): If new value is a list, prepend
onto existing. Add note about possible space optimization.
(erc-legacy-invisible-bounds-p): New obsolete compat variable to
enable traditional pre-5.6 invisibility interval on hidden messages.
Replaces `erc-match--hide-fools-offset-bounds-p' but has an inverted
meaning. The new default value of nil means invisibility covers a
shifted interval consisting of the message body plus the line ending
immediately preceding it.
(erc--hide-message): New function, formerly `erc-match--hide-message'
from erc-match.el introduced in ERC 5.6.
* test/lisp/erc/erc-scenarios-match.el:
(erc-scenarios-match--invisible-stamp): Fix comment and use API
function in interactive convenience setup.
(erc-scenarios-match--find-bol): New test helper.
(erc-scenarios-match--find-eol): Fix bug affecting interactive use.
(erc-scenarios-match--stamp-left-fools-invisible,
erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-right-invisible-fill-wrap,
erc-scenarios-match--stamp-both-invisible-fill-static): Update
`invisible' property from `erc-match' to `match-fools'.
(erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-both-invisible-fill-static): Move test
body to function of same name for use in multiple cases.
(erc-scenarios-match--stamp-right-fools-invisible--nooffset,
erc-scenarios-match--stamp-both-invisible-fill-static--nooffset): New
test variants asserting proper hiding with old pre-5.6 invisibility
interval.
* test/lisp/erc/erc-tests.el (erc-tests--equal-including-properties):
Relocate macro higher in same file.
(erc--merge-prop): New test. (Bug#64301)
2023-07-14 21:08:31 -07:00
|
|
|
val))
|
2023-06-24 18:33:20 -07:00
|
|
|
(put-text-property pos end prop new object)
|
|
|
|
(setq pos end
|
|
|
|
old (get-text-property pos prop object)
|
|
|
|
end (next-single-property-change pos prop object to)))))
|
|
|
|
|
2023-10-03 23:15:40 -07:00
|
|
|
(defun erc--remove-from-prop-value-list (from to prop val &optional object)
|
|
|
|
"Remove VAL from text prop value between FROM and TO.
|
|
|
|
If current value is VAL itself, remove the property entirely.
|
|
|
|
When VAL is a list, act as if this function were called
|
|
|
|
repeatedly with VAL set to each of VAL's members."
|
|
|
|
(let ((old (get-text-property from prop object))
|
|
|
|
(pos from)
|
|
|
|
(end (next-single-property-change from prop object to))
|
|
|
|
new)
|
|
|
|
(while (< pos to)
|
|
|
|
(when old
|
|
|
|
(if (setq new (and (consp old) (if (consp val)
|
|
|
|
(seq-difference old val)
|
|
|
|
(remq val old))))
|
|
|
|
(put-text-property pos end prop
|
|
|
|
(if (cdr new) new (car new)) object)
|
|
|
|
(when (pcase val
|
|
|
|
((pred consp) (or (consp old) (memq old val)))
|
|
|
|
(_ (if (consp old) (memq val old) (eq old val))))
|
|
|
|
(remove-text-properties pos end (list prop nil) object))))
|
|
|
|
(setq pos end
|
|
|
|
old (get-text-property pos prop object)
|
|
|
|
end (next-single-property-change pos prop object to)))))
|
|
|
|
|
Improve ERC's internal invisibility API
* etc/ERC-NEWS: Mention that line endings have moved from the end to
the beginning of hidden messages.
* lisp/erc/erc-fill.el (erc-fill--wrap-ensure-dependencies): Warn when
users have `erc-legacy-invisible-bounds-p' enabled, and force it to
its default value of nil in the current buffer.
(erc-fill-wrap-mode, erc-fill-wrap-enable): Move business involving
compat variable for enabling legacy hidden-message behavior to helper.
* lisp/erc/erc-match.el (erc-match--hide-fools-offset-bounds): Move
internal variable from to main library file and rename to
`erc-legacy-invisible-bounds-p'. Also make obsolete and flip
semantics so a non-nil value enables the traditional behavior.
(erc-match--hide-message): Move to main library file and rename to
`erc--hide-message'. Add a property-value parameter instead of
hard-coding to `erc-match'. Also, condition behavior on renamed
compatibility flag `erc-legacy-invisible-bounds-p'.
(erc-hide-fools): Call `erc--hide-message' with own value for
`invisible' property specifically for fools. That is, use
`match-fools' rather than `erc-match' or `erc-match-fools' to save
room when visually inspecting. This retains the module name as a
prefix to hopefully minimize collisions with invisibility spec members
owned by non-ERC minor modes. The `timestamp' spec member owned by
erc-stamp likewise lacks a namespace prefix, but its feature/group
affiliation is self-evident.
(erc-match--modify-invisibility-spec): Use toggle command
non-interactively for adding and removing invisibility spec member.
(erc-match-toggle-hidden-fools): Add explicit override argument and
defer to general helper for actually modifying spec.
(erc-match--toggle-hidden): New helper for toggling invisibility
spec.
* lisp/erc/erc.el (erc--merge-prop): If new value is a list, prepend
onto existing. Add note about possible space optimization.
(erc-legacy-invisible-bounds-p): New obsolete compat variable to
enable traditional pre-5.6 invisibility interval on hidden messages.
Replaces `erc-match--hide-fools-offset-bounds-p' but has an inverted
meaning. The new default value of nil means invisibility covers a
shifted interval consisting of the message body plus the line ending
immediately preceding it.
(erc--hide-message): New function, formerly `erc-match--hide-message'
from erc-match.el introduced in ERC 5.6.
* test/lisp/erc/erc-scenarios-match.el:
(erc-scenarios-match--invisible-stamp): Fix comment and use API
function in interactive convenience setup.
(erc-scenarios-match--find-bol): New test helper.
(erc-scenarios-match--find-eol): Fix bug affecting interactive use.
(erc-scenarios-match--stamp-left-fools-invisible,
erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-right-invisible-fill-wrap,
erc-scenarios-match--stamp-both-invisible-fill-static): Update
`invisible' property from `erc-match' to `match-fools'.
(erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-both-invisible-fill-static): Move test
body to function of same name for use in multiple cases.
(erc-scenarios-match--stamp-right-fools-invisible--nooffset,
erc-scenarios-match--stamp-both-invisible-fill-static--nooffset): New
test variants asserting proper hiding with old pre-5.6 invisibility
interval.
* test/lisp/erc/erc-tests.el (erc-tests--equal-including-properties):
Relocate macro higher in same file.
(erc--merge-prop): New test. (Bug#64301)
2023-07-14 21:08:31 -07:00
|
|
|
(defvar erc-legacy-invisible-bounds-p nil
|
|
|
|
"Whether to hide trailing rather than preceding newlines.
|
|
|
|
Beginning in ERC 5.6, invisibility extends from a message's
|
|
|
|
preceding newline to its last non-newline character.")
|
|
|
|
(make-obsolete-variable 'erc-legacy-invisible-bounds-p
|
|
|
|
"decremented interval now permanent" "30.1")
|
|
|
|
|
|
|
|
(defun erc--hide-message (value)
|
|
|
|
"Apply `invisible' text-property with VALUE to current message.
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
Expect to run in a narrowed buffer during message insertion.
|
|
|
|
Begin the invisible interval at the previous message's trailing
|
|
|
|
newline and end before the current message's. If the preceding
|
|
|
|
message ends in a double newline or there is no previous message,
|
|
|
|
don't bother including the preceding newline."
|
Improve ERC's internal invisibility API
* etc/ERC-NEWS: Mention that line endings have moved from the end to
the beginning of hidden messages.
* lisp/erc/erc-fill.el (erc-fill--wrap-ensure-dependencies): Warn when
users have `erc-legacy-invisible-bounds-p' enabled, and force it to
its default value of nil in the current buffer.
(erc-fill-wrap-mode, erc-fill-wrap-enable): Move business involving
compat variable for enabling legacy hidden-message behavior to helper.
* lisp/erc/erc-match.el (erc-match--hide-fools-offset-bounds): Move
internal variable from to main library file and rename to
`erc-legacy-invisible-bounds-p'. Also make obsolete and flip
semantics so a non-nil value enables the traditional behavior.
(erc-match--hide-message): Move to main library file and rename to
`erc--hide-message'. Add a property-value parameter instead of
hard-coding to `erc-match'. Also, condition behavior on renamed
compatibility flag `erc-legacy-invisible-bounds-p'.
(erc-hide-fools): Call `erc--hide-message' with own value for
`invisible' property specifically for fools. That is, use
`match-fools' rather than `erc-match' or `erc-match-fools' to save
room when visually inspecting. This retains the module name as a
prefix to hopefully minimize collisions with invisibility spec members
owned by non-ERC minor modes. The `timestamp' spec member owned by
erc-stamp likewise lacks a namespace prefix, but its feature/group
affiliation is self-evident.
(erc-match--modify-invisibility-spec): Use toggle command
non-interactively for adding and removing invisibility spec member.
(erc-match-toggle-hidden-fools): Add explicit override argument and
defer to general helper for actually modifying spec.
(erc-match--toggle-hidden): New helper for toggling invisibility
spec.
* lisp/erc/erc.el (erc--merge-prop): If new value is a list, prepend
onto existing. Add note about possible space optimization.
(erc-legacy-invisible-bounds-p): New obsolete compat variable to
enable traditional pre-5.6 invisibility interval on hidden messages.
Replaces `erc-match--hide-fools-offset-bounds-p' but has an inverted
meaning. The new default value of nil means invisibility covers a
shifted interval consisting of the message body plus the line ending
immediately preceding it.
(erc--hide-message): New function, formerly `erc-match--hide-message'
from erc-match.el introduced in ERC 5.6.
* test/lisp/erc/erc-scenarios-match.el:
(erc-scenarios-match--invisible-stamp): Fix comment and use API
function in interactive convenience setup.
(erc-scenarios-match--find-bol): New test helper.
(erc-scenarios-match--find-eol): Fix bug affecting interactive use.
(erc-scenarios-match--stamp-left-fools-invisible,
erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-right-invisible-fill-wrap,
erc-scenarios-match--stamp-both-invisible-fill-static): Update
`invisible' property from `erc-match' to `match-fools'.
(erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-both-invisible-fill-static): Move test
body to function of same name for use in multiple cases.
(erc-scenarios-match--stamp-right-fools-invisible--nooffset,
erc-scenarios-match--stamp-both-invisible-fill-static--nooffset): New
test variants asserting proper hiding with old pre-5.6 invisibility
interval.
* test/lisp/erc/erc-tests.el (erc-tests--equal-including-properties):
Relocate macro higher in same file.
(erc--merge-prop): New test. (Bug#64301)
2023-07-14 21:08:31 -07:00
|
|
|
(if erc-legacy-invisible-bounds-p
|
|
|
|
;; Before ERC 5.6, this also used to add an `intangible'
|
|
|
|
;; property, but the docs say it's now obsolete.
|
|
|
|
(erc--merge-prop (point-min) (point-max) 'invisible value)
|
|
|
|
(let ((beg (point-min))
|
|
|
|
(end (point-max)))
|
|
|
|
(save-restriction
|
|
|
|
(widen)
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(when (or (<= beg 4) (= ?\n (char-before (- beg 2))))
|
|
|
|
(cl-incf beg))
|
Improve ERC's internal invisibility API
* etc/ERC-NEWS: Mention that line endings have moved from the end to
the beginning of hidden messages.
* lisp/erc/erc-fill.el (erc-fill--wrap-ensure-dependencies): Warn when
users have `erc-legacy-invisible-bounds-p' enabled, and force it to
its default value of nil in the current buffer.
(erc-fill-wrap-mode, erc-fill-wrap-enable): Move business involving
compat variable for enabling legacy hidden-message behavior to helper.
* lisp/erc/erc-match.el (erc-match--hide-fools-offset-bounds): Move
internal variable from to main library file and rename to
`erc-legacy-invisible-bounds-p'. Also make obsolete and flip
semantics so a non-nil value enables the traditional behavior.
(erc-match--hide-message): Move to main library file and rename to
`erc--hide-message'. Add a property-value parameter instead of
hard-coding to `erc-match'. Also, condition behavior on renamed
compatibility flag `erc-legacy-invisible-bounds-p'.
(erc-hide-fools): Call `erc--hide-message' with own value for
`invisible' property specifically for fools. That is, use
`match-fools' rather than `erc-match' or `erc-match-fools' to save
room when visually inspecting. This retains the module name as a
prefix to hopefully minimize collisions with invisibility spec members
owned by non-ERC minor modes. The `timestamp' spec member owned by
erc-stamp likewise lacks a namespace prefix, but its feature/group
affiliation is self-evident.
(erc-match--modify-invisibility-spec): Use toggle command
non-interactively for adding and removing invisibility spec member.
(erc-match-toggle-hidden-fools): Add explicit override argument and
defer to general helper for actually modifying spec.
(erc-match--toggle-hidden): New helper for toggling invisibility
spec.
* lisp/erc/erc.el (erc--merge-prop): If new value is a list, prepend
onto existing. Add note about possible space optimization.
(erc-legacy-invisible-bounds-p): New obsolete compat variable to
enable traditional pre-5.6 invisibility interval on hidden messages.
Replaces `erc-match--hide-fools-offset-bounds-p' but has an inverted
meaning. The new default value of nil means invisibility covers a
shifted interval consisting of the message body plus the line ending
immediately preceding it.
(erc--hide-message): New function, formerly `erc-match--hide-message'
from erc-match.el introduced in ERC 5.6.
* test/lisp/erc/erc-scenarios-match.el:
(erc-scenarios-match--invisible-stamp): Fix comment and use API
function in interactive convenience setup.
(erc-scenarios-match--find-bol): New test helper.
(erc-scenarios-match--find-eol): Fix bug affecting interactive use.
(erc-scenarios-match--stamp-left-fools-invisible,
erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-right-invisible-fill-wrap,
erc-scenarios-match--stamp-both-invisible-fill-static): Update
`invisible' property from `erc-match' to `match-fools'.
(erc-scenarios-match--stamp-right-fools-invisible,
erc-scenarios-match--stamp-both-invisible-fill-static): Move test
body to function of same name for use in multiple cases.
(erc-scenarios-match--stamp-right-fools-invisible--nooffset,
erc-scenarios-match--stamp-both-invisible-fill-static--nooffset): New
test variants asserting proper hiding with old pre-5.6 invisibility
interval.
* test/lisp/erc/erc-tests.el (erc-tests--equal-including-properties):
Relocate macro higher in same file.
(erc--merge-prop): New test. (Bug#64301)
2023-07-14 21:08:31 -07:00
|
|
|
(erc--merge-prop (1- beg) (1- end) 'invisible value)))))
|
|
|
|
|
Revive erc-command-indicator as new module
* doc/misc/erc.texi: Add entry for `command-indicator' to Modules
chapter.
* etc/ERC-NEWS: Mention new module `command-indicator'.
* lisp/erc/erc-goodies.el (erc-noncommands-list): Replace the
nonexistent `erc-cmd-SMV' with function `erc-cmd-SAY'.
(erc-noncommands-mode, erc-noncommands-enable,
erc-noncommands-disable): Deprecate this module because it's a no-op.
(erc-command-indicator-face, erc-command-indicator): Migrate from main
library.
(erc-command-indicator-mode, erc-command-indicator-enable,
erc-command-indicator-disable): New module to take the spiritual place
of `noncommands'.
(erc-command-indicator): Move function here from main library, along
with option namesake mentioned above.
(erc-command-indicator-toggle-hidden): New command to toggle echoed
command-line visibility.
(erc--command-indicator-permit-insertion): New function.
(erc--command-indicator-display): New function, a slightly revised
version of the old `erc-display-command' from the main library. Its
only call site was removed back in d1036d288de "backport: erc
bugfixes". However, references were left behind to associated assets,
like `erc-command-indicator', etc. The function was later commented
out in 0c599ee2e2c "* lisp/erc/erc.el: Use `run-hook-with-args` for
`erc-pre-send-functions`", and then removed by a63ed6f78a6 "Remove
duplicate ERC prompt on reconnect".
* lisp/erc/erc-match.el (erc-match-toggle-hidden-fools): Use new
non-module-specific name for `erc-match--toggle-hidden'.
(erc-match--toggle-hidden): Move to main library for shared use by
other modules.
* lisp/erc/erc.el (erc-hide-prompt): Leave note explaining updated
role.
(erc-command-indicator): Move option and function of same name to
erc-goodies.
(erc-command-indicator-face): Move to erc-goodies.
(erc-modules): Remove module `noncommands' from standard value and
Custom set. Add `command-indicator' to set.
(erc--toggle-hidden): "New" function, a rebranded version of the
utility `erc-match--toggle-hidden' from erc-match.
(erc--send-input-lines): Accommodate modules wanting alternate
insertion functions.
(erc-load-irc-script-lines): Account for `erc-command-indicator' no
longer being defined in this library.
* test/lisp/erc/erc-scenarios-base-send-message.el
(erc-scenarios-base-send-message--command-indicator): New test.
* test/lisp/erc/erc-tests.el (erc-tests--modules): Remove
deprecated module `noncommands' from manifest. (Bug#67031)
2023-11-10 13:34:31 -08:00
|
|
|
(defun erc--toggle-hidden (prop arg)
|
|
|
|
"Toggle invisibility for spec member PROP.
|
|
|
|
Treat ARG in a manner similar to mode toggles defined by
|
|
|
|
`define-minor-mode'."
|
|
|
|
(when arg
|
|
|
|
(setq arg (prefix-numeric-value arg)))
|
|
|
|
(if (memq prop (ensure-list buffer-invisibility-spec))
|
|
|
|
(unless (natnump arg)
|
|
|
|
(remove-from-invisibility-spec prop))
|
|
|
|
(when (or (not arg) (natnump arg))
|
|
|
|
(add-to-invisibility-spec prop))))
|
|
|
|
|
2023-10-21 13:53:46 -07:00
|
|
|
(defun erc--delete-inserted-message (beg-or-point &optional end)
|
|
|
|
"Remove message between BEG and END.
|
|
|
|
Expect BEG and END to match bounds as returned by the macro
|
|
|
|
`erc--get-inserted-msg-bounds'. Ensure all markers residing at
|
|
|
|
the start of the deleted message end up at the beginning of the
|
|
|
|
subsequent message."
|
|
|
|
(let ((beg beg-or-point))
|
|
|
|
(save-restriction
|
|
|
|
(widen)
|
|
|
|
(unless end
|
|
|
|
(setq end (erc--get-inserted-msg-bounds nil beg-or-point)
|
|
|
|
beg (pop end)))
|
|
|
|
(with-silent-modifications
|
|
|
|
(if erc-legacy-invisible-bounds-p
|
|
|
|
(delete-region beg (1+ end))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char beg)
|
|
|
|
(insert-before-markers
|
|
|
|
(substring (delete-and-extract-region (1- (point)) (1+ end))
|
|
|
|
-1))))))))
|
|
|
|
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(defvar erc--ranked-properties '(erc--msg erc--ts erc--cmd))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
|
|
|
|
(defun erc--order-text-properties-from-hash (table)
|
|
|
|
"Return a plist of text props from items in TABLE.
|
|
|
|
Ensure props in `erc--ranked-properties' appear last and in
|
|
|
|
reverse order so they end up sorted in buffer interval plists for
|
|
|
|
retrieval by `text-properties-at' and friends."
|
|
|
|
(let (out)
|
|
|
|
(dolist (k erc--ranked-properties)
|
|
|
|
(when-let ((v (gethash k table)))
|
|
|
|
(remhash k table)
|
|
|
|
(setq out (nconc (list k v) out))))
|
|
|
|
(maphash (lambda (k v) (setq out (nconc (list k v) out))) table)
|
|
|
|
out))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-display-message-highlight (type string)
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
"Highlight STRING according to TYPE, where erc-TYPE-face is an ERC face.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
See also `erc-make-notice'."
|
2006-01-29 13:08:58 +00:00
|
|
|
(cond ((eq type 'notice)
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-make-notice string))
|
|
|
|
(t
|
|
|
|
(erc-put-text-property
|
|
|
|
0 (length string)
|
2016-04-07 14:23:18 +02:00
|
|
|
'font-lock-face (or (intern-soft
|
|
|
|
(concat "erc-" (symbol-name type) "-face"))
|
2023-06-24 18:33:20 -07:00
|
|
|
'erc-default-face)
|
2014-11-08 20:51:43 -05:00
|
|
|
string)
|
|
|
|
string)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2012-08-20 09:08:51 -07:00
|
|
|
(defvar erc-lurker-state nil
|
|
|
|
"Track the time of the last PRIVMSG for each (server,nick) pair.
|
|
|
|
|
|
|
|
This is implemented as a hash of hashes, where the outer key is
|
|
|
|
the canonicalized server name (as returned by
|
|
|
|
`erc-canonicalize-server-name') and the outer value is a hash
|
|
|
|
table mapping nicks (as returned by `erc-lurker-maybe-trim') to
|
|
|
|
the times of their most recently received PRIVMSG on any channel
|
|
|
|
on the given server.")
|
|
|
|
|
|
|
|
(defcustom erc-lurker-trim-nicks t
|
|
|
|
"If t, trim trailing `erc-lurker-ignore-chars' from nicks.
|
|
|
|
|
2015-05-28 00:06:14 -07:00
|
|
|
This causes e.g. nick and nick\\=` to be considered as the same
|
2012-08-20 09:08:51 -07:00
|
|
|
individual for activity tracking and lurkiness detection
|
|
|
|
purposes."
|
|
|
|
:group 'erc-lurker
|
|
|
|
:type 'boolean)
|
|
|
|
|
Use cl-lib instead of cl, and interactive-p => called-interactively-p.
* lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
called-interactively-p instead of cl.
* lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
* lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
* lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
* lisp/erc/erc-capab.el: Don't require cl since we don't use it.
* lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
(erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
* lisp/json.el: Don't require cl since we don't use it.
* lisp/color.el: Don't require cl.
(color-complement): `caddr' -> `nth 2'.
* test/automated/ert-x-tests.el: Use cl-lib.
* test/automated/ert-tests.el: Use lexical-binding and cl-lib.
2012-11-19 12:24:12 -05:00
|
|
|
(defcustom erc-lurker-ignore-chars "`_"
|
|
|
|
"Characters at the end of a nick to strip for activity tracking purposes.
|
|
|
|
|
|
|
|
See also `erc-lurker-trim-nicks'."
|
|
|
|
:group 'erc-lurker
|
|
|
|
:type 'string)
|
|
|
|
|
2012-08-20 09:08:51 -07:00
|
|
|
(defun erc-lurker-maybe-trim (nick)
|
|
|
|
"Maybe trim trailing `erc-lurker-ignore-chars' from NICK.
|
|
|
|
|
|
|
|
Returns NICK unmodified unless `erc-lurker-trim-nicks' is
|
|
|
|
non-nil."
|
|
|
|
(if erc-lurker-trim-nicks
|
2021-09-16 15:25:18 +02:00
|
|
|
(string-trim-right
|
|
|
|
nick (rx-to-string `(+ (in ,@(string-to-list erc-lurker-ignore-chars)))))
|
2012-08-20 09:08:51 -07:00
|
|
|
nick))
|
|
|
|
|
|
|
|
(defcustom erc-lurker-hide-list nil
|
|
|
|
"List of IRC type messages to hide when sent by lurkers.
|
|
|
|
|
2015-09-17 12:28:45 -07:00
|
|
|
A typical value would be \(\"JOIN\" \"PART\" \"QUIT\").
|
2012-08-20 09:08:51 -07:00
|
|
|
See also `erc-lurker-p' and `erc-hide-list'."
|
|
|
|
:group 'erc-lurker
|
|
|
|
:type 'erc-message-type)
|
|
|
|
|
|
|
|
(defcustom erc-lurker-threshold-time (* 60 60 24) ; 24h by default
|
|
|
|
"Nicks from which no PRIVMSGs have been received within this
|
|
|
|
interval (in units of seconds) are considered lurkers by
|
|
|
|
`erc-lurker-p' and as a result their messages of types in
|
|
|
|
`erc-lurker-hide-list' will be hidden."
|
|
|
|
:group 'erc-lurker
|
|
|
|
:type 'integer)
|
|
|
|
|
|
|
|
(defun erc-lurker-initialize ()
|
|
|
|
"Initialize ERC lurker tracking functionality.
|
|
|
|
|
|
|
|
This function adds `erc-lurker-update-status' to
|
|
|
|
`erc-insert-pre-hook' in order to record the time of each nick's
|
|
|
|
most recent PRIVMSG as well as initializing the state variable
|
|
|
|
storing this information."
|
|
|
|
(setq erc-lurker-state (make-hash-table :test 'equal))
|
2021-01-04 00:21:02 -05:00
|
|
|
(add-hook 'erc-insert-pre-hook #'erc-lurker-update-status))
|
2012-08-20 09:08:51 -07:00
|
|
|
|
|
|
|
(defun erc-lurker-cleanup ()
|
|
|
|
"Remove all last PRIVMSG state older than `erc-lurker-threshold-time'.
|
|
|
|
|
|
|
|
This should be called regularly to avoid excessive resource
|
|
|
|
consumption for long-lived IRC or Emacs sessions."
|
|
|
|
(maphash
|
|
|
|
(lambda (server hash)
|
|
|
|
(maphash
|
|
|
|
(lambda (nick last-PRIVMSG-time)
|
2014-11-08 20:51:43 -05:00
|
|
|
(when
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-22 18:32:31 -08:00
|
|
|
(time-less-p erc-lurker-threshold-time
|
|
|
|
(time-since last-PRIVMSG-time))
|
2014-11-08 20:51:43 -05:00
|
|
|
(remhash nick hash)))
|
2012-08-20 09:08:51 -07:00
|
|
|
hash)
|
|
|
|
(if (zerop (hash-table-count hash))
|
2014-11-08 20:51:43 -05:00
|
|
|
(remhash server erc-lurker-state)))
|
2012-08-20 09:08:51 -07:00
|
|
|
erc-lurker-state))
|
|
|
|
|
|
|
|
(defvar erc-lurker-cleanup-count 0
|
|
|
|
"Internal counter variable for use with `erc-lurker-cleanup-interval'.")
|
|
|
|
|
|
|
|
(defvar erc-lurker-cleanup-interval 100
|
2013-08-22 00:06:45 -04:00
|
|
|
"Frequency of cleaning up stale erc-lurker state.
|
2012-08-20 09:08:51 -07:00
|
|
|
|
|
|
|
`erc-lurker-update-status' calls `erc-lurker-cleanup' once for
|
|
|
|
every `erc-lurker-cleanup-interval' updates to
|
|
|
|
`erc-lurker-state'. This is designed to limit the memory
|
|
|
|
consumption of lurker state during long Emacs sessions and/or ERC
|
|
|
|
sessions with large numbers of incoming PRIVMSGs.")
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-lurker-update-status (_message)
|
2012-08-20 09:08:51 -07:00
|
|
|
"Update `erc-lurker-state' if necessary.
|
|
|
|
|
|
|
|
This function is called from `erc-insert-pre-hook'. If the
|
|
|
|
current message is a PRIVMSG, update `erc-lurker-state' to
|
|
|
|
reflect the fact that its sender has issued a PRIVMSG at the
|
|
|
|
current time. Otherwise, take no action.
|
|
|
|
|
|
|
|
This function depends on the fact that `erc-display-message'
|
2019-08-17 14:09:11 -04:00
|
|
|
dynamically binds `erc-message-parsed', which is used to check if
|
|
|
|
the current message is a PRIVMSG and to determine its sender.
|
|
|
|
See also `erc-lurker-trim-nicks' and `erc-lurker-ignore-chars'.
|
2012-08-20 09:08:51 -07:00
|
|
|
|
|
|
|
In order to limit memory consumption, this function also calls
|
|
|
|
`erc-lurker-cleanup' once every `erc-lurker-cleanup-interval'
|
|
|
|
updates of `erc-lurker-state'."
|
2019-08-17 14:09:11 -04:00
|
|
|
(when (and (boundp 'erc-message-parsed)
|
|
|
|
(erc-response-p erc-message-parsed))
|
|
|
|
(let* ((command (erc-response.command erc-message-parsed))
|
2012-08-20 09:08:51 -07:00
|
|
|
(sender
|
|
|
|
(erc-lurker-maybe-trim
|
2019-08-17 14:09:11 -04:00
|
|
|
(car (erc-parse-user
|
|
|
|
(erc-response.sender erc-message-parsed)))))
|
2012-08-20 09:08:51 -07:00
|
|
|
(server
|
|
|
|
(erc-canonicalize-server-name erc-server-announced-name)))
|
|
|
|
(when (equal command "PRIVMSG")
|
Use cl-lib instead of cl, and interactive-p => called-interactively-p.
* lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
called-interactively-p instead of cl.
* lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
* lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
* lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
* lisp/erc/erc-capab.el: Don't require cl since we don't use it.
* lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
(erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
* lisp/json.el: Don't require cl since we don't use it.
* lisp/color.el: Don't require cl.
(color-complement): `caddr' -> `nth 2'.
* test/automated/ert-x-tests.el: Use cl-lib.
* test/automated/ert-tests.el: Use lexical-binding and cl-lib.
2012-11-19 12:24:12 -05:00
|
|
|
(when (>= (cl-incf erc-lurker-cleanup-count)
|
2014-11-08 20:51:43 -05:00
|
|
|
erc-lurker-cleanup-interval)
|
2012-08-20 09:08:51 -07:00
|
|
|
(setq erc-lurker-cleanup-count 0)
|
|
|
|
(erc-lurker-cleanup))
|
|
|
|
(unless (gethash server erc-lurker-state)
|
|
|
|
(puthash server (make-hash-table :test 'equal) erc-lurker-state))
|
|
|
|
(puthash sender (current-time)
|
|
|
|
(gethash server erc-lurker-state))))))
|
|
|
|
|
|
|
|
(defun erc-lurker-p (nick)
|
|
|
|
"Predicate indicating NICK's lurking status on the current server.
|
|
|
|
|
|
|
|
Lurking is the condition where NICK has issued no PRIVMSG on this
|
|
|
|
server within `erc-lurker-threshold-time'. See also
|
|
|
|
`erc-lurker-trim-nicks' and `erc-lurker-ignore-chars'."
|
|
|
|
(unless erc-lurker-state (erc-lurker-initialize))
|
2014-11-08 20:51:43 -05:00
|
|
|
(let* ((server
|
|
|
|
(erc-canonicalize-server-name erc-server-announced-name))
|
|
|
|
(last-PRIVMSG-time
|
|
|
|
(gethash (erc-lurker-maybe-trim nick)
|
|
|
|
(gethash server erc-lurker-state (make-hash-table)))))
|
|
|
|
(or (null last-PRIVMSG-time)
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-22 18:32:31 -08:00
|
|
|
(time-less-p erc-lurker-threshold-time
|
|
|
|
(time-since last-PRIVMSG-time)))))
|
2012-08-20 09:08:51 -07:00
|
|
|
|
Use cl-lib instead of cl, and interactive-p => called-interactively-p.
* lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
called-interactively-p instead of cl.
* lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
* lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
* lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
* lisp/erc/erc-capab.el: Don't require cl since we don't use it.
* lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
(erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
* lisp/json.el: Don't require cl since we don't use it.
* lisp/color.el: Don't require cl.
(color-complement): `caddr' -> `nth 2'.
* test/automated/ert-x-tests.el: Use cl-lib.
* test/automated/ert-tests.el: Use lexical-binding and cl-lib.
2012-11-19 12:24:12 -05:00
|
|
|
(defcustom erc-common-server-suffixes
|
2015-03-16 14:49:01 -04:00
|
|
|
'(("openprojects.net\\'" . "OPN")
|
|
|
|
("freenode.net\\'" . "freenode")
|
|
|
|
("oftc.net\\'" . "OFTC"))
|
Use cl-lib instead of cl, and interactive-p => called-interactively-p.
* lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
called-interactively-p instead of cl.
* lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
* lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
* lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
* lisp/erc/erc-capab.el: Don't require cl since we don't use it.
* lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
(erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
* lisp/json.el: Don't require cl since we don't use it.
* lisp/color.el: Don't require cl.
(color-complement): `caddr' -> `nth 2'.
* test/automated/ert-x-tests.el: Use cl-lib.
* test/automated/ert-tests.el: Use lexical-binding and cl-lib.
2012-11-19 12:24:12 -05:00
|
|
|
"Alist of common server name suffixes.
|
|
|
|
This variable is used in mode-line display to save screen
|
|
|
|
real estate. Set it to nil if you want to avoid changing
|
|
|
|
displayed hostnames."
|
|
|
|
:group 'erc-mode-line-and-header
|
|
|
|
:type 'alist)
|
|
|
|
|
2012-08-20 09:08:51 -07:00
|
|
|
(defun erc-canonicalize-server-name (server)
|
2021-09-19 13:21:56 +02:00
|
|
|
"Return canonical network name for SERVER or `erc-server-announced-name'.
|
|
|
|
SERVER is matched against `erc-common-server-suffixes'."
|
2012-08-20 09:08:51 -07:00
|
|
|
(when server
|
2020-08-12 19:32:52 +02:00
|
|
|
(or (cdar (cl-remove-if-not
|
2014-11-08 20:51:43 -05:00
|
|
|
(lambda (net) (string-match (car net) server))
|
|
|
|
erc-common-server-suffixes))
|
2012-08-20 09:08:51 -07:00
|
|
|
erc-server-announced-name)))
|
|
|
|
|
2015-05-21 14:30:18 -05:00
|
|
|
(defun erc-add-targets (scope target-list)
|
|
|
|
(let ((targets
|
|
|
|
(mapcar (lambda (targets) (member scope targets)) target-list)))
|
2021-01-04 00:21:02 -05:00
|
|
|
(cdr (apply #'append (delete nil targets)))))
|
2015-05-21 14:30:18 -05:00
|
|
|
|
2012-08-20 09:08:51 -07:00
|
|
|
(defun erc-hide-current-message-p (parsed)
|
|
|
|
"Predicate indicating whether the parsed ERC response PARSED should be hidden.
|
|
|
|
|
|
|
|
Messages are always hidden if the message type of PARSED appears in
|
2017-10-27 20:45:23 -04:00
|
|
|
`erc-hide-list'. Message types that appear in `erc-network-hide-list'
|
|
|
|
or `erc-channel-hide-list' are only hidden if the target matches
|
|
|
|
the network or channel in the list. In addition, messages whose type
|
2015-05-21 14:30:18 -05:00
|
|
|
is a member of `erc-lurker-hide-list' are hidden if `erc-lurker-p'
|
|
|
|
returns non-nil."
|
2012-08-20 09:08:51 -07:00
|
|
|
(let* ((command (erc-response.command parsed))
|
2015-05-21 14:30:18 -05:00
|
|
|
(sender (car (erc-parse-user (erc-response.sender parsed))))
|
2019-10-28 15:31:39 +01:00
|
|
|
(channel (car (erc-response.command-args parsed)))
|
2021-08-17 01:50:29 -07:00
|
|
|
(network (or (and (erc-network) (erc-network-name))
|
2015-05-21 14:30:18 -05:00
|
|
|
(erc-shorten-server-name
|
|
|
|
(or erc-server-announced-name
|
|
|
|
erc-session-server))))
|
|
|
|
(current-hide-list
|
|
|
|
(when erc-network-hide-list
|
|
|
|
(erc-add-targets network erc-network-hide-list)))
|
|
|
|
(current-hide-list
|
2019-10-28 15:31:39 +01:00
|
|
|
(append current-hide-list
|
|
|
|
(when erc-channel-hide-list
|
|
|
|
(erc-add-targets channel erc-channel-hide-list)))))
|
2012-08-20 09:08:51 -07:00
|
|
|
(or (member command erc-hide-list)
|
2015-05-21 14:30:18 -05:00
|
|
|
(member command current-hide-list)
|
2012-08-20 09:08:51 -07:00
|
|
|
(and (member command erc-lurker-hide-list) (erc-lurker-p sender)))))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-display-message (parsed type buffer msg &rest args)
|
|
|
|
"Display MSG in BUFFER.
|
|
|
|
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
Insert MSG or text derived from MSG into an ERC buffer, possibly
|
|
|
|
after applying formatting by way of either a `format-spec' known
|
|
|
|
to a message-catalog entry or a TYPE known to a specialized
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
string handler. Additionally, derive metadata, faces, and other
|
|
|
|
text properties from the various overloaded parameters, such as
|
|
|
|
PARSED, when it's an `erc-response' object, and MSG, when it's a
|
|
|
|
key (symbol) for a \"message catalog\" entry. Expect ARGS, when
|
|
|
|
applicable, to be `format-spec' args known to such an entry, and
|
|
|
|
TYPE, when non-nil, to be a symbol handled by
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
`erc-display-message-highlight' (necessarily accompanied by a
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
string MSG). Expect BUFFER to be among the sort accepted by the
|
|
|
|
function `erc-display-line'.
|
|
|
|
|
|
|
|
Expect BUFFER to be a live `erc-mode' buffer, a list of such
|
|
|
|
buffers, or the symbols `all' or `active'. If `all', insert
|
|
|
|
STRING in all buffers for the current session. If `active',
|
|
|
|
defer to the function `erc-active-buffer', which may return the
|
|
|
|
session's server buffer if the previously active buffer has been
|
|
|
|
killed. If BUFFER is nil or a network process, pretend it's set
|
|
|
|
to the appropriate server buffer. Otherwise, use the current
|
|
|
|
buffer.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-06-24 18:33:20 -07:00
|
|
|
When TYPE is a list of symbols, call handlers from left to right
|
|
|
|
without influencing how they behave when encountering existing
|
|
|
|
faces. As of ERC 5.6, expect a TYPE of (notice error) to insert
|
|
|
|
MSG with `font-lock-face' as `erc-error-face' throughout.
|
|
|
|
However, when the list of symbols begins with t, tell compatible
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
handlers to compose rather than clobber faces. For example,
|
|
|
|
expect a TYPE of (t notice error) to result in `font-lock-face'
|
|
|
|
being (erc-error-face erc-notice-face) throughout MSG when
|
|
|
|
`erc-notice-highlight-type' is left at its default, `all'.
|
|
|
|
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
As of ERC 5.6, assume third-party code will use this function
|
|
|
|
instead of lower-level ones, like `erc-insert-line', when needing
|
|
|
|
ERC to process arbitrary informative messages as if they'd been
|
|
|
|
sent from a server. That is, guarantee \"local\" messages, for
|
|
|
|
which PARSED is typically nil, will be subject to buttonizing,
|
|
|
|
filling, and other effects."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((string (if (symbolp msg)
|
2015-03-16 14:49:01 -04:00
|
|
|
(apply #'erc-format-message msg args)
|
2019-08-17 14:09:11 -04:00
|
|
|
msg))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(erc--msg-props
|
|
|
|
(or erc--msg-props
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
(let ((table (make-hash-table :size 5))
|
|
|
|
(cmd (and parsed (erc--get-eq-comparable-cmd
|
|
|
|
(erc-response.command parsed)))))
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(puthash 'erc--msg
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
(cond ((and msg (symbolp msg)) msg)
|
|
|
|
((and cmd (memq cmd '(PRIVMSG NOTICE)) 'msg))
|
|
|
|
(type (pcase type
|
|
|
|
((pred symbolp) type)
|
|
|
|
((pred listp)
|
|
|
|
(intern (mapconcat #'prin1-to-string
|
|
|
|
type "-")))
|
|
|
|
(_ 'unknown)))
|
|
|
|
(t 'unknown))
|
|
|
|
table)
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(when cmd
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(puthash 'erc--cmd cmd table))
|
2023-09-02 13:43:22 -07:00
|
|
|
(and-let* ((ovs erc--msg-prop-overrides))
|
|
|
|
(pcase-dolist (`(,k . ,v) (reverse ovs))
|
|
|
|
(puthash k v table)))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
table)))
|
2019-08-17 14:09:11 -04:00
|
|
|
(erc-message-parsed parsed))
|
2006-01-29 13:08:58 +00:00
|
|
|
(setq string
|
2014-11-08 20:51:43 -05:00
|
|
|
(cond
|
|
|
|
((null type)
|
|
|
|
string)
|
|
|
|
((listp type)
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
(let ((erc--merge-text-properties-p
|
2023-06-24 18:33:20 -07:00
|
|
|
(and (eq (car type) t) (setq type (cdr type)))))
|
|
|
|
(dolist (type type)
|
|
|
|
(setq string (erc-display-message-highlight type string))))
|
2014-11-08 20:51:43 -05:00
|
|
|
string)
|
|
|
|
((symbolp type)
|
|
|
|
(erc-display-message-highlight type string))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(if (not (erc-response-p parsed))
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
(erc--route-insertion string buffer)
|
2012-08-20 09:08:51 -07:00
|
|
|
(unless (erc-hide-current-message-p parsed)
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-put-text-property 0 (length string) 'erc-parsed parsed string)
|
2017-04-24 11:57:46 +05:30
|
|
|
(when (erc-response.tags parsed)
|
|
|
|
(erc-put-text-property 0 (length string) 'tags (erc-response.tags parsed)
|
|
|
|
string))
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
(erc--route-insertion string buffer)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-message-type-member (position list)
|
|
|
|
"Return non-nil if the erc-parsed text-property at POSITION is in LIST.
|
|
|
|
|
|
|
|
This function relies on the erc-parsed text-property being
|
|
|
|
present."
|
2007-04-01 13:36:38 +00:00
|
|
|
(let ((prop-val (erc-get-parsed-vector position)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(and prop-val (member (erc-response.command prop-val) list))))
|
|
|
|
|
Extend erc-interactive-display to cover /JOINs
* lisp/erc/erc.el (erc-display): Mention that buffer-related display
options live in the customization group `erc-buffers'.
(erc-buffer-display, erc-join-buffer): Swap alias and aliased so that
the favored name, `erc-buffer-display', appears in the definition and
in the Customize menu. Also note related buffer-display options in
the doc string.
(erc-query-display, erc-interactive-display): Make the former an alias
of the latter, new in ERC 5.6, because their roles were functionally
redundant and thus confusing. Inherit the default value from
`erc-query-display' because users are more familiar with the pop-up
window behavior than a single-window replacement.
(erc-reconnect-display): Use preferred name for cross-referencing
fallback option `erc-buffer-display' in doc string, and explain how
/reconnect handling differs.
(erc--setup-buffer-hook): Add new internal hook for modules that
operate on windows and frames, such as erc-speedbar and
erc-status-sidebar.
(erc-open): Run `erc--setup-buffer-hook' after `erc-setup-buffer' so
hook members know their code isn't tied to `erc-setup-buffer' itself,
which may be used in other contexts, but rather to a new ERC buffer on
which some display-related action has just been performed.
(erc--called-as-input-p): New variable for "slash" commands, like
`erc-cmd-FOO', to detect whether they're being called "interactively"
as a result of input given at ERC's prompt.
(erc-process-input-line): Bind `erc--called-as-input-p' when running
slash commands.
(erc-cmd-JOIN): When called interactively, schedule a callback to wrap
the response handler and control how new buffers are thus displayed.
(erc-cmd-QUERY): Use preferred alias for `erc-query-display'.
* test/lisp/erc/erc-scenarios-base-buffer-display.el:
(erc-scenarios-base-buffer-display--interactive-default): New test.
* test/lisp/erc/erc-tests.el (erc-process-input-line,
erc-select-read-args, erc-tls, erc--interactive): Change expected
default value of `erc-interactive-display' from `buffer' to
`window'. (Bug#62833)
2023-04-10 17:58:05 -07:00
|
|
|
(defvar erc--called-as-input-p nil
|
|
|
|
"Non-nil when a user types a \"/slash\" command.
|
|
|
|
Remains bound until `erc-cmd-SLASH' returns.")
|
|
|
|
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(defvar erc--current-line-input-split nil
|
|
|
|
"Current `erc--input-split' instance when processing user input.
|
|
|
|
This is for special cases in which a \"slash\" command needs
|
|
|
|
details about the input it's handling or needs to detect whether
|
|
|
|
it's been dispatched by `erc-send-current-line'.")
|
|
|
|
|
2023-09-18 03:39:57 -07:00
|
|
|
(defvar erc--allow-empty-outgoing-lines-p nil
|
|
|
|
"Flag to opt out of last-minute padding of empty lines.
|
|
|
|
Useful to extensions, like `multiline', and for interop with
|
|
|
|
IRC-adjacent protocols.")
|
|
|
|
|
2023-06-09 20:40:59 -07:00
|
|
|
(defvar-local erc-send-input-line-function #'erc-send-input-line
|
|
|
|
"Function for sending lines lacking a leading \"slash\" command.
|
|
|
|
When prompt input starts with a \"slash\" command, like \"/MSG\",
|
|
|
|
ERC calls a corresponding handler, like `erc-cmd-MSG'. But
|
|
|
|
normal \"chat\" input also needs processing, for example, to
|
|
|
|
convert it into a proper IRC command. ERC calls this variable's
|
|
|
|
value to perform that task, which, by default, simply involves
|
|
|
|
constructing a \"PRIVMSG\" with the current channel or query
|
|
|
|
partner as the target. Some libraries, like `erc-dcc', use this
|
|
|
|
for other purposes.")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-send-input-line (target line &optional force)
|
2021-11-06 03:09:43 +01:00
|
|
|
"Send LINE to TARGET."
|
2023-09-18 03:39:57 -07:00
|
|
|
(when (and (not erc--allow-empty-outgoing-lines-p) (string= line "\n"))
|
2022-03-21 19:21:57 -07:00
|
|
|
(setq line " \n"))
|
2021-11-06 03:09:43 +01:00
|
|
|
(erc-message "PRIVMSG" (concat target " " line) force))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-get-arglist (fun)
|
|
|
|
"Return the argument list of a function without the parens."
|
Make more erc function aliases obsolete
* lisp/erc/erc-compat.el (erc-propertize, erc-view-mode-enter)
(erc-function-arglist, erc-delete-dups)
(erc-replace-regexp-in-string): Make these aliases obsolete.
* lisp/erc/erc-capab.el (erc-capab-identify-add-prefix)
(erc-capab-identify-remove/set-identified-flag):
* lisp/erc/erc-dcc.el (erc-dcc-chat-parse-output)
(erc-dcc-unquote-filename, pcomplete/erc-mode/DCC):
* lisp/erc/erc-list.el (erc-list-menu-mode, erc-list-button)
(erc-list-make-string):
* lisp/erc/erc-log.el (erc-log-standardize-name):
* lisp/erc/erc-match.el (erc-log-matches-make-buffer):
* lisp/erc/erc-networks.el (erc-server-select):
* lisp/erc/erc.el (erc-message-english-PART)
(erc-update-mode-line-buffer, erc-format-my-nick)
(erc-format-@nick, erc-get-user-mode-prefix, erc-display-prompt)
(erc-part-reason-zippy, erc-quit-reason-zippy, erc-get-arglist)
(erc-toggle-debug-irc-protocol, erc-log-irc-protocol)
(erc-migrate-modules): Adjust callers.
2020-08-07 13:54:50 +02:00
|
|
|
(let ((arglist (format "%S" (help-function-arglist fun))))
|
2015-03-16 14:49:01 -04:00
|
|
|
(if (string-match "\\`(\\(.*\\))\\'" arglist)
|
2014-11-08 20:51:43 -05:00
|
|
|
(match-string 1 arglist)
|
2006-01-29 13:08:58 +00:00
|
|
|
arglist)))
|
|
|
|
|
2007-09-08 03:07:09 +00:00
|
|
|
(defun erc-command-no-process-p (str)
|
|
|
|
"Return non-nil if STR is an ERC command that can be run when the process
|
|
|
|
is not alive, nil otherwise."
|
|
|
|
(let ((fun (erc-extract-command-from-line str)))
|
|
|
|
(and fun
|
2014-11-08 20:51:43 -05:00
|
|
|
(symbolp (car fun))
|
|
|
|
(get (car fun) 'process-not-needed))))
|
2007-09-08 03:07:09 +00:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-command-name (cmd)
|
|
|
|
"For CMD being the function name of a ERC command, something like
|
|
|
|
erc-cmd-FOO, this returns a string /FOO."
|
|
|
|
(let ((command-name (symbol-name cmd)))
|
2015-03-16 14:49:01 -04:00
|
|
|
(if (string-match "\\`erc-cmd-\\(.*\\)\\'" command-name)
|
2014-11-08 20:51:43 -05:00
|
|
|
(concat "/" (match-string 1 command-name))
|
2006-01-29 13:08:58 +00:00
|
|
|
command-name)))
|
|
|
|
|
|
|
|
(defun erc-process-input-line (line &optional force no-command)
|
|
|
|
"Translate LINE to an RFC1459 command and send it based.
|
|
|
|
Returns non-nil if the command is actually sent to the server, and nil
|
|
|
|
otherwise.
|
|
|
|
|
|
|
|
If the command in the LINE is not bound as a function `erc-cmd-<COMMAND>',
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
it is passed to `erc-cmd-default'. If LINE is not a command (i.e. doesn't
|
2006-01-29 13:08:58 +00:00
|
|
|
start with /<COMMAND>) then it is sent as a message.
|
|
|
|
|
|
|
|
An optional FORCE argument forces sending the line when flood
|
|
|
|
protection is in effect. The optional NO-COMMAND argument prohibits
|
|
|
|
this function from interpreting the line as a command."
|
|
|
|
(let ((command-list (erc-extract-command-from-line line)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(if (and command-list
|
|
|
|
(not no-command))
|
|
|
|
(let* ((cmd (nth 0 command-list))
|
Extend erc-interactive-display to cover /JOINs
* lisp/erc/erc.el (erc-display): Mention that buffer-related display
options live in the customization group `erc-buffers'.
(erc-buffer-display, erc-join-buffer): Swap alias and aliased so that
the favored name, `erc-buffer-display', appears in the definition and
in the Customize menu. Also note related buffer-display options in
the doc string.
(erc-query-display, erc-interactive-display): Make the former an alias
of the latter, new in ERC 5.6, because their roles were functionally
redundant and thus confusing. Inherit the default value from
`erc-query-display' because users are more familiar with the pop-up
window behavior than a single-window replacement.
(erc-reconnect-display): Use preferred name for cross-referencing
fallback option `erc-buffer-display' in doc string, and explain how
/reconnect handling differs.
(erc--setup-buffer-hook): Add new internal hook for modules that
operate on windows and frames, such as erc-speedbar and
erc-status-sidebar.
(erc-open): Run `erc--setup-buffer-hook' after `erc-setup-buffer' so
hook members know their code isn't tied to `erc-setup-buffer' itself,
which may be used in other contexts, but rather to a new ERC buffer on
which some display-related action has just been performed.
(erc--called-as-input-p): New variable for "slash" commands, like
`erc-cmd-FOO', to detect whether they're being called "interactively"
as a result of input given at ERC's prompt.
(erc-process-input-line): Bind `erc--called-as-input-p' when running
slash commands.
(erc-cmd-JOIN): When called interactively, schedule a callback to wrap
the response handler and control how new buffers are thus displayed.
(erc-cmd-QUERY): Use preferred alias for `erc-query-display'.
* test/lisp/erc/erc-scenarios-base-buffer-display.el:
(erc-scenarios-base-buffer-display--interactive-default): New test.
* test/lisp/erc/erc-tests.el (erc-process-input-line,
erc-select-read-args, erc-tls, erc--interactive): Change expected
default value of `erc-interactive-display' from `buffer' to
`window'. (Bug#62833)
2023-04-10 17:58:05 -07:00
|
|
|
(args (nth 1 command-list))
|
|
|
|
(erc--called-as-input-p t))
|
2023-04-20 19:20:59 -07:00
|
|
|
(erc--server-last-reconnect-display-reset (erc-server-buffer))
|
2014-11-08 20:51:43 -05:00
|
|
|
(condition-case nil
|
2021-01-04 15:25:29 -05:00
|
|
|
(if (listp args)
|
|
|
|
(apply cmd args)
|
|
|
|
(funcall cmd args))
|
2014-11-08 20:51:43 -05:00
|
|
|
(wrong-number-of-arguments
|
|
|
|
(erc-display-message nil 'error (current-buffer) 'incorrect-args
|
|
|
|
?c (erc-command-name cmd)
|
|
|
|
?u (or (erc-get-arglist cmd)
|
|
|
|
"")
|
|
|
|
?d (format "%s\n"
|
|
|
|
(or (documentation cmd) "")))
|
|
|
|
nil)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((r (erc-default-target)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(if r
|
|
|
|
(funcall erc-send-input-line-function r line force)
|
2023-11-08 19:14:55 -08:00
|
|
|
(erc-display-message nil '(notice error) (current-buffer) 'no-target)
|
2014-11-08 20:51:43 -05:00
|
|
|
nil)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-07-07 21:27:03 -07:00
|
|
|
(defconst erc--shell-parse-regexp
|
|
|
|
(rx (or (+ (not (any ?\s ?\t ?\n ?\\ ?\" ?' ?\;)))
|
|
|
|
(: ?' (group (* (not ?'))) (? ?'))
|
|
|
|
(: ?\" (group (* (or (not (any ?\" ?\\)) (: ?\\ nonl)))) (? ?\"))
|
|
|
|
(: ?\\ (group (? (or nonl ?\n)))))))
|
|
|
|
|
|
|
|
(defun erc--split-string-shell-cmd (string)
|
|
|
|
"Parse whitespace-separated arguments in STRING."
|
|
|
|
;; From `shell--parse-pcomplete-arguments' and friends. Quirk:
|
|
|
|
;; backslash-escaped characters appearing within spans of double
|
|
|
|
;; quotes are unescaped.
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert string)
|
|
|
|
(let ((end (point))
|
|
|
|
args)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (and (skip-chars-forward " \t") (< (point) end))
|
|
|
|
(let (arg)
|
|
|
|
(while (looking-at erc--shell-parse-regexp)
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
(cond ((match-beginning 3) ; backslash escape
|
|
|
|
(push (if (= (match-beginning 3) (match-end 3))
|
|
|
|
"\\"
|
|
|
|
(match-string 3))
|
|
|
|
arg))
|
|
|
|
((match-beginning 2) ; double quote
|
|
|
|
(push (replace-regexp-in-string (rx ?\\ (group nonl))
|
|
|
|
"\\1" (match-string 2))
|
|
|
|
arg))
|
|
|
|
((match-beginning 1) ; single quote
|
|
|
|
(push (match-string 1) arg))
|
|
|
|
(t (push (match-string 0) arg))))
|
|
|
|
(push (string-join (nreverse arg)) args)))
|
|
|
|
(nreverse args))))
|
|
|
|
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2014-11-08 20:51:43 -05:00
|
|
|
;; Input commands handlers
|
2006-01-29 13:08:58 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(defun erc-cmd-AMSG (line)
|
|
|
|
"Send LINE to all channels of the current server that you are on."
|
|
|
|
(interactive "sSend to all channels you're on: ")
|
|
|
|
(setq line (erc-trim-string line))
|
|
|
|
(erc-with-all-buffers-of-server nil
|
2014-11-08 20:51:43 -05:00
|
|
|
(lambda ()
|
|
|
|
(erc-channel-p (erc-default-target)))
|
|
|
|
(erc-send-message line)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(put 'erc-cmd-AMSG 'do-not-parse-args t)
|
|
|
|
|
|
|
|
(defun erc-cmd-SAY (line)
|
|
|
|
"Send LINE to the current query or channel as a message, not a command.
|
|
|
|
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
Use this when you want to send a message with a leading `/'. Note
|
2006-01-29 13:08:58 +00:00
|
|
|
that since multi-line messages are never a command, you don't
|
|
|
|
need this when pasting multiple lines of text."
|
|
|
|
(if (string-match "^\\s-*$" line)
|
|
|
|
nil
|
|
|
|
(string-match "^ ?\\(.*\\)" line)
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(erc-send-message (match-string 1 line) nil)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(put 'erc-cmd-SAY 'do-not-parse-args t)
|
|
|
|
|
|
|
|
(defun erc-cmd-SET (line)
|
|
|
|
"Set the variable named by the first word in LINE to some VALUE.
|
|
|
|
VALUE is computed by evaluating the rest of LINE in Lisp."
|
|
|
|
(cond
|
|
|
|
((string-match "^\\s-*\\(\\S-+\\)\\s-+\\(.*\\)$" line)
|
|
|
|
(let ((var (read (concat "erc-" (match-string 1 line))))
|
2014-11-08 20:51:43 -05:00
|
|
|
(val (read (match-string 2 line))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (boundp var)
|
2014-11-08 20:51:43 -05:00
|
|
|
(progn
|
2021-03-18 23:14:33 -04:00
|
|
|
(set var (eval val t))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-display-message
|
|
|
|
nil nil 'active (format "Set %S to %S" var val))
|
|
|
|
t)
|
|
|
|
(setq var (read (match-string 1 line)))
|
|
|
|
(if (boundp var)
|
|
|
|
(progn
|
2021-03-18 23:14:33 -04:00
|
|
|
(set var (eval val t))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-display-message
|
|
|
|
nil nil 'active (format "Set %S to %S" var val))
|
|
|
|
t)
|
|
|
|
(erc-display-message nil 'error 'active 'variable-not-bound)
|
|
|
|
nil))))
|
2006-01-29 13:08:58 +00:00
|
|
|
((string-match "^\\s-*$" line)
|
|
|
|
(erc-display-line
|
|
|
|
(concat "Available user variables:\n"
|
2014-11-08 20:51:43 -05:00
|
|
|
(apply
|
2015-03-16 14:49:01 -04:00
|
|
|
#'concat
|
2014-11-08 20:51:43 -05:00
|
|
|
(mapcar
|
|
|
|
(lambda (var)
|
|
|
|
(let ((val (symbol-value var)))
|
|
|
|
(concat (format "%S:" var)
|
|
|
|
(if (consp val)
|
|
|
|
(concat "\n" (pp-to-string val))
|
|
|
|
(format " %S\n" val)))))
|
|
|
|
(apropos-internal "^erc-" 'custom-variable-p))))
|
|
|
|
(current-buffer))
|
|
|
|
t)
|
2006-01-29 13:08:58 +00:00
|
|
|
(t nil)))
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-VAR #'erc-cmd-SET)
|
|
|
|
(defalias 'erc-cmd-VARIABLE #'erc-cmd-SET)
|
2006-01-29 13:08:58 +00:00
|
|
|
(put 'erc-cmd-SET 'do-not-parse-args t)
|
2007-09-08 03:07:09 +00:00
|
|
|
(put 'erc-cmd-SET 'process-not-needed t)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-cmd-default (line)
|
|
|
|
"Fallback command.
|
|
|
|
|
2011-11-22 23:03:56 -08:00
|
|
|
Commands for which no erc-cmd-xxx exists, are tunneled through
|
2006-01-29 13:08:58 +00:00
|
|
|
this function. LINE is sent to the server verbatim, and
|
|
|
|
therefore has to contain the command itself as well."
|
|
|
|
(erc-log (format "cmd: DEFAULT: %s" line))
|
2021-06-13 02:15:55 -07:00
|
|
|
(erc-server-send (string-trim-right (substring line 1) "[\r\n]"))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
|
2020-08-05 10:27:40 +02:00
|
|
|
(defvar erc--read-time-period-history nil)
|
|
|
|
|
|
|
|
(defun erc--read-time-period (prompt)
|
|
|
|
"Read a time period on the \"2h\" format.
|
|
|
|
If there's no letter spec, the input is interpreted as a number of seconds.
|
|
|
|
|
|
|
|
If input is blank, this function returns nil. Otherwise it
|
|
|
|
returns the time spec converted to a number of seconds."
|
|
|
|
(let ((period (string-trim
|
|
|
|
(read-string prompt nil 'erc--read-time-period-history))))
|
|
|
|
(cond
|
|
|
|
;; Blank input.
|
|
|
|
((zerop (length period))
|
|
|
|
nil)
|
|
|
|
;; All-number -- interpret as seconds.
|
|
|
|
((string-match-p "\\`[0-9]+\\'" period)
|
|
|
|
(string-to-number period))
|
|
|
|
;; Parse as a time spec.
|
|
|
|
(t
|
Don't require erc-goodies in erc.el
* lisp/erc/erc-goodies.el: Obviate the need for forward declarations
by requiring `erc'. Add minor-mode autoloads for `scrolltobottom',
`readonly', `move-to-prompt', `keep-place', `noncommands',
`irccontrols', `smiley', and `unmorse'. Add Local variables footer
with `generated-autoload-file'.
(erc-controls-strip): Autoload this function.
* lisp/erc/erc-ibuffer.el: Require `erc-goodies' for
`erc-control-interpret'. The justification for the blanket `require'
is this module isn't a member of `erc-modules' by default.
* lisp/erc/erc-page.el: (erc-ctcp-query-PAGE): Require `erc-goodies'
and put forward declaration for `erc-control-interpret' atop file.
* lisp/erc/erc-speedbar.el: Require `erc-goodies' for the same reason
as erc-ibuffer.el.
* lisp/erc/erc.el: Remove `require' for `erc-goodies' at end of file
and `pp' at top of file because `pp-to-string' is autoloaded on Emacs
27. Also remove `require's for `thingatpt', `time-date', and
`iso8601'. They're all used sparingly and the latter two have only
been around for one major release, so their removal likely won't cause
much churn. And `thingatpt' already has a call-site `require', so the
top-level one is redundant, but autoload `word-at-point' anyway for
the benefit of third-party libraries like `hl-nicks'. Also wrap local
loaddefs `require' call in `eval-and-compile'.
(erc--read-time-period): Require dependencies. (Bug#60954.)
2023-01-19 21:07:27 -08:00
|
|
|
(require 'time-date)
|
|
|
|
(require 'iso8601)
|
2020-08-05 10:27:40 +02:00
|
|
|
(let ((time (condition-case nil
|
|
|
|
(iso8601-parse-duration
|
|
|
|
(concat (cond
|
|
|
|
((string-match-p "\\`P" (upcase period))
|
|
|
|
;; Somebody typed in a full ISO8601 period.
|
|
|
|
(upcase period))
|
|
|
|
((string-match-p "[YD]" (upcase period))
|
|
|
|
;; If we have a year/day element,
|
|
|
|
;; we have a full spec.
|
|
|
|
"P")
|
|
|
|
(t
|
|
|
|
;; Otherwise it's just a sub-day spec.
|
|
|
|
"PT"))
|
|
|
|
(upcase period)))
|
|
|
|
(wrong-type-argument nil))))
|
|
|
|
(unless time
|
|
|
|
(user-error "%s is not a valid time period" period))
|
|
|
|
(decoded-time-period time))))))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-cmd-IGNORE (&optional user)
|
|
|
|
"Ignore USER. This should be a regexp matching nick!user@host.
|
|
|
|
If no USER argument is specified, list the contents of `erc-ignore-list'."
|
|
|
|
(if user
|
2006-11-20 06:50:29 +00:00
|
|
|
(let ((quoted (regexp-quote user)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(when (and (not (string= user quoted))
|
|
|
|
(y-or-n-p (format "Use regexp-quoted form (%s) instead? "
|
|
|
|
quoted)))
|
|
|
|
(setq user quoted))
|
2020-08-05 10:27:40 +02:00
|
|
|
(let ((timeout
|
|
|
|
(erc--read-time-period
|
|
|
|
"Add a timeout? (Blank for no, or a time spec like 2h): "))
|
|
|
|
(buffer (current-buffer)))
|
|
|
|
(when timeout
|
|
|
|
(run-at-time timeout nil
|
|
|
|
(lambda ()
|
|
|
|
(erc--unignore-user user buffer))))
|
2023-10-04 20:39:03 -07:00
|
|
|
(erc-display-message nil 'notice 'active
|
|
|
|
(format "Now ignoring %s" user))
|
2020-08-05 10:27:40 +02:00
|
|
|
(erc-with-server-buffer (add-to-list 'erc-ignore-list user))))
|
2007-04-01 13:36:38 +00:00
|
|
|
(if (null (erc-with-server-buffer erc-ignore-list))
|
2023-10-04 20:39:03 -07:00
|
|
|
(erc-display-message nil 'notice 'active "Ignore list is empty")
|
|
|
|
(erc-display-message nil 'notice 'active "Ignore list:")
|
2021-04-09 00:04:13 +02:00
|
|
|
(mapc (lambda (item)
|
2023-10-04 20:39:03 -07:00
|
|
|
(erc-display-message nil 'notice 'active item))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-with-server-buffer erc-ignore-list))))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
|
|
|
|
(defun erc-cmd-UNIGNORE (user)
|
|
|
|
"Remove the user specified in USER from the ignore list."
|
2007-04-01 13:36:38 +00:00
|
|
|
(let ((ignored-nick (car (erc-with-server-buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-member-ignore-case (regexp-quote user)
|
|
|
|
erc-ignore-list)))))
|
2006-11-20 06:50:29 +00:00
|
|
|
(unless ignored-nick
|
|
|
|
(if (setq ignored-nick (erc-ignored-user-p user))
|
2014-11-08 20:51:43 -05:00
|
|
|
(unless (y-or-n-p (format "Remove this regexp (%s)? "
|
|
|
|
ignored-nick))
|
|
|
|
(setq ignored-nick nil))
|
2023-10-04 20:39:03 -07:00
|
|
|
(erc-display-message nil 'notice 'active
|
|
|
|
(format "%s is not currently ignored!" user))))
|
2006-11-20 06:50:29 +00:00
|
|
|
(when ignored-nick
|
2020-08-05 10:27:40 +02:00
|
|
|
(erc--unignore-user user (current-buffer))))
|
|
|
|
t)
|
|
|
|
|
|
|
|
(defun erc--unignore-user (user buffer)
|
|
|
|
(when (buffer-live-p buffer)
|
|
|
|
(with-current-buffer buffer
|
2023-10-04 20:39:03 -07:00
|
|
|
(erc-display-message nil 'notice 'active
|
|
|
|
(format "No longer ignoring %s" user))
|
2007-04-01 13:36:38 +00:00
|
|
|
(erc-with-server-buffer
|
2020-08-05 10:27:40 +02:00
|
|
|
(setq erc-ignore-list (delete user erc-ignore-list))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Preserve prompt in erc-cmd-CLEAR
* etc/ERC-NEWS: Mention behavioral changes to functionality provided
by the `truncate' and `log' modules and also the "/CLEAR" command.
* lisp/erc/erc-log.el (erc-truncate-buffer-on-save): Deprecate option
because three's a crowd, and ERC already has a dedicated module as
well as a slash command for this purpose. And although this commit
restores functionality, this option has been unusable since at least
the release of ERC 5.5, with no known complaints received thus far.
Also, the doc string of `erc-save-buffer-in-logs' makes no mention of
this feature WRT interactive invocations or otherwise.
(erc-log-mode, erc-log-enable, erc-log-disable): Subscribe to
new internal hook `erc--pre-clear-functions'.
(erc-log--save-in-progress-p): New variable to help restore
`erc-truncate-buffer-on-save' and promote code reuse.
(erc-logging-enabled): Guard with `erc-log--saved-in-progress-p'.
(erc-save-buffer-in-logs): Overload `buffer' parameter to allow
various hooks to supply a non-buffer as well. Warn when people use
`erc-truncate-buffer-on-save', which is now deprecated.
* lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-enable,
erc-stamp-disable): Subscribe to `erc--pre-clear-functions'.
(erc-stamp--update-saved-position): New function for updating
last-logged marker on `erc-stamp--insert-date-function'.
(erc-stamp--reset-on-clear): New function to forget last inserted
stamps when truncating.
* lisp/erc/erc-truncate.el (erc-truncate-mode, erc-truncate-enable,
erc-truncate-disable): Use `erc-insert-done-hook' instead of
`erc-insert-post-hook', as implicitly suggested by an ancient comment,
which ponders whether truncating the buffer at the insertion phase may
be harmful to other hook members.
(erc-truncate-buffer-to-size): Set truncation boundary at message
break instead of line break. Run `erc--pre-clear-functions'.
(erc-truncate-buffer): Save excursion. This should probably be
handled by `erc-truncate-buffer-to-size' instead, but that's
likelier to cause breakage in third-party code.
* lisp/erc/erc.el (erc--pre-clear-functions): New internal hook.
(erc-cmd-CLEAR): Run `erc--pre-clear-functions' before clearing, and
don't blow away prompt. The latter was a regression caused by
05f6fdb9e78 "Preserve ERC prompt and its bounding markers".
* test/lisp/erc/erc-scenarios-log.el: New file. (Bug#60936)
2023-05-28 21:16:39 -07:00
|
|
|
(defvar erc--pre-clear-functions nil
|
|
|
|
"Abnormal hook run when truncating buffers.
|
|
|
|
Called with position indicating boundary of interval to be excised.")
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-cmd-CLEAR ()
|
|
|
|
"Clear the window content."
|
2019-10-23 11:13:54 +02:00
|
|
|
(let ((inhibit-read-only t))
|
Preserve prompt in erc-cmd-CLEAR
* etc/ERC-NEWS: Mention behavioral changes to functionality provided
by the `truncate' and `log' modules and also the "/CLEAR" command.
* lisp/erc/erc-log.el (erc-truncate-buffer-on-save): Deprecate option
because three's a crowd, and ERC already has a dedicated module as
well as a slash command for this purpose. And although this commit
restores functionality, this option has been unusable since at least
the release of ERC 5.5, with no known complaints received thus far.
Also, the doc string of `erc-save-buffer-in-logs' makes no mention of
this feature WRT interactive invocations or otherwise.
(erc-log-mode, erc-log-enable, erc-log-disable): Subscribe to
new internal hook `erc--pre-clear-functions'.
(erc-log--save-in-progress-p): New variable to help restore
`erc-truncate-buffer-on-save' and promote code reuse.
(erc-logging-enabled): Guard with `erc-log--saved-in-progress-p'.
(erc-save-buffer-in-logs): Overload `buffer' parameter to allow
various hooks to supply a non-buffer as well. Warn when people use
`erc-truncate-buffer-on-save', which is now deprecated.
* lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-enable,
erc-stamp-disable): Subscribe to `erc--pre-clear-functions'.
(erc-stamp--update-saved-position): New function for updating
last-logged marker on `erc-stamp--insert-date-function'.
(erc-stamp--reset-on-clear): New function to forget last inserted
stamps when truncating.
* lisp/erc/erc-truncate.el (erc-truncate-mode, erc-truncate-enable,
erc-truncate-disable): Use `erc-insert-done-hook' instead of
`erc-insert-post-hook', as implicitly suggested by an ancient comment,
which ponders whether truncating the buffer at the insertion phase may
be harmful to other hook members.
(erc-truncate-buffer-to-size): Set truncation boundary at message
break instead of line break. Run `erc--pre-clear-functions'.
(erc-truncate-buffer): Save excursion. This should probably be
handled by `erc-truncate-buffer-to-size' instead, but that's
likelier to cause breakage in third-party code.
* lisp/erc/erc.el (erc--pre-clear-functions): New internal hook.
(erc-cmd-CLEAR): Run `erc--pre-clear-functions' before clearing, and
don't blow away prompt. The latter was a regression caused by
05f6fdb9e78 "Preserve ERC prompt and its bounding markers".
* test/lisp/erc/erc-scenarios-log.el: New file. (Bug#60936)
2023-05-28 21:16:39 -07:00
|
|
|
(run-hook-with-args 'erc--pre-clear-functions (1- erc-insert-marker))
|
|
|
|
;; Ostensibly, `line-beginning-position' is for use in lisp code.
|
|
|
|
(delete-region (point-min) (min (line-beginning-position)
|
|
|
|
(1- erc-insert-marker))))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
2007-09-08 03:07:09 +00:00
|
|
|
(put 'erc-cmd-CLEAR 'process-not-needed t)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-cmd-OPS ()
|
|
|
|
"Show the ops in the current channel."
|
|
|
|
(interactive)
|
|
|
|
(let ((ops nil))
|
|
|
|
(if erc-channel-users
|
2014-11-08 20:51:43 -05:00
|
|
|
(maphash (lambda (_nick user-data)
|
|
|
|
(let ((cuser (cdr user-data)))
|
|
|
|
(if (and cuser
|
|
|
|
(erc-channel-user-op cuser))
|
|
|
|
(setq ops (cons (erc-server-user-nickname
|
|
|
|
(car user-data))
|
|
|
|
ops)))))
|
|
|
|
erc-channel-users))
|
2021-03-18 23:14:33 -04:00
|
|
|
(setq ops (sort ops #'string-lessp))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if ops
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-display-message
|
|
|
|
nil 'notice (current-buffer) 'ops
|
|
|
|
?i (length ops) ?s (if (> (length ops) 1) "s" "")
|
2021-01-04 00:21:02 -05:00
|
|
|
?o (mapconcat #'identity ops " "))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-display-message nil 'notice (current-buffer) 'ops-none)))
|
|
|
|
t)
|
|
|
|
|
|
|
|
(defun erc-cmd-COUNTRY (tld)
|
|
|
|
"Display the country associated with the top level domain TLD."
|
|
|
|
(require 'mail-extr)
|
|
|
|
(let ((co (ignore-errors (what-domain tld))))
|
|
|
|
(if co
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-display-message
|
|
|
|
nil 'notice 'active 'country ?c co ?d tld)
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-display-message
|
|
|
|
nil 'notice 'active 'country-unknown ?d tld))
|
2014-11-08 20:51:43 -05:00
|
|
|
t))
|
2007-09-08 03:07:09 +00:00
|
|
|
(put 'erc-cmd-COUNTRY 'process-not-needed t)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-cmd-AWAY (line)
|
|
|
|
"Mark the user as being away, the reason being indicated by LINE.
|
|
|
|
If no reason is given, unset away status."
|
|
|
|
(when (string-match "^\\s-*\\(.*\\)$" line)
|
|
|
|
(let ((reason (match-string 1 line)))
|
|
|
|
(erc-log (format "cmd: AWAY: %s" reason))
|
|
|
|
(erc-server-send
|
|
|
|
(if (string= reason "")
|
2014-11-08 20:51:43 -05:00
|
|
|
"AWAY"
|
|
|
|
(concat "AWAY :" reason))))
|
2006-01-29 13:08:58 +00:00
|
|
|
t))
|
|
|
|
(put 'erc-cmd-AWAY 'do-not-parse-args t)
|
|
|
|
|
|
|
|
(defun erc-cmd-GAWAY (line)
|
|
|
|
"Mark the user as being away everywhere, the reason being indicated by LINE."
|
|
|
|
;; on all server buffers.
|
|
|
|
(erc-with-all-buffers-of-server nil
|
2007-04-01 13:36:38 +00:00
|
|
|
#'erc-open-server-buffer-p
|
|
|
|
(erc-cmd-AWAY line)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(put 'erc-cmd-GAWAY 'do-not-parse-args t)
|
|
|
|
|
|
|
|
(defun erc-cmd-CTCP (nick cmd &rest args)
|
|
|
|
"Send a Client To Client Protocol message to NICK.
|
|
|
|
|
|
|
|
CMD is the CTCP command, possible values being ECHO, FINGER, CLIENTINFO, TIME,
|
|
|
|
VERSION and so on. It is called with ARGS."
|
|
|
|
(let ((str (concat cmd
|
2014-11-08 20:51:43 -05:00
|
|
|
(when args
|
|
|
|
(concat " " (mapconcat #'identity args " "))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-log (format "cmd: CTCP [%s]: [%s]" nick str))
|
|
|
|
(erc-send-ctcp-message nick str)
|
|
|
|
t))
|
|
|
|
|
2023-03-25 09:13:40 -07:00
|
|
|
(defun erc-cmd-HELP (&optional func &rest rest)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Popup help information.
|
|
|
|
|
|
|
|
If FUNC contains a valid function or variable, help about that
|
|
|
|
will be displayed. If FUNC is empty, display an apropos about
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
ERC commands. Otherwise, do `apropos' in the ERC namespace
|
2015-09-17 16:08:20 -07:00
|
|
|
\(\"erc-.*LINE\").
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
Examples:
|
|
|
|
To find out about erc and bbdb, do
|
|
|
|
/help bbdb.*
|
|
|
|
|
|
|
|
For help about the WHOIS command, do:
|
|
|
|
/help whois
|
|
|
|
|
|
|
|
For a list of user commands (/join /part, ...):
|
|
|
|
/help."
|
|
|
|
(if func
|
2014-11-08 20:51:43 -05:00
|
|
|
(let* ((sym (or (let ((sym (intern-soft
|
|
|
|
(concat "erc-cmd-" (upcase func)))))
|
|
|
|
(if (and sym (or (boundp sym) (fboundp sym)))
|
|
|
|
sym
|
|
|
|
nil))
|
|
|
|
(let ((sym (intern-soft func)))
|
|
|
|
(if (and sym (or (boundp sym) (fboundp sym)))
|
|
|
|
sym
|
|
|
|
nil))
|
|
|
|
(let ((sym (intern-soft (concat "erc-" func))))
|
|
|
|
(if (and sym (or (boundp sym) (fboundp sym)))
|
|
|
|
sym
|
|
|
|
nil)))))
|
|
|
|
(if sym
|
|
|
|
(cond
|
2023-03-25 09:13:40 -07:00
|
|
|
((get sym 'erc--cmd-help)
|
|
|
|
(when (autoloadp (symbol-function sym))
|
|
|
|
(autoload-do-load (symbol-function sym)))
|
|
|
|
(apply (get sym 'erc--cmd-help) rest))
|
2014-11-08 20:51:43 -05:00
|
|
|
((boundp sym) (describe-variable sym))
|
|
|
|
((fboundp sym) (describe-function sym))
|
|
|
|
(t nil))
|
|
|
|
(apropos-command (concat "erc-.*" func) nil
|
|
|
|
(lambda (x)
|
|
|
|
(or (commandp x)
|
|
|
|
(get x 'custom-type))))
|
|
|
|
t))
|
2006-01-29 13:08:58 +00:00
|
|
|
(apropos "erc-cmd-")
|
|
|
|
(message "Type C-h m to get additional information about keybindings.")
|
|
|
|
t))
|
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-H #'erc-cmd-HELP)
|
2007-09-08 03:07:09 +00:00
|
|
|
(put 'erc-cmd-HELP 'process-not-needed t)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
(defcustom erc-auth-source-server-function #'erc-auth-source-search
|
|
|
|
"Function to query auth-source for a server password.
|
|
|
|
Called with a subset of keyword parameters known to
|
|
|
|
`auth-source-search' and relevant to an opening \"PASS\" command,
|
|
|
|
if any. In return, ERC expects a string to send as the server
|
|
|
|
password, or nil, to skip the \"PASS\" command completely. An
|
|
|
|
explicit `:password' argument to entry-point commands `erc' and
|
|
|
|
`erc-tls' also inhibits lookup, as does setting this option to
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
nil. See Info node `(erc) auth-source' for details."
|
|
|
|
:package-version '(ERC . "5.5")
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
:group 'erc
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:type '(choice (function-item erc-auth-source-search)
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
(const nil)
|
|
|
|
function))
|
|
|
|
|
|
|
|
(defcustom erc-auth-source-join-function #'erc-auth-source-search
|
|
|
|
"Function to query auth-source on joining a channel.
|
|
|
|
Called with a subset of keyword arguments known to
|
|
|
|
`auth-source-search' and relevant to joining a password-protected
|
|
|
|
channel. In return, ERC expects a string to use as the channel
|
|
|
|
\"key\", or nil to just join the channel normally. Setting the
|
|
|
|
option itself to nil tells ERC to always forgo consulting
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
auth-source for channel keys. For more information, see Info
|
2022-11-30 23:10:58 -08:00
|
|
|
node `(erc) auth-source'."
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:package-version '(ERC . "5.5")
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
:group 'erc
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:type '(choice (function-item erc-auth-source-search)
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
(const nil)
|
|
|
|
function))
|
|
|
|
|
|
|
|
(defun erc--auth-source-determine-params-defaults ()
|
2022-11-13 01:52:48 -08:00
|
|
|
(let* ((net (and-let* ((erc-networks--id)
|
|
|
|
(esid (erc-networks--id-symbol erc-networks--id))
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
((symbol-name esid)))))
|
|
|
|
(localp (and erc--target (erc--target-channel-local-p erc--target)))
|
|
|
|
(hosts (if localp
|
|
|
|
(list erc-server-announced-name erc-session-server net)
|
|
|
|
(list net erc-server-announced-name erc-session-server)))
|
|
|
|
(ports (list (cl-typecase erc-session-port
|
|
|
|
(integer (number-to-string erc-session-port))
|
|
|
|
(string (and (string= erc-session-port "irc")
|
|
|
|
erc-session-port)) ; or nil
|
|
|
|
(t erc-session-port))
|
|
|
|
"irc")))
|
|
|
|
(list (cons :host (delq nil hosts))
|
|
|
|
(cons :port (delq nil ports))
|
|
|
|
(cons :require '(:secret)))))
|
|
|
|
|
|
|
|
(defun erc--auth-source-determine-params-merge (&rest plist)
|
|
|
|
"Return a plist of merged keyword args to pass to `auth-source-search'.
|
|
|
|
Combine items in PLIST with others derived from the current connection
|
|
|
|
context, but prioritize the former. For keys not present in PLIST,
|
|
|
|
favor a network ID over an announced server unless `erc--target' is a
|
|
|
|
local channel. And treat the dialed server address as a fallback for
|
|
|
|
the announced name in both cases."
|
|
|
|
(let ((defaults (erc--auth-source-determine-params-defaults)))
|
|
|
|
`(,@(cl-loop for (key value) on plist by #'cddr
|
|
|
|
for default = (assq key defaults)
|
|
|
|
do (when default (setq defaults (delq default defaults)))
|
|
|
|
append `(,key ,(delete-dups
|
|
|
|
`(,@(if (consp value) value (list value))
|
|
|
|
,@(cdr default)))))
|
|
|
|
,@(cl-loop for (k . v) in defaults append (list k v)))))
|
|
|
|
|
|
|
|
(defun erc--auth-source-search (&rest defaults)
|
|
|
|
"Ask auth-source for a secret and return it if found.
|
|
|
|
Use DEFAULTS as keyword arguments for querying auth-source and as a
|
|
|
|
guide for narrowing results. Return a string if found or nil otherwise.
|
|
|
|
The ordering of DEFAULTS influences how results are filtered, as does
|
|
|
|
the ordering of the members of any individual composite values. If
|
|
|
|
necessary, the former takes priority. For example, if DEFAULTS were to
|
|
|
|
contain
|
|
|
|
|
|
|
|
:host (\"foo\" \"bar\") :port (\"123\" \"456\")
|
|
|
|
|
|
|
|
the secret from an auth-source entry of host foo and port 456 would be
|
|
|
|
chosen over another of host bar and port 123. However, if DEFAULTS
|
|
|
|
looked like
|
|
|
|
|
|
|
|
:port (\"123\" \"456\") :host (\"foo\" \"bar\")
|
|
|
|
|
|
|
|
the opposite would be true. In both cases, two entries with the same
|
|
|
|
host but different ports would result in the one with port 123 getting
|
|
|
|
the nod. Much the same would happen for entries sharing only a port:
|
|
|
|
the one with host foo would win."
|
|
|
|
(when-let*
|
2022-04-24 06:20:09 -07:00
|
|
|
((auth-source-backend-parser-functions
|
|
|
|
(erc-compat--auth-source-backend-parser-functions))
|
|
|
|
(priority (map-keys defaults))
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
(test (lambda (a b)
|
|
|
|
(catch 'done
|
|
|
|
(dolist (key priority)
|
|
|
|
(let* ((d (plist-get defaults key))
|
|
|
|
(defval (if (listp d) d (list d)))
|
|
|
|
;; featurep 'seq via auth-source > json > map
|
|
|
|
(p (seq-position defval (plist-get a key)))
|
|
|
|
(q (seq-position defval (plist-get b key))))
|
|
|
|
(unless (eql p q)
|
|
|
|
(throw 'done (when p (or (not q) (< p q))))))))))
|
|
|
|
(plist (copy-sequence defaults)))
|
|
|
|
(unless (plist-get plist :max)
|
|
|
|
(setq plist (plist-put plist :max 5000))) ; `auth-source-netrc-parse'
|
|
|
|
(unless (plist-get defaults :require)
|
|
|
|
(setq plist (plist-put plist :require '(:secret))))
|
2022-11-13 01:52:48 -08:00
|
|
|
(when-let* ((sorted (sort (apply #'auth-source-search plist) test)))
|
|
|
|
(plist-get (car sorted) :secret))))
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
|
|
|
|
(defun erc-auth-source-search (&rest plist)
|
|
|
|
"Call `auth-source-search', possibly with keyword params in PLIST."
|
|
|
|
;; These exist as separate helpers in case folks should find them
|
|
|
|
;; useful. If that's you, please request that they be exported.
|
|
|
|
(apply #'erc--auth-source-search
|
|
|
|
(apply #'erc--auth-source-determine-params-merge plist)))
|
|
|
|
|
2017-01-05 07:11:06 -07:00
|
|
|
(defun erc-server-join-channel (server channel &optional secret)
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
"Join CHANNEL, optionally with SECRET.
|
|
|
|
Without SECRET, consult auth-source, possibly passing SERVER as the
|
|
|
|
`:host' query parameter."
|
|
|
|
(unless (or secret (not erc-auth-source-join-function))
|
|
|
|
(unless server
|
|
|
|
(when (and erc-server-announced-name
|
|
|
|
(erc--valid-local-channel-p channel))
|
|
|
|
(setq server erc-server-announced-name)))
|
|
|
|
(setq secret (apply erc-auth-source-join-function
|
|
|
|
`(,@(and server (list :host server)) :user ,channel))))
|
|
|
|
(erc-log (format "cmd: JOIN: %s" channel))
|
2022-11-13 01:52:48 -08:00
|
|
|
(erc-server-send (concat "JOIN " channel
|
|
|
|
(and secret (concat " " (erc--unfun secret))))))
|
2017-01-05 07:11:06 -07:00
|
|
|
|
2021-08-16 05:01:16 -07:00
|
|
|
(defun erc--valid-local-channel-p (channel)
|
|
|
|
"Non-nil when channel is server-local on a network that allows them."
|
|
|
|
(and-let* (((eq ?& (aref channel 0)))
|
|
|
|
(chan-types (erc--get-isupport-entry 'CHANTYPES 'single))
|
2022-07-08 04:58:26 -07:00
|
|
|
((string-search "&" chan-types)))))
|
2021-08-16 05:01:16 -07:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-cmd-JOIN (channel &optional key)
|
|
|
|
"Join the channel given in CHANNEL, optionally with KEY.
|
|
|
|
If CHANNEL is specified as \"-invite\", join the channel to which you
|
|
|
|
were most recently invited. See also `invitation'."
|
|
|
|
(let (chnl)
|
|
|
|
(if (string= (upcase channel) "-INVITE")
|
2014-11-08 20:51:43 -05:00
|
|
|
(if erc-invitation
|
|
|
|
(setq chnl erc-invitation)
|
|
|
|
(erc-display-message nil 'error (current-buffer) 'no-invitation))
|
2006-01-29 13:08:58 +00:00
|
|
|
(setq chnl (erc-ensure-channel-name channel)))
|
|
|
|
(when chnl
|
|
|
|
;; Prevent double joining of same channel on same server.
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
(if-let* ((existing (erc-get-buffer chnl erc-server-process))
|
|
|
|
((with-current-buffer existing
|
|
|
|
(erc-get-channel-user (erc-current-nick)))))
|
|
|
|
(switch-to-buffer existing)
|
Extend erc-interactive-display to cover /JOINs
* lisp/erc/erc.el (erc-display): Mention that buffer-related display
options live in the customization group `erc-buffers'.
(erc-buffer-display, erc-join-buffer): Swap alias and aliased so that
the favored name, `erc-buffer-display', appears in the definition and
in the Customize menu. Also note related buffer-display options in
the doc string.
(erc-query-display, erc-interactive-display): Make the former an alias
of the latter, new in ERC 5.6, because their roles were functionally
redundant and thus confusing. Inherit the default value from
`erc-query-display' because users are more familiar with the pop-up
window behavior than a single-window replacement.
(erc-reconnect-display): Use preferred name for cross-referencing
fallback option `erc-buffer-display' in doc string, and explain how
/reconnect handling differs.
(erc--setup-buffer-hook): Add new internal hook for modules that
operate on windows and frames, such as erc-speedbar and
erc-status-sidebar.
(erc-open): Run `erc--setup-buffer-hook' after `erc-setup-buffer' so
hook members know their code isn't tied to `erc-setup-buffer' itself,
which may be used in other contexts, but rather to a new ERC buffer on
which some display-related action has just been performed.
(erc--called-as-input-p): New variable for "slash" commands, like
`erc-cmd-FOO', to detect whether they're being called "interactively"
as a result of input given at ERC's prompt.
(erc-process-input-line): Bind `erc--called-as-input-p' when running
slash commands.
(erc-cmd-JOIN): When called interactively, schedule a callback to wrap
the response handler and control how new buffers are thus displayed.
(erc-cmd-QUERY): Use preferred alias for `erc-query-display'.
* test/lisp/erc/erc-scenarios-base-buffer-display.el:
(erc-scenarios-base-buffer-display--interactive-default): New test.
* test/lisp/erc/erc-tests.el (erc-process-input-line,
erc-select-read-args, erc-tls, erc--interactive): Change expected
default value of `erc-interactive-display' from `buffer' to
`window'. (Bug#62833)
2023-04-10 17:58:05 -07:00
|
|
|
(when-let* ; bind `erc-join-buffer' when /JOIN issued
|
|
|
|
((erc--called-as-input-p)
|
|
|
|
(fn (lambda (proc parsed)
|
|
|
|
(when-let* ; `fn' wrapper already removed from hook
|
|
|
|
(((equal (car (erc-response.command-args parsed))
|
|
|
|
channel))
|
|
|
|
(sn (erc-extract-nick (erc-response.sender parsed)))
|
|
|
|
((erc-nick-equal-p sn (erc-current-nick)))
|
|
|
|
(erc-join-buffer (or erc-interactive-display
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
erc-join-buffer))
|
|
|
|
(erc--display-context `((erc-interactive-display
|
|
|
|
. /JOIN)
|
|
|
|
,@erc--display-context)))
|
Extend erc-interactive-display to cover /JOINs
* lisp/erc/erc.el (erc-display): Mention that buffer-related display
options live in the customization group `erc-buffers'.
(erc-buffer-display, erc-join-buffer): Swap alias and aliased so that
the favored name, `erc-buffer-display', appears in the definition and
in the Customize menu. Also note related buffer-display options in
the doc string.
(erc-query-display, erc-interactive-display): Make the former an alias
of the latter, new in ERC 5.6, because their roles were functionally
redundant and thus confusing. Inherit the default value from
`erc-query-display' because users are more familiar with the pop-up
window behavior than a single-window replacement.
(erc-reconnect-display): Use preferred name for cross-referencing
fallback option `erc-buffer-display' in doc string, and explain how
/reconnect handling differs.
(erc--setup-buffer-hook): Add new internal hook for modules that
operate on windows and frames, such as erc-speedbar and
erc-status-sidebar.
(erc-open): Run `erc--setup-buffer-hook' after `erc-setup-buffer' so
hook members know their code isn't tied to `erc-setup-buffer' itself,
which may be used in other contexts, but rather to a new ERC buffer on
which some display-related action has just been performed.
(erc--called-as-input-p): New variable for "slash" commands, like
`erc-cmd-FOO', to detect whether they're being called "interactively"
as a result of input given at ERC's prompt.
(erc-process-input-line): Bind `erc--called-as-input-p' when running
slash commands.
(erc-cmd-JOIN): When called interactively, schedule a callback to wrap
the response handler and control how new buffers are thus displayed.
(erc-cmd-QUERY): Use preferred alias for `erc-query-display'.
* test/lisp/erc/erc-scenarios-base-buffer-display.el:
(erc-scenarios-base-buffer-display--interactive-default): New test.
* test/lisp/erc/erc-tests.el (erc-process-input-line,
erc-select-read-args, erc-tls, erc--interactive): Change expected
default value of `erc-interactive-display' from `buffer' to
`window'. (Bug#62833)
2023-04-10 17:58:05 -07:00
|
|
|
(run-hook-with-args-until-success
|
|
|
|
'erc-server-JOIN-functions proc parsed)
|
|
|
|
t))))
|
|
|
|
(erc-with-server-buffer
|
|
|
|
(erc-once-with-server-event "JOIN" fn)))
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
(erc-server-join-channel nil chnl key))))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-CHANNEL #'erc-cmd-JOIN)
|
|
|
|
(defalias 'erc-cmd-J #'erc-cmd-JOIN)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-channel-new-member-names nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"If non-nil, a names list is currently being received.
|
|
|
|
|
|
|
|
If non-nil, this variable is a hash-table that associates
|
|
|
|
received nicks with t.")
|
|
|
|
|
|
|
|
(defun erc-cmd-NAMES (&optional channel)
|
|
|
|
"Display the users in CHANNEL.
|
|
|
|
If CHANNEL is not specified, display the users in the current channel.
|
|
|
|
This function clears the channel name list first, then sends the
|
|
|
|
command."
|
|
|
|
(let ((tgt (or (and (erc-channel-p channel) channel)
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-default-target))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (and tgt (erc-channel-p tgt))
|
2014-11-08 20:51:43 -05:00
|
|
|
(progn
|
|
|
|
(erc-log (format "cmd: DEFAULT: NAMES %s" tgt))
|
|
|
|
(erc-with-buffer
|
|
|
|
(tgt)
|
|
|
|
(erc-channel-begin-receiving-names))
|
|
|
|
(erc-server-send (concat "NAMES " tgt)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-display-message nil 'error (current-buffer) 'no-default-channel)))
|
|
|
|
t)
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-N #'erc-cmd-NAMES)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-cmd-KICK (target &optional reason-or-nick &rest reasonwords)
|
|
|
|
"Kick the user indicated in LINE from the current channel.
|
|
|
|
LINE has the format: \"#CHANNEL NICK REASON\" or \"NICK REASON\"."
|
2021-01-04 00:21:02 -05:00
|
|
|
(let ((reasonstring (mapconcat #'identity reasonwords " ")))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (string= "" reasonstring)
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq reasonstring (format "Kicked by %s" (erc-current-nick))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (erc-channel-p target)
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((nick reason-or-nick))
|
|
|
|
(erc-log (format "cmd: KICK: %s/%s: %s" nick target reasonstring))
|
|
|
|
(erc-server-send (format "KICK %s %s :%s" target nick reasonstring)
|
|
|
|
nil target)
|
|
|
|
t)
|
2006-01-29 13:08:58 +00:00
|
|
|
(when target
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((ch (erc-default-target)))
|
|
|
|
(setq reasonstring (concat
|
|
|
|
(if reason-or-nick (concat reason-or-nick " "))
|
|
|
|
reasonstring))
|
|
|
|
(if ch
|
|
|
|
(progn
|
|
|
|
(erc-log
|
|
|
|
(format "cmd: KICK: %s/%s: %s" target ch reasonstring))
|
|
|
|
(erc-server-send
|
|
|
|
(format "KICK %s %s :%s" ch target reasonstring) nil ch))
|
|
|
|
(erc-display-message nil 'error (current-buffer)
|
|
|
|
'no-default-channel))
|
|
|
|
t)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defvar erc-script-args nil)
|
|
|
|
|
|
|
|
(defun erc-cmd-LOAD (line)
|
|
|
|
"Load the script provided in the LINE.
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
If LINE continues beyond the file name, the rest of
|
|
|
|
it is put in a (local) variable `erc-script-args',
|
|
|
|
which can be used in Emacs Lisp scripts.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
The optional FORCE argument is ignored here - you can't force loading
|
|
|
|
a script after exceeding the flood threshold."
|
|
|
|
(cond
|
|
|
|
((string-match "^\\s-*\\(\\S-+\\)\\(.*\\)$" line)
|
|
|
|
(let* ((file-to-find (match-string 1 line))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-script-args (match-string 2 line))
|
|
|
|
(file (erc-find-file file-to-find erc-script-path)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-log (format "cmd: LOAD: %s" file-to-find))
|
|
|
|
(cond
|
|
|
|
((not file)
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-display-message nil 'error (current-buffer)
|
|
|
|
'cannot-find-file ?f file-to-find))
|
2006-01-29 13:08:58 +00:00
|
|
|
((not (file-readable-p file))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-display-message nil 'error (current-buffer)
|
|
|
|
'cannot-read-file ?f file))
|
2006-01-29 13:08:58 +00:00
|
|
|
(t
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
(message "Loading `%s'..." file)
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-load-script file)
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
(message "Loading `%s'...done" file))))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
(t nil)))
|
|
|
|
|
2021-10-01 01:21:08 -04:00
|
|
|
(defun erc-cmd-WHOIS (first &optional second)
|
2021-09-29 22:15:07 -04:00
|
|
|
"Display whois information for the given user.
|
|
|
|
|
2021-10-01 01:21:08 -04:00
|
|
|
With one argument, FIRST is the nickname of the user to request
|
|
|
|
whois information for.
|
|
|
|
|
|
|
|
With two arguments, FIRST is the server, and SECOND is the user
|
|
|
|
nickname.
|
|
|
|
|
|
|
|
Specifying the server is useful for getting the time the user has
|
|
|
|
been idle for, when the user is connected to a different server
|
|
|
|
on the same IRC network. (Only the server a user is connected to
|
|
|
|
knows how long the user has been idle for.)"
|
2021-10-01 01:31:29 -04:00
|
|
|
(let ((send (if second
|
2021-10-01 01:21:08 -04:00
|
|
|
(format "WHOIS %s %s" first second)
|
|
|
|
(format "WHOIS %s" first))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-log (format "cmd: %s" send))
|
|
|
|
(erc-server-send send)
|
2014-11-08 20:51:43 -05:00
|
|
|
t))
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-WI #'erc-cmd-WHOIS)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2021-09-29 23:11:49 -04:00
|
|
|
(defun erc-cmd-WII (nick)
|
|
|
|
"Display whois information for NICK, including idle time.
|
|
|
|
|
|
|
|
This is a convenience function which calls `erc-cmd-WHOIS' with
|
|
|
|
the given NICK for both arguments. Using NICK in place of the
|
|
|
|
server argument -- effectively delegating to the IRC network the
|
|
|
|
looking up of the server to which NICK is connected -- is not
|
|
|
|
standardized, but is widely supported across IRC networks.
|
|
|
|
|
|
|
|
See `erc-cmd-WHOIS' for more details."
|
|
|
|
(erc-cmd-WHOIS nick nick))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-cmd-WHOAMI ()
|
|
|
|
"Display whois information about yourself."
|
|
|
|
(erc-cmd-WHOIS (erc-current-nick))
|
|
|
|
t)
|
|
|
|
|
|
|
|
(defun erc-cmd-IDLE (nick)
|
|
|
|
"Show the length of time NICK has been idle."
|
2007-04-01 13:36:38 +00:00
|
|
|
(let ((origbuf (current-buffer))
|
2014-11-08 20:51:43 -05:00
|
|
|
symlist)
|
2007-04-01 13:36:38 +00:00
|
|
|
(erc-with-server-buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(push (cons (erc-once-with-server-event
|
|
|
|
311 (lambda (_proc parsed)
|
|
|
|
(string= nick
|
|
|
|
(nth 1 (erc-response.command-args
|
|
|
|
parsed)))))
|
|
|
|
'erc-server-311-functions)
|
|
|
|
symlist)
|
|
|
|
(push (cons (erc-once-with-server-event
|
|
|
|
312 (lambda (_proc parsed)
|
|
|
|
(string= nick
|
|
|
|
(nth 1 (erc-response.command-args
|
|
|
|
parsed)))))
|
|
|
|
'erc-server-312-functions)
|
|
|
|
symlist)
|
|
|
|
(push (cons (erc-once-with-server-event
|
|
|
|
318 (lambda (_proc parsed)
|
|
|
|
(string= nick
|
|
|
|
(nth 1 (erc-response.command-args
|
|
|
|
parsed)))))
|
|
|
|
'erc-server-318-functions)
|
|
|
|
symlist)
|
|
|
|
(push (cons (erc-once-with-server-event
|
|
|
|
319 (lambda (_proc parsed)
|
|
|
|
(string= nick
|
|
|
|
(nth 1 (erc-response.command-args
|
|
|
|
parsed)))))
|
|
|
|
'erc-server-319-functions)
|
|
|
|
symlist)
|
|
|
|
(push (cons (erc-once-with-server-event
|
|
|
|
320 (lambda (_proc parsed)
|
|
|
|
(string= nick
|
|
|
|
(nth 1 (erc-response.command-args
|
|
|
|
parsed)))))
|
|
|
|
'erc-server-320-functions)
|
|
|
|
symlist)
|
|
|
|
(push (cons (erc-once-with-server-event
|
|
|
|
330 (lambda (_proc parsed)
|
|
|
|
(string= nick
|
|
|
|
(nth 1 (erc-response.command-args
|
|
|
|
parsed)))))
|
|
|
|
'erc-server-330-functions)
|
|
|
|
symlist)
|
|
|
|
(push (cons (erc-once-with-server-event
|
|
|
|
317
|
|
|
|
(lambda (_proc parsed)
|
|
|
|
(let ((idleseconds
|
|
|
|
(string-to-number
|
|
|
|
(cl-third
|
|
|
|
(erc-response.command-args parsed)))))
|
2023-10-04 20:39:03 -07:00
|
|
|
(erc-display-message nil 'notice origbuf
|
2014-11-08 20:51:43 -05:00
|
|
|
(format "%s has been idle for %s."
|
|
|
|
(erc-string-no-properties nick)
|
|
|
|
(erc-seconds-to-string idleseconds)))
|
|
|
|
t)))
|
|
|
|
'erc-server-317-functions)
|
|
|
|
symlist)
|
|
|
|
|
|
|
|
;; Send the WHOIS command.
|
|
|
|
(erc-cmd-WHOIS nick)
|
|
|
|
|
|
|
|
;; Remove the uninterned symbols from the server hooks that did not run.
|
|
|
|
(run-at-time 20 nil (lambda (buf symlist)
|
|
|
|
(with-current-buffer buf
|
|
|
|
(dolist (sym symlist)
|
|
|
|
(let ((hooksym (cdr sym))
|
|
|
|
(funcsym (car sym)))
|
|
|
|
(remove-hook hooksym funcsym t)))))
|
|
|
|
(current-buffer) symlist)))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
|
|
|
|
(defun erc-cmd-DESCRIBE (line)
|
|
|
|
"Pose some action to a certain user.
|
|
|
|
LINE has the format \"USER ACTION\"."
|
|
|
|
(cond
|
|
|
|
((string-match
|
|
|
|
"^\\s-*\\(\\S-+\\)\\s-\\(.*\\)$" line)
|
|
|
|
(let ((dst (match-string 1 line))
|
2014-11-08 20:51:43 -05:00
|
|
|
(s (match-string 2 line)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-log (format "cmd: DESCRIBE: [%s] %s" dst s))
|
|
|
|
(erc-send-action dst s))
|
|
|
|
t)
|
|
|
|
(t nil)))
|
|
|
|
(put 'erc-cmd-DESCRIBE 'do-not-parse-args t)
|
|
|
|
|
|
|
|
(defun erc-cmd-ME (line)
|
|
|
|
"Send LINE as an action."
|
|
|
|
(cond
|
|
|
|
((string-match "^\\s-\\(.*\\)$" line)
|
|
|
|
(let ((s (match-string 1 line)))
|
|
|
|
(erc-log (format "cmd: ME: %s" s))
|
|
|
|
(erc-send-action (erc-default-target) s))
|
|
|
|
t)
|
|
|
|
(t nil)))
|
|
|
|
(put 'erc-cmd-ME 'do-not-parse-args t)
|
|
|
|
|
2007-10-29 01:00:33 +00:00
|
|
|
(defun erc-cmd-ME\'S (line)
|
2015-11-17 15:28:50 -08:00
|
|
|
"Do a /ME command, but add the string \" \\='s\" to the beginning."
|
2007-10-29 01:00:33 +00:00
|
|
|
(erc-cmd-ME (concat " 's" line)))
|
|
|
|
(put 'erc-cmd-ME\'S 'do-not-parse-args t)
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-cmd-LASTLOG (line)
|
|
|
|
"Show all lines in the current buffer matching the regexp LINE.
|
|
|
|
|
|
|
|
If a match spreads across multiple lines, all those lines are shown.
|
|
|
|
|
|
|
|
The lines are shown in a buffer named `*Occur*'.
|
|
|
|
It serves as a menu to find any of the occurrences in this buffer.
|
|
|
|
\\[describe-mode] in that buffer will explain how.
|
|
|
|
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
If LINE contains upper case characters (excluding those preceded by `\\'),
|
2006-01-29 13:08:58 +00:00
|
|
|
the matching is case-sensitive."
|
|
|
|
(occur line)
|
|
|
|
t)
|
|
|
|
(put 'erc-cmd-LASTLOG 'do-not-parse-args t)
|
2007-09-08 03:07:09 +00:00
|
|
|
(put 'erc-cmd-LASTLOG 'process-not-needed t)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(defvar erc--send-message-nested-function #'erc--send-message-nested
|
|
|
|
"Function for inserting and sending slash-command generated text.
|
|
|
|
When a command like /SV or /SAY modifies or replaces command-line
|
|
|
|
input originally submitted at the prompt, `erc-send-message'
|
|
|
|
performs additional processing to ensure said input is fit for
|
|
|
|
inserting and sending given this \"nested\" meta context. This
|
|
|
|
interface variable exists because modules extending fundamental
|
|
|
|
insertion and sending operations need a say in this processing as
|
|
|
|
well.")
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-send-message (line &optional force)
|
|
|
|
"Send LINE to the current channel or user and display it.
|
|
|
|
|
|
|
|
See also `erc-message' and `erc-display-line'."
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(if (erc--input-split-p erc--current-line-input-split)
|
|
|
|
(funcall erc--send-message-nested-function line force)
|
|
|
|
(erc--send-message-external line force)))
|
|
|
|
|
|
|
|
(defun erc--send-message-external (line force)
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-message "PRIVMSG" (concat (erc-default-target) " " line) force)
|
|
|
|
(erc-display-line
|
|
|
|
(concat (erc-format-my-nick) line)
|
2014-11-08 20:51:43 -05:00
|
|
|
(current-buffer))
|
2006-01-29 13:08:58 +00:00
|
|
|
;; FIXME - treat multiline, run hooks, or remove me?
|
|
|
|
t)
|
|
|
|
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(defun erc--send-message-nested (input-line force)
|
|
|
|
"Process string INPUT-LINE almost as if it's normal chat input.
|
|
|
|
Expect INPUT-LINE to differ from the `string' slot of the calling
|
|
|
|
context's `erc--current-line-input-split' object because the
|
|
|
|
latter is likely a slash command invocation whose handler
|
|
|
|
generated INPUT-LINE. Before inserting INPUT-LINE, split it and
|
|
|
|
run `erc-send-modify-hook' and `erc-send-post-hook' on each
|
|
|
|
actual outgoing line. Forgo input validation because this isn't
|
|
|
|
interactive input, and skip `erc-send-completed-hook' because it
|
|
|
|
will run just before the outer `erc-send-current-line' call
|
|
|
|
returns."
|
|
|
|
(let* ((erc-flood-protect (not force))
|
|
|
|
(lines-obj (erc--make-input-split input-line)))
|
|
|
|
(setf (erc--input-split-refoldp lines-obj) t
|
|
|
|
(erc--input-split-cmdp lines-obj) nil)
|
|
|
|
(erc--send-input-lines (erc--run-send-hooks lines-obj)))
|
|
|
|
t)
|
|
|
|
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
;; FIXME if the user types /MODE<RET>, LINE becomes "\n", which
|
|
|
|
;; matches the pattern, so "\n" is sent to the server. Perhaps
|
|
|
|
;; instead of `do-not-parse-args', this should just join &rest
|
|
|
|
;; arguments.
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-cmd-MODE (line)
|
|
|
|
"Change or display the mode value of a channel or user.
|
|
|
|
The first word specifies the target. The rest is the mode string
|
|
|
|
to send.
|
|
|
|
|
|
|
|
If only one word is given, display the mode of that target.
|
|
|
|
|
2021-07-03 23:39:18 -04:00
|
|
|
A list of valid mode strings for Libera.Chat may be found at
|
|
|
|
`https://libera.chat/guides/channelmodes' and
|
|
|
|
`https://libera.chat/guides/usermodes'."
|
2006-01-29 13:08:58 +00:00
|
|
|
(cond
|
|
|
|
((string-match "^\\s-\\(.*\\)$" line)
|
|
|
|
(let ((s (match-string 1 line)))
|
|
|
|
(erc-log (format "cmd: MODE: %s" s))
|
|
|
|
(erc-server-send (concat "MODE " line)))
|
|
|
|
t)
|
|
|
|
(t nil)))
|
|
|
|
(put 'erc-cmd-MODE 'do-not-parse-args t)
|
|
|
|
|
|
|
|
(defun erc-cmd-NOTICE (channel-or-user &rest message)
|
|
|
|
"Send a notice to the channel or user given as the first word.
|
|
|
|
The rest is the message to send."
|
|
|
|
(erc-message "NOTICE" (concat channel-or-user " "
|
2014-11-08 20:51:43 -05:00
|
|
|
(mapconcat #'identity message " "))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-cmd-MSG (line)
|
|
|
|
"Send a message to the channel or user given as the first word in LINE.
|
|
|
|
|
|
|
|
The rest of LINE is the message to send."
|
|
|
|
(erc-message "PRIVMSG" line))
|
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-M #'erc-cmd-MSG)
|
2006-01-29 13:08:58 +00:00
|
|
|
(put 'erc-cmd-MSG 'do-not-parse-args t)
|
|
|
|
|
|
|
|
(defun erc-cmd-SQUERY (line)
|
|
|
|
"Send a Service Query to the service given as the first word in LINE.
|
|
|
|
|
|
|
|
The rest of LINE is the message to send."
|
|
|
|
(erc-message "SQUERY" line))
|
2023-11-17 12:31:50 +02:00
|
|
|
(put 'erc-cmd-SQUERY 'do-not-parse-args t)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-cmd-NICK (nick)
|
|
|
|
"Change current nickname to NICK."
|
|
|
|
(erc-log (format "cmd: NICK: %s (erc-bad-nick: %S)" nick erc-bad-nick))
|
2021-08-12 03:10:31 -07:00
|
|
|
(let ((nicklen (erc-with-server-buffer
|
|
|
|
(erc--get-isupport-entry 'NICKLEN 'single))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(and nicklen (> (length nick) (string-to-number nicklen))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-display-message
|
|
|
|
nil 'notice 'active 'nick-too-long
|
|
|
|
?i (length nick) ?l nicklen)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-server-send (format "NICK %s" nick))
|
|
|
|
(cond (erc-bad-nick
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-set-current-nick nick)
|
|
|
|
(erc-update-mode-line)
|
|
|
|
(setq erc-bad-nick nil)))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
|
|
|
|
(defun erc-cmd-PART (line)
|
|
|
|
"When LINE is an empty string, leave the current channel.
|
|
|
|
Otherwise leave the channel indicated by LINE."
|
|
|
|
(cond
|
|
|
|
((string-match "^\\s-*\\([&#+!]\\S-+\\)\\s-?\\(.*\\)$" line)
|
|
|
|
(let* ((ch (match-string 1 line))
|
2014-11-08 20:51:43 -05:00
|
|
|
(msg (match-string 2 line))
|
|
|
|
(reason (funcall erc-part-reason (if (equal msg "") nil msg))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-log (format "cmd: PART: %s: %s" ch reason))
|
|
|
|
(erc-server-send (if (string= reason "")
|
2014-11-08 20:51:43 -05:00
|
|
|
(format "PART %s" ch)
|
|
|
|
(format "PART %s :%s" ch reason))
|
|
|
|
nil ch))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
((string-match "^\\s-*\\(.*\\)$" line)
|
|
|
|
(let* ((ch (erc-default-target))
|
2014-11-08 20:51:43 -05:00
|
|
|
(msg (match-string 1 line))
|
|
|
|
(reason (funcall erc-part-reason (if (equal msg "") nil msg))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (and ch (erc-channel-p ch))
|
2014-11-08 20:51:43 -05:00
|
|
|
(progn
|
|
|
|
(erc-log (format "cmd: PART: %s: %s" ch reason))
|
|
|
|
(erc-server-send (if (string= reason "")
|
|
|
|
(format "PART %s" ch)
|
|
|
|
(format "PART %s :%s" ch reason))
|
|
|
|
nil ch))
|
2023-11-08 19:14:55 -08:00
|
|
|
(erc-display-message nil '(notice error) (current-buffer) 'no-target)))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
(t nil)))
|
|
|
|
(put 'erc-cmd-PART 'do-not-parse-args t)
|
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-LEAVE #'erc-cmd-PART)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-cmd-PING (recipient)
|
|
|
|
"Ping RECIPIENT."
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-22 18:32:31 -08:00
|
|
|
(let ((time (format-time-string "%s.%6N")))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-log (format "cmd: PING: %s" time))
|
|
|
|
(erc-cmd-CTCP recipient "PING" time)))
|
|
|
|
|
|
|
|
(defun erc-cmd-QUOTE (line)
|
|
|
|
"Send LINE directly to the server.
|
|
|
|
All the text given as argument is sent to the sever as unmodified,
|
|
|
|
just as you provided it. Use this command with care!"
|
|
|
|
(cond
|
2006-03-27 11:27:46 +00:00
|
|
|
((string-match "^ ?\\(.+\\)$" line)
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-server-send (match-string 1 line)))
|
|
|
|
(t nil)))
|
|
|
|
(put 'erc-cmd-QUOTE 'do-not-parse-args t)
|
|
|
|
|
|
|
|
(defun erc-cmd-QUERY (&optional user)
|
|
|
|
"Open a query with USER.
|
2021-11-11 18:39:19 +01:00
|
|
|
How the query is displayed (in a new window, frame, etc.) depends
|
Extend erc-interactive-display to cover /JOINs
* lisp/erc/erc.el (erc-display): Mention that buffer-related display
options live in the customization group `erc-buffers'.
(erc-buffer-display, erc-join-buffer): Swap alias and aliased so that
the favored name, `erc-buffer-display', appears in the definition and
in the Customize menu. Also note related buffer-display options in
the doc string.
(erc-query-display, erc-interactive-display): Make the former an alias
of the latter, new in ERC 5.6, because their roles were functionally
redundant and thus confusing. Inherit the default value from
`erc-query-display' because users are more familiar with the pop-up
window behavior than a single-window replacement.
(erc-reconnect-display): Use preferred name for cross-referencing
fallback option `erc-buffer-display' in doc string, and explain how
/reconnect handling differs.
(erc--setup-buffer-hook): Add new internal hook for modules that
operate on windows and frames, such as erc-speedbar and
erc-status-sidebar.
(erc-open): Run `erc--setup-buffer-hook' after `erc-setup-buffer' so
hook members know their code isn't tied to `erc-setup-buffer' itself,
which may be used in other contexts, but rather to a new ERC buffer on
which some display-related action has just been performed.
(erc--called-as-input-p): New variable for "slash" commands, like
`erc-cmd-FOO', to detect whether they're being called "interactively"
as a result of input given at ERC's prompt.
(erc-process-input-line): Bind `erc--called-as-input-p' when running
slash commands.
(erc-cmd-JOIN): When called interactively, schedule a callback to wrap
the response handler and control how new buffers are thus displayed.
(erc-cmd-QUERY): Use preferred alias for `erc-query-display'.
* test/lisp/erc/erc-scenarios-base-buffer-display.el:
(erc-scenarios-base-buffer-display--interactive-default): New test.
* test/lisp/erc/erc-tests.el (erc-process-input-line,
erc-select-read-args, erc-tls, erc--interactive): Change expected
default value of `erc-interactive-display' from `buffer' to
`window'. (Bug#62833)
2023-04-10 17:58:05 -07:00
|
|
|
on the value of `erc-interactive-display'."
|
2021-11-11 18:39:19 +01:00
|
|
|
;; FIXME: The doc string used to say at the end:
|
|
|
|
;; "If USER is omitted, close the current query buffer if one exists
|
|
|
|
;; - except this is broken now ;-)"
|
|
|
|
;; Does it make sense to have that functionality? What's wrong with
|
|
|
|
;; `kill-buffer'? If it makes sense, re-add it. -- SK @ 2021-11-11
|
2006-01-29 13:08:58 +00:00
|
|
|
(interactive
|
2021-03-07 19:06:06 -05:00
|
|
|
(list (read-string "Start a query with: ")))
|
2021-05-07 01:52:41 -07:00
|
|
|
(unless user
|
2006-01-29 13:08:58 +00:00
|
|
|
;; currently broken, evil hack to display help anyway
|
2014-11-08 20:51:43 -05:00
|
|
|
;(erc-delete-query))))
|
2023-04-13 00:00:02 -07:00
|
|
|
(signal 'wrong-number-of-arguments '(erc-cmd-QUERY 0)))
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(let ((erc-join-buffer erc-interactive-display)
|
|
|
|
(erc--display-context `((erc-interactive-display . /QUERY)
|
|
|
|
,@erc--display-context)))
|
2021-05-07 01:52:41 -07:00
|
|
|
(erc-with-server-buffer
|
|
|
|
(erc--open-target user))))
|
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-Q #'erc-cmd-QUERY)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2014-11-08 20:51:43 -05:00
|
|
|
(defun erc-quit/part-reason-default ()
|
|
|
|
"Default quit/part message."
|
2021-10-06 21:50:56 -04:00
|
|
|
(erc-version nil 'bold-erc))
|
2014-11-08 20:51:43 -05:00
|
|
|
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-quit-reason-normal (&optional s)
|
|
|
|
"Normal quit message.
|
|
|
|
|
|
|
|
If S is non-nil, it will be used as the quit reason."
|
2014-11-08 20:51:43 -05:00
|
|
|
(or s (erc-quit/part-reason-default)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-quit-reason-zippy (&optional s)
|
|
|
|
"Zippy quit message.
|
|
|
|
|
|
|
|
If S is non-nil, it will be used as the quit reason."
|
2022-05-13 22:29:53 +02:00
|
|
|
(or s (erc-quit/part-reason-default)))
|
2013-05-21 00:15:59 -07:00
|
|
|
|
|
|
|
(make-obsolete 'erc-quit-reason-zippy "it will be removed." "24.4")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-quit-reason-various (s)
|
|
|
|
"Choose a quit reason based on S (a string)."
|
|
|
|
(let ((res (car (assoc-default (or s "")
|
2014-11-08 20:51:43 -05:00
|
|
|
erc-quit-reason-various-alist 'string-match))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(cond
|
|
|
|
((functionp res) (funcall res))
|
|
|
|
((stringp res) res)
|
2006-07-14 02:29:50 +00:00
|
|
|
(s s)
|
2014-11-08 20:51:43 -05:00
|
|
|
(t (erc-quit/part-reason-default)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-part-reason-normal (&optional s)
|
|
|
|
"Normal part message.
|
|
|
|
|
2014-11-08 20:51:43 -05:00
|
|
|
If S is non-nil, it will be used as the part reason."
|
|
|
|
(or s (erc-quit/part-reason-default)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-part-reason-zippy (&optional s)
|
|
|
|
"Zippy part message.
|
|
|
|
|
|
|
|
If S is non-nil, it will be used as the quit reason."
|
2022-05-13 22:29:53 +02:00
|
|
|
(or s (erc-quit/part-reason-default)))
|
2013-05-21 00:15:59 -07:00
|
|
|
|
|
|
|
(make-obsolete 'erc-part-reason-zippy "it will be removed." "24.4")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-part-reason-various (s)
|
|
|
|
"Choose a part reason based on S (a string)."
|
|
|
|
(let ((res (car (assoc-default (or s "")
|
2014-11-08 20:51:43 -05:00
|
|
|
erc-part-reason-various-alist 'string-match))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(cond
|
|
|
|
((functionp res) (funcall res))
|
|
|
|
((stringp res) res)
|
2006-07-14 02:29:50 +00:00
|
|
|
(s s)
|
2014-11-08 20:51:43 -05:00
|
|
|
(t (erc-quit/part-reason-default)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-cmd-QUIT (reason)
|
|
|
|
"Disconnect from the current server.
|
|
|
|
If REASON is omitted, display a default quit message, otherwise display
|
|
|
|
the message given by REASON."
|
|
|
|
(unless reason
|
|
|
|
(setq reason ""))
|
|
|
|
(cond
|
|
|
|
((string-match "^\\s-*\\(.*\\)$" reason)
|
|
|
|
(let* ((s (match-string 1 reason))
|
2014-11-08 20:51:43 -05:00
|
|
|
(buffer (erc-server-buffer))
|
|
|
|
(reason (funcall erc-quit-reason (if (equal s "") nil s)))
|
|
|
|
server-proc)
|
2006-01-29 13:08:58 +00:00
|
|
|
(with-current-buffer (if (and buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(bufferp buffer))
|
|
|
|
buffer
|
|
|
|
(current-buffer))
|
|
|
|
(erc-log (format "cmd: QUIT: %s" reason))
|
|
|
|
(setq erc-server-quitting t)
|
|
|
|
(erc-set-active-buffer (erc-server-buffer))
|
|
|
|
(setq server-proc erc-server-process)
|
|
|
|
(erc-server-send (format "QUIT :%s" reason)))
|
2007-04-01 13:36:38 +00:00
|
|
|
(run-hook-with-args 'erc-quit-hook server-proc)
|
2006-01-29 13:08:58 +00:00
|
|
|
(when erc-kill-queries-on-quit
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-kill-query-buffers server-proc))
|
2007-04-01 13:36:38 +00:00
|
|
|
;; if the process has not been killed within 4 seconds, kill it
|
|
|
|
(run-at-time 4 nil
|
2014-11-08 20:51:43 -05:00
|
|
|
(lambda (proc)
|
|
|
|
(when (and (processp proc)
|
|
|
|
(memq (process-status proc) '(run open)))
|
|
|
|
(delete-process proc)))
|
|
|
|
server-proc))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
(t nil)))
|
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-BYE #'erc-cmd-QUIT)
|
|
|
|
(defalias 'erc-cmd-EXIT #'erc-cmd-QUIT)
|
|
|
|
(defalias 'erc-cmd-SIGNOFF #'erc-cmd-QUIT)
|
2006-01-29 13:08:58 +00:00
|
|
|
(put 'erc-cmd-QUIT 'do-not-parse-args t)
|
2007-09-08 03:07:09 +00:00
|
|
|
(put 'erc-cmd-QUIT 'process-not-needed t)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-cmd-GQUIT (reason)
|
|
|
|
"Disconnect from all servers at once with the same quit REASON."
|
2007-04-01 13:36:38 +00:00
|
|
|
(erc-with-all-buffers-of-server nil #'erc-open-server-buffer-p
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-cmd-QUIT reason))
|
2007-09-08 03:07:09 +00:00
|
|
|
(when erc-kill-queries-on-quit
|
|
|
|
;; if the query buffers have not been killed within 4 seconds,
|
|
|
|
;; kill them
|
|
|
|
(run-at-time
|
|
|
|
4 nil
|
2023-10-15 07:22:31 -07:00
|
|
|
#'erc-buffer-do (lambda () (when erc--target (kill-buffer)))))
|
2007-09-08 03:07:09 +00:00
|
|
|
t)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-GQ #'erc-cmd-GQUIT)
|
2006-01-29 13:08:58 +00:00
|
|
|
(put 'erc-cmd-GQUIT 'do-not-parse-args t)
|
2007-09-08 03:07:09 +00:00
|
|
|
(put 'erc-cmd-GQUIT 'process-not-needed t)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2022-10-27 00:21:10 -07:00
|
|
|
(defun erc--cmd-reconnect ()
|
2007-09-08 03:07:09 +00:00
|
|
|
(let ((buffer (erc-server-buffer))
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(erc-join-buffer erc-interactive-display)
|
|
|
|
(erc--display-context `((erc-interactive-display . /RECONNECT)
|
|
|
|
,@erc--display-context))
|
2014-11-08 20:51:43 -05:00
|
|
|
(process nil))
|
2007-09-08 03:07:09 +00:00
|
|
|
(unless (buffer-live-p buffer)
|
|
|
|
(setq buffer (current-buffer)))
|
|
|
|
(with-current-buffer buffer
|
2022-10-27 00:21:10 -07:00
|
|
|
(when erc--server-reconnect-timer
|
|
|
|
(erc--cancel-auto-reconnect-timer))
|
2007-04-01 13:36:38 +00:00
|
|
|
(setq erc-server-quitting nil)
|
2021-06-11 03:55:07 -07:00
|
|
|
(with-suppressed-warnings ((obsolete erc-server-reconnecting))
|
|
|
|
(setq erc-server-reconnecting t))
|
2007-04-01 13:36:38 +00:00
|
|
|
(setq erc-server-reconnect-count 0)
|
|
|
|
(setq process (get-buffer-process (erc-server-buffer)))
|
2022-04-05 17:45:00 -07:00
|
|
|
(when process
|
|
|
|
(delete-process process))
|
|
|
|
(erc-server-reconnect)
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(with-suppressed-warnings ((obsolete erc-server-reconnecting)
|
2022-11-04 05:01:35 -07:00
|
|
|
(obsolete erc-reuse-buffers))
|
2022-04-05 17:45:00 -07:00
|
|
|
(if erc-reuse-buffers
|
2022-11-18 22:42:15 -08:00
|
|
|
(cl-assert (not erc-server-reconnecting))
|
|
|
|
(setq erc-server-reconnecting nil)))))
|
2007-01-05 02:09:07 +00:00
|
|
|
t)
|
2022-10-27 00:21:10 -07:00
|
|
|
|
|
|
|
(defun erc-cmd-RECONNECT (&rest args)
|
|
|
|
"Try reconnecting to the current IRC server.
|
|
|
|
Alternatively, CANCEL a scheduled attempt for either the current
|
|
|
|
connection or, with -A, all applicable connections.
|
|
|
|
|
|
|
|
\(fn [CANCEL [-A]])"
|
|
|
|
(pcase args
|
|
|
|
(`("cancel" "-a") (erc-buffer-filter #'erc--cancel-auto-reconnect-timer))
|
|
|
|
(`("cancel") (erc-with-server-buffer (erc--cancel-auto-reconnect-timer)))
|
|
|
|
(_ (erc--cmd-reconnect))))
|
|
|
|
|
2007-09-08 03:07:09 +00:00
|
|
|
(put 'erc-cmd-RECONNECT 'process-not-needed t)
|
2007-01-05 02:09:07 +00:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-cmd-SERVER (server)
|
|
|
|
"Connect to SERVER, leaving existing connection intact."
|
|
|
|
(erc-log (format "cmd: SERVER: %s" server))
|
|
|
|
(condition-case nil
|
2006-11-20 06:50:29 +00:00
|
|
|
(erc :server server :nick (erc-current-nick))
|
2006-01-29 13:08:58 +00:00
|
|
|
(error
|
2021-09-14 08:43:18 +02:00
|
|
|
(erc-error "Cannot find host: `%s'" server)))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
2007-09-08 03:07:09 +00:00
|
|
|
(put 'erc-cmd-SERVER 'process-not-needed t)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-cmd-SV ()
|
|
|
|
"Say the current ERC and Emacs version into channel."
|
2021-10-06 21:50:56 -04:00
|
|
|
(erc-send-message (format "I'm using ERC %s with GNU Emacs %s (%s%s)%s."
|
|
|
|
erc-version
|
2014-11-08 20:51:43 -05:00
|
|
|
emacs-version
|
|
|
|
system-configuration
|
|
|
|
(concat
|
|
|
|
(cond ((featurep 'motif)
|
Sequester some special-variable declarations in ERC
* lisp/erc/erc-backend.el (erc-log-p): Remove declaration entirely.
(erc-server-reconnect): Move declaration for `erc-reuse-buffers' here.
(erc-process-sentinel-1): Move `erc-kill-server-buffer-on-quit'
declaration here.
(erc--conceal-prompt): Move `erc-prompt-hidden' declaration here.
(erc-server-INVITE): Move `erc-invitation' declaration here.
(erc-server-PART): Move `erc-kill-buffer-on-part' declaration here.
(erc-server-PRIVMSG): Move declarations for `erc-minibuffer-ignored',
`erc-receive-query-display', `erc-receive-query-display-defer',
`erc--cmem-from-nick-function', `erc-format-nick-function', and
`erc-format-query-as-channel-p' here.
(erc-server-401): Move `erc-whowas-on-nosuchnick' declaration here.
(erc-server-475): Move `erc--called-as-input-p' and
`erc-prompt-for-channel-key' declarations here.
* lisp/erc/erc-common.el (erc-log-p): Remove declaration for
`erc-log-p' and replace with actual definition.
(erc-log-aux): Move `erc-dbuf' declaration from top level into
function body.
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Note in
the doc string that this function produces side effects.
* lisp/erc/erc-networks.el (erc-determine-network,
erc-networks--copy-server-buffer-functions): Move some variable
declarations to function body.
(erc-settings, erc-get): Deprecate for now and explain why in doc
strings. We could deprecate them unconditionally, but they never
provided usable code, and their names are short and valuable.
* lisp/erc/erc.el (tabbar--local-hlf, motif-version-string,
gtk-version-string): Prefer moving these single-serving declarations
to function bodies, if only to make closures from this library less
cluttered when debugging. This should also help avoid stray
declarations.
(erc-hooks, erc-timer-hook): Revise doc strings.
(erc-log-p): Move definition to erc-common.el.
(erc-cmd-SV): Mimic `emacs-version' and stick with `featurep', here in
combination with special-variable declarations, instead of `boundp' or
similar.
(erc-header-line-uses-tabbar-p): Explain that this has nothing to do
with `tab-bar'.
(erc-update-mode-line-buffer): Only assign when bound. This has been
verified to work with version 2.0 on EmacsWiki.
* test/lisp/erc/erc-scenarios-base-reconnect.el: Timeouts.
* test/lisp/erc/erc-scenarios-base-renick.el: Timeouts.
* test/lisp/erc/resources/join/network-id/foonet-again.eld: Timeouts.
2023-11-26 18:24:48 -08:00
|
|
|
(defvar motif-version-string)
|
2014-11-08 20:51:43 -05:00
|
|
|
(concat ", " (substring
|
|
|
|
motif-version-string 4)))
|
|
|
|
((featurep 'gtk)
|
Sequester some special-variable declarations in ERC
* lisp/erc/erc-backend.el (erc-log-p): Remove declaration entirely.
(erc-server-reconnect): Move declaration for `erc-reuse-buffers' here.
(erc-process-sentinel-1): Move `erc-kill-server-buffer-on-quit'
declaration here.
(erc--conceal-prompt): Move `erc-prompt-hidden' declaration here.
(erc-server-INVITE): Move `erc-invitation' declaration here.
(erc-server-PART): Move `erc-kill-buffer-on-part' declaration here.
(erc-server-PRIVMSG): Move declarations for `erc-minibuffer-ignored',
`erc-receive-query-display', `erc-receive-query-display-defer',
`erc--cmem-from-nick-function', `erc-format-nick-function', and
`erc-format-query-as-channel-p' here.
(erc-server-401): Move `erc-whowas-on-nosuchnick' declaration here.
(erc-server-475): Move `erc--called-as-input-p' and
`erc-prompt-for-channel-key' declarations here.
* lisp/erc/erc-common.el (erc-log-p): Remove declaration for
`erc-log-p' and replace with actual definition.
(erc-log-aux): Move `erc-dbuf' declaration from top level into
function body.
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Note in
the doc string that this function produces side effects.
* lisp/erc/erc-networks.el (erc-determine-network,
erc-networks--copy-server-buffer-functions): Move some variable
declarations to function body.
(erc-settings, erc-get): Deprecate for now and explain why in doc
strings. We could deprecate them unconditionally, but they never
provided usable code, and their names are short and valuable.
* lisp/erc/erc.el (tabbar--local-hlf, motif-version-string,
gtk-version-string): Prefer moving these single-serving declarations
to function bodies, if only to make closures from this library less
cluttered when debugging. This should also help avoid stray
declarations.
(erc-hooks, erc-timer-hook): Revise doc strings.
(erc-log-p): Move definition to erc-common.el.
(erc-cmd-SV): Mimic `emacs-version' and stick with `featurep', here in
combination with special-variable declarations, instead of `boundp' or
similar.
(erc-header-line-uses-tabbar-p): Explain that this has nothing to do
with `tab-bar'.
(erc-update-mode-line-buffer): Only assign when bound. This has been
verified to work with version 2.0 on EmacsWiki.
* test/lisp/erc/erc-scenarios-base-reconnect.el: Timeouts.
* test/lisp/erc/erc-scenarios-base-renick.el: Timeouts.
* test/lisp/erc/resources/join/network-id/foonet-again.eld: Timeouts.
2023-11-26 18:24:48 -08:00
|
|
|
(defvar gtk-version-string)
|
2014-11-08 20:51:43 -05:00
|
|
|
(concat ", GTK+ Version "
|
|
|
|
gtk-version-string))
|
|
|
|
((featurep 'x-toolkit) ", X toolkit")
|
|
|
|
(t ""))
|
|
|
|
(if (and (boundp 'x-toolkit-scroll-bars)
|
|
|
|
(memq x-toolkit-scroll-bars
|
|
|
|
'(xaw xaw3d)))
|
|
|
|
(format ", %s scroll bars"
|
|
|
|
(capitalize (symbol-name
|
|
|
|
x-toolkit-scroll-bars)))
|
|
|
|
"")
|
|
|
|
(if (featurep 'multi-tty) ", multi-tty" ""))
|
2020-08-12 19:32:52 +02:00
|
|
|
(if emacs-build-time
|
|
|
|
(concat " of " (format-time-string
|
|
|
|
"%Y-%m-%d" emacs-build-time))
|
2016-03-02 10:21:45 -08:00
|
|
|
"")))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
|
|
|
|
(defun erc-cmd-SM ()
|
|
|
|
"Say the current ERC modes into channel."
|
|
|
|
(erc-send-message (format "I'm using the following modules: %s!"
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-modes)))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
|
|
|
|
(defun erc-cmd-DEOP (&rest people)
|
|
|
|
"Remove the operator setting from user(s) given in PEOPLE."
|
|
|
|
(when (> (length people) 0)
|
|
|
|
(erc-server-send (concat "MODE " (erc-default-target)
|
2014-11-08 20:51:43 -05:00
|
|
|
" -"
|
|
|
|
(make-string (length people) ?o)
|
|
|
|
" "
|
2021-01-04 00:21:02 -05:00
|
|
|
(mapconcat #'identity people " ")))
|
2006-01-29 13:08:58 +00:00
|
|
|
t))
|
|
|
|
|
|
|
|
(defun erc-cmd-OP (&rest people)
|
|
|
|
"Add the operator setting to users(s) given in PEOPLE."
|
|
|
|
(when (> (length people) 0)
|
|
|
|
(erc-server-send (concat "MODE " (erc-default-target)
|
2014-11-08 20:51:43 -05:00
|
|
|
" +"
|
|
|
|
(make-string (length people) ?o)
|
|
|
|
" "
|
2021-01-04 00:21:02 -05:00
|
|
|
(mapconcat #'identity people " ")))
|
2006-01-29 13:08:58 +00:00
|
|
|
t))
|
|
|
|
|
2021-09-18 23:29:44 -04:00
|
|
|
(defun erc-cmd-OPME ()
|
|
|
|
"Ask ChanServ to op the current nick in the current channel.
|
|
|
|
|
|
|
|
This command assumes a ChanServ (channel service) available on
|
|
|
|
the IRC network which accepts an \"op\" command that takes the
|
|
|
|
channel name and the user's nick, and that the current nick is
|
|
|
|
allowed to become an operator in the current channel (typically
|
|
|
|
means that the user has a +o flag in the channel's access list)."
|
|
|
|
(erc-message "PRIVMSG"
|
|
|
|
(format "ChanServ op %s %s"
|
|
|
|
(erc-default-target)
|
|
|
|
(erc-current-nick))
|
|
|
|
nil))
|
|
|
|
|
|
|
|
(defun erc-cmd-DEOPME ()
|
|
|
|
"Deop the current nick in the current channel."
|
|
|
|
(erc-cmd-DEOP (erc-current-nick)))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-cmd-TIME (&optional line)
|
|
|
|
"Request the current time and date from the current server."
|
|
|
|
(cond
|
|
|
|
((and line (string-match "^\\s-*\\(.*\\)$" line))
|
|
|
|
(let ((args (match-string 1 line)))
|
|
|
|
(erc-log (format "cmd: TIME: %s" args))
|
|
|
|
(erc-server-send (concat "TIME " args)))
|
|
|
|
t)
|
|
|
|
(t (erc-server-send "TIME"))))
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-DATE #'erc-cmd-TIME)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-03-11 09:25:24 -08:00
|
|
|
(defun erc-cmd-MOTD (&optional target)
|
|
|
|
"Ask server to send the current MOTD.
|
|
|
|
Some IRCds simply ignore TARGET."
|
|
|
|
(letrec ((oneoff (lambda (proc parsed)
|
|
|
|
(with-current-buffer (erc-server-buffer)
|
|
|
|
(cl-assert (eq (current-buffer) (process-buffer proc)))
|
|
|
|
(remove-hook 'erc-server-402-functions h402 t)
|
|
|
|
(remove-hook 'erc-server-376-functions h376 t)
|
|
|
|
(remove-hook 'erc-server-422-functions h422 t))
|
|
|
|
(erc-server-MOTD proc parsed)
|
|
|
|
t))
|
|
|
|
(h402 (erc-once-with-server-event 402 oneoff))
|
|
|
|
(h376 (erc-once-with-server-event 376 oneoff))
|
|
|
|
(h422 (erc-once-with-server-event 422 oneoff)))
|
|
|
|
(erc-server-send (concat "MOTD" (and target " ") target))))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-cmd-TOPIC (topic)
|
|
|
|
"Set or request the topic for a channel.
|
|
|
|
LINE has the format: \"#CHANNEL TOPIC\", \"#CHANNEL\", \"TOPIC\"
|
|
|
|
or the empty string.
|
|
|
|
|
|
|
|
If no #CHANNEL is given, the default channel is used. If TOPIC is
|
|
|
|
given, the channel topic is modified, otherwise the current topic will
|
|
|
|
be displayed."
|
|
|
|
(cond
|
|
|
|
;; /topic #channel TOPIC
|
|
|
|
((string-match "^\\s-*\\([&#+!]\\S-+\\)\\s-\\(.*\\)$" topic)
|
|
|
|
(let ((ch (match-string 1 topic))
|
2014-11-08 20:51:43 -05:00
|
|
|
(topic (match-string 2 topic)))
|
2018-04-14 20:37:09 +02:00
|
|
|
;; Ignore all-whitespace topics.
|
|
|
|
(unless (equal (string-trim topic) "")
|
|
|
|
(erc-log (format "cmd: TOPIC [%s]: %s" ch topic))
|
|
|
|
(erc-server-send (format "TOPIC %s :%s" ch topic) nil ch)))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
;; /topic #channel
|
|
|
|
((string-match "^\\s-*\\([&#+!]\\S-+\\)" topic)
|
|
|
|
(let ((ch (match-string 1 topic)))
|
|
|
|
(erc-server-send (format "TOPIC %s" ch) nil ch)
|
|
|
|
t))
|
|
|
|
;; /topic
|
|
|
|
((string-match "^\\s-*$" topic)
|
|
|
|
(let ((ch (erc-default-target)))
|
|
|
|
(erc-server-send (format "TOPIC %s" ch) nil ch)
|
|
|
|
t))
|
|
|
|
;; /topic TOPIC
|
|
|
|
((string-match "^\\s-*\\(.*\\)$" topic)
|
|
|
|
(let ((ch (erc-default-target))
|
2014-11-08 20:51:43 -05:00
|
|
|
(topic (match-string 1 topic)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (and ch (erc-channel-p ch))
|
2014-11-08 20:51:43 -05:00
|
|
|
(progn
|
|
|
|
(erc-log (format "cmd: TOPIC [%s]: %s" ch topic))
|
|
|
|
(erc-server-send (format "TOPIC %s :%s" ch topic) nil ch))
|
2023-11-08 19:14:55 -08:00
|
|
|
(erc-display-message nil '(notice error) (current-buffer) 'no-target)))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
(t nil)))
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-T #'erc-cmd-TOPIC)
|
2006-01-29 13:08:58 +00:00
|
|
|
(put 'erc-cmd-TOPIC 'do-not-parse-args t)
|
|
|
|
|
|
|
|
(defun erc-cmd-APPENDTOPIC (topic)
|
|
|
|
"Append TOPIC to the current channel topic, separated by a space."
|
|
|
|
(let ((oldtopic erc-channel-topic))
|
|
|
|
;; display help when given no arguments
|
|
|
|
(when (string-match "^\\s-*$" topic)
|
|
|
|
(signal 'wrong-number-of-arguments nil))
|
|
|
|
;; strip trailing ^O
|
|
|
|
(when (string-match "\\(.*\\)\C-o" oldtopic)
|
|
|
|
(erc-cmd-TOPIC (concat (match-string 1 oldtopic) topic)))))
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-AT #'erc-cmd-APPENDTOPIC)
|
2006-01-29 13:08:58 +00:00
|
|
|
(put 'erc-cmd-APPENDTOPIC 'do-not-parse-args t)
|
|
|
|
|
|
|
|
(defun erc-cmd-CLEARTOPIC (&optional channel)
|
|
|
|
"Clear the topic for a CHANNEL.
|
|
|
|
If CHANNEL is not specified, clear the topic for the default channel."
|
|
|
|
(interactive "sClear topic of channel (RET is current channel): ")
|
|
|
|
(let ((chnl (or (and (erc-channel-p channel) channel) (erc-default-target))))
|
|
|
|
(when chnl
|
|
|
|
(erc-server-send (format "TOPIC %s :" chnl))
|
|
|
|
t)))
|
|
|
|
|
|
|
|
;;; Banlists
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-channel-banlist nil
|
2006-01-29 13:08:58 +00:00
|
|
|
"A list of bans seen for the current channel.
|
|
|
|
|
|
|
|
Each ban is an alist of the form:
|
|
|
|
(WHOSET . MASK)
|
|
|
|
|
|
|
|
The property `received-from-server' indicates whether
|
|
|
|
or not the ban list has been requested from the server.")
|
|
|
|
(put 'erc-channel-banlist 'received-from-server nil)
|
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(defvar erc-fill-column)
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-cmd-BANLIST ()
|
|
|
|
"Pretty-print the contents of `erc-channel-banlist'.
|
|
|
|
|
|
|
|
The ban list is fetched from the server if necessary."
|
|
|
|
(let ((chnl (erc-default-target))
|
2014-11-08 20:51:43 -05:00
|
|
|
(chnl-name (buffer-name)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(cond
|
|
|
|
((not (erc-channel-p chnl))
|
2023-10-04 20:39:03 -07:00
|
|
|
(erc-display-message nil 'notice 'active "You're not on a channel\n"))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
((not (get 'erc-channel-banlist 'received-from-server))
|
|
|
|
(let ((old-367-hook erc-server-367-functions))
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq erc-server-367-functions 'erc-banlist-store
|
|
|
|
erc-channel-banlist nil)
|
|
|
|
;; fetch the ban list then callback
|
|
|
|
(erc-with-server-buffer
|
|
|
|
(erc-once-with-server-event
|
|
|
|
368
|
|
|
|
(lambda (_proc _parsed)
|
|
|
|
(with-current-buffer chnl-name
|
|
|
|
(put 'erc-channel-banlist 'received-from-server t)
|
|
|
|
(setq erc-server-367-functions old-367-hook)
|
|
|
|
(erc-cmd-BANLIST)
|
|
|
|
t)))
|
|
|
|
(erc-server-send (format "MODE %s b" chnl)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
((null erc-channel-banlist)
|
2023-10-04 20:39:03 -07:00
|
|
|
(erc-display-message nil 'notice 'active
|
|
|
|
(format "No bans for channel: %s\n" chnl))
|
2006-01-29 13:08:58 +00:00
|
|
|
(put 'erc-channel-banlist 'received-from-server nil))
|
|
|
|
|
|
|
|
(t
|
|
|
|
(let* ((erc-fill-column (or (and (boundp 'erc-fill-column)
|
2014-11-08 20:51:43 -05:00
|
|
|
erc-fill-column)
|
|
|
|
(and (boundp 'fill-column)
|
|
|
|
fill-column)
|
|
|
|
(1- (window-width))))
|
|
|
|
(separator (make-string erc-fill-column ?=))
|
|
|
|
(fmt (concat
|
|
|
|
"%-" (number-to-string (/ erc-fill-column 2)) "s"
|
|
|
|
"%" (number-to-string (/ erc-fill-column 2)) "s")))
|
|
|
|
|
2023-10-04 20:39:03 -07:00
|
|
|
(erc-display-message
|
|
|
|
nil 'notice 'active
|
|
|
|
(format "Ban list for channel: %s\n" (erc-default-target)))
|
2014-11-08 20:51:43 -05:00
|
|
|
|
|
|
|
(erc-display-line separator 'active)
|
|
|
|
(erc-display-line (format fmt "Ban Mask" "Banned By") 'active)
|
|
|
|
(erc-display-line separator 'active)
|
|
|
|
|
|
|
|
(mapc
|
|
|
|
(lambda (x)
|
|
|
|
(erc-display-line
|
|
|
|
(format fmt
|
|
|
|
(truncate-string-to-width (cdr x) (/ erc-fill-column 2))
|
|
|
|
(if (car x)
|
|
|
|
(truncate-string-to-width (car x) (/ erc-fill-column 2))
|
|
|
|
""))
|
|
|
|
'active))
|
|
|
|
erc-channel-banlist)
|
|
|
|
|
2023-10-04 20:39:03 -07:00
|
|
|
(erc-display-message nil 'notice 'active "End of Ban list")
|
2014-11-08 20:51:43 -05:00
|
|
|
(put 'erc-channel-banlist 'received-from-server nil)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
t)
|
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-BL #'erc-cmd-BANLIST)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-cmd-MASSUNBAN ()
|
|
|
|
"Mass Unban.
|
|
|
|
|
|
|
|
Unban all currently banned users in the current channel."
|
|
|
|
(let ((chnl (erc-default-target)))
|
|
|
|
(cond
|
|
|
|
|
|
|
|
((not (erc-channel-p chnl))
|
2023-10-04 20:39:03 -07:00
|
|
|
(erc-display-message nil 'notice 'active "You're not on a channel\n"))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
((not (get 'erc-channel-banlist 'received-from-server))
|
|
|
|
(let ((old-367-hook erc-server-367-functions))
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq erc-server-367-functions 'erc-banlist-store)
|
|
|
|
;; fetch the ban list then callback
|
|
|
|
(erc-with-server-buffer
|
|
|
|
(erc-once-with-server-event
|
|
|
|
368
|
|
|
|
(lambda (_proc _parsed)
|
|
|
|
(with-current-buffer chnl
|
|
|
|
(put 'erc-channel-banlist 'received-from-server t)
|
|
|
|
(setq erc-server-367-functions old-367-hook)
|
|
|
|
(erc-cmd-MASSUNBAN)
|
|
|
|
t)))
|
|
|
|
(erc-server-send (format "MODE %s b" chnl)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2015-03-16 14:49:01 -04:00
|
|
|
(t (let ((bans (mapcar #'cdr erc-channel-banlist)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(when bans
|
|
|
|
;; Glob the bans into groups of three, and carry out the unban.
|
|
|
|
;; eg. /mode #foo -bbb a*!*@* b*!*@* c*!*@*
|
|
|
|
(mapc
|
|
|
|
(lambda (x)
|
|
|
|
(erc-server-send
|
|
|
|
(format "MODE %s -%s %s" (erc-default-target)
|
|
|
|
(make-string (length x) ?b)
|
2021-01-04 00:21:02 -05:00
|
|
|
(mapconcat #'identity x " "))))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-group-list bans 3))))
|
|
|
|
t))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-cmd-MUB #'erc-cmd-MASSUNBAN)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;;;; End of IRC commands
|
|
|
|
|
|
|
|
(defun erc-ensure-channel-name (channel)
|
|
|
|
"Return CHANNEL if it is a valid channel name.
|
|
|
|
Eventually add a # in front of it, if that turns it into a valid channel name."
|
|
|
|
(if (erc-channel-p channel)
|
|
|
|
channel
|
|
|
|
(concat "#" channel)))
|
|
|
|
|
2022-06-16 01:20:49 -07:00
|
|
|
(defvar erc--own-property-names
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
'( tags erc--speaker erc-parsed display ; core
|
2022-06-16 01:20:49 -07:00
|
|
|
;; `erc-display-prompt'
|
|
|
|
rear-nonsticky erc-prompt field front-sticky read-only
|
|
|
|
;; stamp
|
|
|
|
cursor-intangible cursor-sensor-functions isearch-open-invisible
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
erc-stamp-type
|
2022-06-16 01:20:49 -07:00
|
|
|
;; match
|
|
|
|
invisible intangible
|
|
|
|
;; button
|
|
|
|
erc-callback erc-data mouse-face keymap
|
|
|
|
;; fill-wrap
|
|
|
|
line-prefix wrap-prefix)
|
|
|
|
"Props added by ERC that should not survive killing.
|
|
|
|
Among those left behind by default are `font-lock-face' and
|
|
|
|
`erc-secret'.")
|
|
|
|
|
|
|
|
(defun erc--remove-text-properties (string)
|
|
|
|
"Remove text properties in STRING added by ERC.
|
|
|
|
Specifically, remove any that aren't members of
|
|
|
|
`erc--own-property-names'."
|
|
|
|
(remove-list-of-text-properties 0 (length string)
|
|
|
|
erc--own-property-names string)
|
|
|
|
string)
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-grab-region (start end)
|
|
|
|
"Copy the region between START and END in a recreatable format.
|
|
|
|
|
|
|
|
Converts all the IRC text properties in each line of the region
|
|
|
|
into control codes and writes them to a separate buffer. The
|
|
|
|
resulting text may be used directly as a script to generate this
|
|
|
|
text again."
|
|
|
|
(interactive "r")
|
|
|
|
(erc-set-active-buffer (current-buffer))
|
|
|
|
(save-excursion
|
|
|
|
(let* ((cb (current-buffer))
|
2014-11-08 20:51:43 -05:00
|
|
|
(buf (generate-new-buffer erc-grab-buffer-name))
|
|
|
|
(region (buffer-substring start end))
|
|
|
|
(lines (erc-split-multiline-safe region)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(set-buffer buf)
|
|
|
|
(dolist (line lines)
|
2014-11-08 20:51:43 -05:00
|
|
|
(insert (concat line "\n")))
|
2006-01-29 13:08:58 +00:00
|
|
|
(set-buffer cb)
|
|
|
|
(switch-to-buffer-other-window buf)))
|
|
|
|
(message "erc-grab-region doesn't grab colors etc. anymore. If you use this, please tell the maintainers.")
|
|
|
|
(ding))
|
|
|
|
|
|
|
|
(defun erc-display-prompt (&optional buffer pos prompt face)
|
|
|
|
"Display PROMPT in BUFFER at position POS.
|
|
|
|
Display an ERC prompt in BUFFER.
|
|
|
|
|
|
|
|
If PROMPT is nil, one is constructed with the function `erc-prompt'.
|
|
|
|
If BUFFER is nil, the `current-buffer' is used.
|
|
|
|
If POS is nil, PROMPT will be displayed at `point'.
|
|
|
|
If FACE is non-nil, it will be used to propertize the prompt. If it is nil,
|
|
|
|
`erc-prompt-face' will be used."
|
|
|
|
(let* ((prompt (or prompt (erc-prompt)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(l (length prompt))
|
|
|
|
(ob (current-buffer)))
|
2006-01-29 13:08:58 +00:00
|
|
|
;; We cannot use save-excursion because we move point, therefore
|
|
|
|
;; we resort to the ol' ob trick to restore this.
|
|
|
|
(when (and buffer (bufferp buffer))
|
|
|
|
(set-buffer buffer))
|
|
|
|
|
|
|
|
;; now save excursion again to store where point and mark are
|
|
|
|
;; in the current buffer
|
|
|
|
(save-excursion
|
|
|
|
(setq pos (or pos (point)))
|
|
|
|
(goto-char pos)
|
|
|
|
(when (> l 0)
|
2014-11-08 20:51:43 -05:00
|
|
|
;; Do not extend the text properties when typing at the end
|
|
|
|
;; of the prompt, but stuff typed in front of the prompt
|
|
|
|
;; shall remain part of the prompt.
|
2023-11-18 23:04:50 -08:00
|
|
|
(setq prompt (apply #'propertize prompt erc--prompt-properties))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-put-text-property 0 (1- (length prompt))
|
2016-04-07 14:23:18 +02:00
|
|
|
'font-lock-face (or face 'erc-prompt-face)
|
2014-11-08 20:51:43 -05:00
|
|
|
prompt)
|
|
|
|
(insert prompt))
|
2006-01-29 13:08:58 +00:00
|
|
|
;; Set the input marker
|
|
|
|
(set-marker erc-input-marker (point)))
|
|
|
|
|
|
|
|
;; Now we are back at the old position. If the prompt was
|
|
|
|
;; inserted here or before us, advance point by the length of
|
|
|
|
;; the prompt.
|
|
|
|
(when (or (not pos) (<= (point) pos))
|
|
|
|
(forward-char l))
|
|
|
|
;; Clear the undo buffer now, so the user can undo his stuff,
|
|
|
|
;; but not the stuff we did. Sneaky!
|
|
|
|
(setq buffer-undo-list nil)
|
|
|
|
(set-buffer ob)))
|
|
|
|
|
|
|
|
;; interactive operations
|
|
|
|
|
|
|
|
(defun erc-input-message ()
|
|
|
|
"Read input from the minibuffer."
|
|
|
|
(interactive)
|
|
|
|
(let ((minibuffer-allow-text-properties t)
|
2014-11-08 20:51:43 -05:00
|
|
|
(read-map minibuffer-local-map))
|
2006-01-29 13:08:58 +00:00
|
|
|
(insert (read-from-minibuffer "Message: "
|
2019-06-20 01:44:19 +02:00
|
|
|
(string last-command-event)
|
2014-11-08 20:51:43 -05:00
|
|
|
read-map))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-send-current-line)))
|
|
|
|
|
|
|
|
(defvar erc-action-history-list ()
|
|
|
|
"History list for interactive action input.")
|
|
|
|
|
|
|
|
(defun erc-input-action ()
|
|
|
|
"Interactively input a user action and send it to IRC."
|
|
|
|
(interactive "")
|
|
|
|
(erc-set-active-buffer (current-buffer))
|
2021-03-07 19:06:06 -05:00
|
|
|
(let ((action (read-string "Action: " nil 'erc-action-history-list)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (not (string-match "^\\s-*$" action))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-send-action (erc-default-target) action))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-join-channel (channel &optional key)
|
|
|
|
"Join CHANNEL.
|
|
|
|
|
|
|
|
If `point' is at the beginning of a channel name, use that as default."
|
|
|
|
(interactive
|
|
|
|
(list
|
2006-04-11 22:09:49 +00:00
|
|
|
(let ((chnl (if (looking-at "\\([&#+!][^ \n]+\\)") (match-string 1) ""))
|
2014-11-08 20:51:43 -05:00
|
|
|
(table (when (erc-server-buffer-live-p)
|
|
|
|
(set-buffer (process-buffer erc-server-process))
|
|
|
|
erc-channel-list)))
|
2020-09-06 20:35:11 +02:00
|
|
|
(completing-read (format-prompt "Join channel" chnl)
|
|
|
|
table nil nil nil nil chnl))
|
2007-10-29 01:00:33 +00:00
|
|
|
(when (or current-prefix-arg erc-prompt-for-channel-key)
|
2021-03-07 19:06:06 -05:00
|
|
|
(read-string "Channel key (RET for none): "))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-cmd-JOIN channel (when (>= (length key) 1) key)))
|
|
|
|
|
|
|
|
(defun erc-part-from-channel (reason)
|
|
|
|
"Part from the current channel and prompt for a REASON."
|
|
|
|
(interactive
|
2021-03-07 19:06:06 -05:00
|
|
|
;; FIXME: Has this ever worked? We're in the interactive-spec, so the
|
|
|
|
;; argument `reason' can't be in scope yet!
|
|
|
|
;;(if (and (boundp 'reason) (stringp reason) (not (string= reason "")))
|
|
|
|
;; reason
|
2006-01-29 13:08:58 +00:00
|
|
|
(list
|
2021-03-07 19:06:06 -05:00
|
|
|
(read-string (concat "Reason for leaving " (erc-default-target) ": "))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-cmd-PART (concat (erc-default-target)" " reason)))
|
|
|
|
|
|
|
|
(defun erc-set-topic (topic)
|
|
|
|
"Prompt for a TOPIC for the current channel."
|
|
|
|
(interactive
|
|
|
|
(list
|
2021-03-07 19:06:06 -05:00
|
|
|
(read-string
|
2006-01-29 13:08:58 +00:00
|
|
|
(concat "Set topic of " (erc-default-target) ": ")
|
|
|
|
(when erc-channel-topic
|
2008-01-25 03:28:10 +00:00
|
|
|
(let ((ss (split-string erc-channel-topic "\C-o")))
|
2015-03-16 14:49:01 -04:00
|
|
|
(cons (apply #'concat (if (cdr ss) (butlast ss) ss))
|
2014-11-08 20:51:43 -05:00
|
|
|
0))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((topic-list (split-string topic "\C-o"))) ; strip off the topic setter
|
|
|
|
(erc-cmd-TOPIC (concat (erc-default-target) " " (car topic-list)))))
|
|
|
|
|
|
|
|
(defun erc-set-channel-limit (&optional limit)
|
|
|
|
"Set a LIMIT for the current channel. Remove limit if nil.
|
|
|
|
Prompt for one if called interactively."
|
2021-03-07 19:06:06 -05:00
|
|
|
(interactive (list (read-string
|
2014-11-08 20:51:43 -05:00
|
|
|
(format "Limit for %s (RET to remove limit): "
|
|
|
|
(erc-default-target)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((tgt (erc-default-target)))
|
2013-08-22 00:06:45 -04:00
|
|
|
(erc-server-send (if (and limit (>= (length limit) 1))
|
2014-11-08 20:51:43 -05:00
|
|
|
(format "MODE %s +l %s" tgt limit)
|
|
|
|
(format "MODE %s -l" tgt)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-set-channel-key (&optional key)
|
|
|
|
"Set a KEY for the current channel. Remove key if nil.
|
|
|
|
Prompt for one if called interactively."
|
2021-03-07 19:06:06 -05:00
|
|
|
(interactive (list (read-string
|
2014-11-08 20:51:43 -05:00
|
|
|
(format "Key for %s (RET to remove key): "
|
|
|
|
(erc-default-target)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((tgt (erc-default-target)))
|
2013-08-22 00:06:45 -04:00
|
|
|
(erc-server-send (if (and key (>= (length key) 1))
|
2014-11-08 20:51:43 -05:00
|
|
|
(format "MODE %s +k %s" tgt key)
|
|
|
|
(format "MODE %s -k" tgt)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-quit-server (reason)
|
|
|
|
"Disconnect from current server after prompting for REASON.
|
|
|
|
`erc-quit-reason' works with this just like with `erc-cmd-QUIT'."
|
2021-03-07 19:06:06 -05:00
|
|
|
(interactive (list (read-string
|
2014-11-08 20:51:43 -05:00
|
|
|
(format "Reason for quitting %s: "
|
|
|
|
(or erc-server-announced-name
|
|
|
|
erc-session-server)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-cmd-QUIT reason))
|
|
|
|
|
|
|
|
;; Movement of point
|
|
|
|
|
|
|
|
(defun erc-bol ()
|
|
|
|
"Move `point' to the beginning of the current line.
|
|
|
|
|
|
|
|
This places `point' just after the prompt, or at the beginning of the line."
|
|
|
|
(interactive)
|
|
|
|
(forward-line 0)
|
|
|
|
(when (get-text-property (point) 'erc-prompt)
|
|
|
|
(goto-char erc-input-marker))
|
|
|
|
(point))
|
|
|
|
|
|
|
|
(defun erc-kill-input ()
|
|
|
|
"Kill current input line using `erc-bol' followed by `kill-line'."
|
|
|
|
(interactive)
|
|
|
|
(when (and (erc-bol)
|
2014-11-08 20:51:43 -05:00
|
|
|
(/= (point) (point-max))) ;; Prevent a (ding) and an error when
|
|
|
|
;; there's nothing to kill
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (boundp 'erc-input-ring-index)
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq erc-input-ring-index nil))
|
2006-01-29 13:08:58 +00:00
|
|
|
(kill-line)))
|
|
|
|
|
2023-04-10 17:58:05 -07:00
|
|
|
(defvar erc--tab-functions nil
|
|
|
|
"Functions to try when user hits \\`TAB' outside of input area.
|
|
|
|
Called with a numeric prefix arg.")
|
|
|
|
|
2023-05-22 23:42:11 -07:00
|
|
|
(defun erc-tab (arg)
|
2023-04-10 17:58:05 -07:00
|
|
|
"Call `completion-at-point' when typing in the input area.
|
2023-05-22 23:42:11 -07:00
|
|
|
Otherwise call members of `erc--tab-functions' with a numeric
|
|
|
|
prefix ARG until one of them returns non-nil."
|
|
|
|
(interactive "p")
|
2023-04-10 17:58:05 -07:00
|
|
|
(if (>= (point) erc-input-marker)
|
|
|
|
(completion-at-point)
|
|
|
|
(run-hook-with-args-until-success 'erc--tab-functions arg)))
|
|
|
|
|
2011-04-26 10:50:09 -03:00
|
|
|
(defun erc-complete-word-at-point ()
|
|
|
|
(run-hook-with-args-until-success 'erc-complete-functions))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;;
|
2014-11-08 20:51:43 -05:00
|
|
|
;; IRC SERVER INPUT HANDLING
|
2006-01-29 13:08:58 +00:00
|
|
|
;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
;;;; New Input parsing
|
|
|
|
|
|
|
|
; Stolen from ZenIRC. I just wanna test this code, so here is
|
|
|
|
; experiment area.
|
|
|
|
|
2023-04-21 07:30:18 -07:00
|
|
|
;; This shouldn't be a user option but remains so for compatibility.
|
|
|
|
(define-obsolete-variable-alias
|
|
|
|
'erc-default-server-hook 'erc-default-server-functions "30.1")
|
|
|
|
(defcustom erc-default-server-functions '(erc-handle-unknown-server-response)
|
|
|
|
"Abnormal hook for incoming messages without their own handlers.
|
|
|
|
See `define-erc-response-handler' for more."
|
|
|
|
:package-version '(ERC . "5.6")
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-server-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defun erc-default-server-handler (proc parsed)
|
|
|
|
"Default server handler.
|
|
|
|
|
|
|
|
Displays PROC and PARSED appropriately using `erc-display-message'."
|
2023-04-21 07:30:18 -07:00
|
|
|
(declare (obsolete erc-handle-unknown-server-response "29.1"))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-display-message
|
|
|
|
parsed 'notice proc
|
|
|
|
(mapconcat
|
2021-01-04 00:21:02 -05:00
|
|
|
#'identity
|
2006-01-29 13:08:58 +00:00
|
|
|
(let (res)
|
2021-04-09 00:04:13 +02:00
|
|
|
(mapc (lambda (x)
|
|
|
|
(if (stringp x)
|
|
|
|
(setq res (append res (list x)))))
|
2014-11-08 20:51:43 -05:00
|
|
|
parsed)
|
2006-01-29 13:08:58 +00:00
|
|
|
res)
|
|
|
|
" ")))
|
|
|
|
|
|
|
|
(defvar erc-server-vectors
|
|
|
|
'(["msgtype" "sender" "to" "arg1" "arg2" "arg3" "..."])
|
|
|
|
"List of received server messages which ERC does not specifically handle.
|
|
|
|
See `erc-debug-missing-hooks'.")
|
|
|
|
;(make-variable-buffer-local 'erc-server-vectors)
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-debug-missing-hooks (_proc parsed)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Add PARSED server message ERC does not yet handle to `erc-server-vectors'.
|
|
|
|
These vectors can be helpful when adding new server message handlers to ERC.
|
|
|
|
See `erc-default-server-hook'."
|
2023-04-21 07:30:18 -07:00
|
|
|
(setq erc-server-vectors `(,@erc-server-vectors ,parsed))
|
2006-01-29 13:08:58 +00:00
|
|
|
nil)
|
|
|
|
|
2021-05-07 01:52:41 -07:00
|
|
|
(defun erc--open-target (target)
|
|
|
|
"Open an ERC buffer on TARGET."
|
|
|
|
(erc-open erc-session-server
|
|
|
|
erc-session-port
|
|
|
|
(erc-current-nick)
|
|
|
|
erc-session-user-full-name
|
|
|
|
nil
|
|
|
|
nil
|
|
|
|
(list target)
|
|
|
|
target
|
|
|
|
erc-server-process
|
|
|
|
nil
|
|
|
|
erc-session-username
|
|
|
|
(erc-networks--id-given erc-networks--id)))
|
|
|
|
|
|
|
|
(defun erc-query (target server-buffer)
|
|
|
|
"Open a query buffer on TARGET using SERVER-BUFFER.
|
2006-01-29 13:08:58 +00:00
|
|
|
To change how this query window is displayed, use `let' to bind
|
|
|
|
`erc-join-buffer' before calling this."
|
2023-04-13 00:00:02 -07:00
|
|
|
(declare (obsolete "call `erc-open' in a live server buffer" "29.1"))
|
2021-05-07 01:52:41 -07:00
|
|
|
(unless (buffer-live-p server-buffer)
|
2006-01-29 13:08:58 +00:00
|
|
|
(error "Couldn't switch to server buffer"))
|
2021-05-07 01:52:41 -07:00
|
|
|
(with-current-buffer server-buffer
|
|
|
|
(erc--open-target target)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-04-13 00:00:02 -07:00
|
|
|
(defvaralias 'erc-auto-query 'erc-receive-query-display)
|
|
|
|
(defcustom erc-receive-query-display 'window-noselect
|
2006-01-29 13:08:58 +00:00
|
|
|
"If non-nil, create a query buffer each time you receive a private message.
|
2008-01-25 03:28:10 +00:00
|
|
|
If the buffer doesn't already exist, it is created.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2008-01-25 03:28:10 +00:00
|
|
|
This can be set to a symbol, to control how the new query window
|
|
|
|
should appear. The default behavior is to display the buffer in
|
2023-04-13 00:00:02 -07:00
|
|
|
a new window but not to select it. See the documentation for
|
|
|
|
`erc-buffer-display' for a description of available values.
|
|
|
|
|
|
|
|
Note that the legacy behavior of forgoing buffer creation
|
|
|
|
entirely when this option is nil requires setting the
|
|
|
|
compatibility flag `erc-receive-query-display-defer' to nil. Use
|
|
|
|
`erc-ensure-target-buffer-on-privmsg' to achieve the same effect."
|
|
|
|
:package-version '(ERC . "5.6")
|
|
|
|
:group 'erc-buffers
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-query
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
:type erc--buffer-display-choices)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-04-13 00:00:02 -07:00
|
|
|
(defvar erc-receive-query-display-defer t
|
|
|
|
"How to interpret a null `erc-receive-query-display'.
|
|
|
|
When this variable is non-nil, ERC defers to `erc-buffer-display'
|
|
|
|
upon seeing a nil value for `erc-receive-query-display', much
|
|
|
|
like it does with other buffer-display options, like
|
|
|
|
`erc-interactive-display'. Otherwise, when this option is nil,
|
|
|
|
ERC retains the legacy behavior of not creating a new query
|
|
|
|
buffer.")
|
|
|
|
|
|
|
|
(defvaralias 'erc-query-on-unjoined-chan-privmsg
|
|
|
|
'erc-ensure-target-buffer-on-privmsg)
|
|
|
|
(defcustom erc-ensure-target-buffer-on-privmsg t
|
|
|
|
"When non-nil, create a target buffer upon receiving a PRIVMSG.
|
2006-01-29 13:08:58 +00:00
|
|
|
This includes PRIVMSGs directed to channels. If you are using an IRC
|
|
|
|
bouncer, such as dircproxy, to keep a log of channels when you are
|
2023-04-13 00:00:02 -07:00
|
|
|
disconnected, you should set this option to t.
|
|
|
|
|
|
|
|
For queries (direct messages), this option's non-nil meaning is
|
|
|
|
straightforward: if a buffer doesn't exist for the sender, create
|
|
|
|
one. For channels, the use case is more niche and usually
|
|
|
|
involves receiving playback (via commands like ZNC's
|
|
|
|
\"PLAYBUFFER\") for channels to which your bouncer is joined but
|
|
|
|
from which you've \"detached\".
|
|
|
|
|
|
|
|
Note that this option was absent from ERC 5.5 because knowledge
|
|
|
|
of its intended role was \"unavailable\" during a major
|
|
|
|
refactoring involving buffer management. The option has since
|
|
|
|
been restored in ERC 5.6 but now also affects queries in the
|
|
|
|
manner implied above, which was lost sometime before ERC 5.4."
|
|
|
|
:package-version '(ERC . "5.6") ; revived
|
|
|
|
:group 'erc-buffers
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-query
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-format-query-as-channel-p t
|
2021-09-19 12:59:01 +02:00
|
|
|
"If non-nil, format text from others in a query buffer like in a channel.
|
|
|
|
Otherwise format like a private message."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-query
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-minibuffer-notice nil
|
|
|
|
"If non-nil, print ERC notices for the user in the minibuffer.
|
|
|
|
Only happens when the session buffer isn't visible."
|
|
|
|
:group 'erc-display
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-minibuffer-ignored nil
|
|
|
|
"If non-nil, print a message in the minibuffer if we ignored something."
|
|
|
|
:group 'erc-ignore
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defun erc-wash-quit-reason (reason nick login host)
|
|
|
|
"Remove duplicate text from quit REASON.
|
|
|
|
Specifically in relation to NICK (user@host) information. Returns REASON
|
|
|
|
unmodified if nothing can be removed.
|
|
|
|
E.g. \"Read error to Nick [user@some.host]: 110\" would be shortened to
|
lisp/*.el: Fix typos and other trivial doc fixes
* lisp/allout-widgets.el (allout-widgets-auto-activation)
(allout-current-decorated-p):
* lisp/auth-source.el (auth-source-protocols):
* lisp/autorevert.el (auto-revert-set-timer):
* lisp/battery.el (battery-mode-line-limit):
* lisp/calc/calcalg3.el (math-map-binop):
* lisp/calendar/cal-dst.el (calendar-dst-find-startend):
* lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute):
* lisp/calendar/calendar.el (calendar-date-echo-text)
(calendar-generate-month, calendar-string-spread)
(calendar-cursor-to-date, calendar-read, calendar-read-date)
(calendar-mark-visible-date, calendar-dayname-on-or-before):
* lisp/calendar/diary-lib.el (diary-ordinal-suffix):
* lisp/cedet/ede/autoconf-edit.el (autoconf-new-program)
(autoconf-find-last-macro, autoconf-parameter-strip):
* lisp/cedet/ede/config.el (ede-target-with-config-build):
* lisp/cedet/ede/linux.el (ede-linux--detect-architecture)
(ede-linux--get-architecture):
* lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache)
(semantic-displayer-abstract, semantic-displayer-point-position):
* lisp/cedet/semantic/format.el (semantic-format-face-alist)
(semantic-format-tag-short-doc):
* lisp/cedet/semantic/fw.el (semantic-find-file-noselect):
* lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time)
(semantic-idle-breadcrumbs-display-function)
(semantic-idle-breadcrumbs-format-tag-list-function):
* lisp/cedet/semantic/lex.el (semantic-lex-map-types)
(define-lex, define-lex-block-type-analyzer):
* lisp/cedet/semantic/senator.el (senator-search-default-tag-filter):
* lisp/cedet/semantic/symref.el (semantic-symref-result)
(semantic-symref-hit-to-tag-via-db):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-new-variable)
(semantic-tag-new-include, semantic-tag-new-package)
(semantic-tag-set-faux, semantic-create-tag-proxy)
(semantic-tag-function-parent)
(semantic-tag-components-with-overlays):
* lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces)
(srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict):
* lisp/cedet/srecode/dictionary.el (srecode-create-dictionary)
(srecode-dictionary-add-entries, srecode-dictionary-lookup-name)
(srecode-create-dictionaries-from-tags):
* lisp/cmuscheme.el (scheme-compile-region):
* lisp/color.el (color-lab-to-lch):
* lisp/doc-view.el (doc-view-image-width)
(doc-view-set-up-single-converter):
* lisp/dynamic-setting.el (font-setting-change-default-font)
(dynamic-setting-handle-config-changed-event):
* lisp/elec-pair.el (electric-pair-text-pairs)
(electric-pair-skip-whitespace-function)
(electric-pair-string-bound-function):
* lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance)
(avl-tree-member, avl-tree-mapcar, avl-tree-iter):
* lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree):
* lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag)
(checkdoc-spellcheck-documentation-flag, checkdoc-ispell)
(checkdoc-ispell-current-buffer, checkdoc-ispell-interactive)
(checkdoc-ispell-message-interactive)
(checkdoc-ispell-message-text, checkdoc-ispell-start)
(checkdoc-ispell-continue, checkdoc-ispell-comments)
(checkdoc-ispell-defun):
* lisp/emacs-lisp/cl-generic.el (cl--generic-search-method):
* lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group):
* lisp/emacs-lisp/lisp.el (forward-sexp, up-list):
* lisp/emacs-lisp/package-x.el (package--archive-contents-from-file):
* lisp/emacs-lisp/package.el (package-desc)
(package--make-autoloads-and-stuff, package-hidden-regexps):
* lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup):
* lisp/emacs-lisp/testcover.el (testcover-nohits)
(testcover-1value):
* lisp/epg.el (epg-receive-keys, epg-start-edit-key):
* lisp/erc/erc-backend.el (erc-server-processing-p)
(erc-split-line-length, erc-server-coding-system)
(erc-server-send, erc-message):
* lisp/erc/erc-button.el (erc-button-face, erc-button-alist)
(erc-browse-emacswiki):
* lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login):
* lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation):
* lisp/erc/erc-log.el (erc-current-logfile):
* lisp/erc/erc-match.el (erc-log-match-format)
(erc-text-matched-hook):
* lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug):
* lisp/erc/erc-networks.el (erc-server-alist)
(erc-networks-alist, erc-current-network):
* lisp/erc/erc-ring.el (erc-input-ring-index):
* lisp/erc/erc-speedbar.el (erc-speedbar)
(erc-speedbar-update-channel):
* lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag):
* lisp/erc/erc-track.el (erc-track-position-in-mode-line)
(erc-track-remove-from-mode-line, erc-modified-channels-update)
(erc-track-last-non-erc-buffer, erc-track-sort-by-importance)
(erc-track-get-active-buffer):
* lisp/erc/erc.el (erc-get-channel-user-list)
(erc-echo-notice-hook, erc-echo-notice-always-hook)
(erc-wash-quit-reason, erc-format-@nick):
* lisp/ffap.el (ffap-latex-mode):
* lisp/files.el (abort-if-file-too-large)
(dir-locals--get-sort-score, buffer-stale--default-function):
* lisp/filesets.el (filesets-tree-max-level, filesets-data)
(filesets-update-pre010505):
* lisp/gnus/gnus-agent.el (gnus-agent-flush-cache):
* lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol)
(gnus-button-prefer-mid-or-mail):
* lisp/gnus/gnus-cus.el (gnus-group-parameters):
* lisp/gnus/gnus-demon.el (gnus-demon-handlers)
(gnus-demon-run-callback):
* lisp/gnus/gnus-dired.el (gnus-dired-print):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer):
* lisp/gnus/gnus-range.el (gnus-range-normalize):
* lisp/gnus/gnus-spec.el (gnus-pad-form):
* lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud)
(gnus-server-opened, gnus-server-closed, gnus-server-denied)
(gnus-server-offline):
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir)
(gnus-refer-thread-limit-to-thread)
(gnus-summary-limit-include-thread, gnus-summary-refer-thread)
(gnus-summary-find-matching):
* lisp/gnus/gnus-util.el (gnus-rescale-image):
* lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server):
* lisp/gnus/mail-source.el (mail-source-incoming-file-prefix):
* lisp/gnus/message.el (message-cite-reply-position)
(message-cite-style-outlook, message-cite-style-thunderbird)
(message-cite-style-gmail, message--send-mail-maybe-partially):
* lisp/gnus/mm-extern.el (mm-inline-external-body):
* lisp/gnus/mm-partial.el (mm-inline-partial):
* lisp/gnus/mml-sec.el (mml-secure-message-sign)
(mml-secure-message-sign-encrypt, mml-secure-message-encrypt):
* lisp/gnus/mml2015.el (mml2015-epg-key-image)
(mml2015-epg-key-image-to-string):
* lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail):
* lisp/gnus/nnheader.el (nnheader-directory-files-is-safe):
* lisp/gnus/nnir.el (nnir-search-history)
(nnir-imap-search-other, nnir-artlist-length)
(nnir-artlist-article, nnir-artitem-group, nnir-artitem-number)
(nnir-artitem-rsv, nnir-article-group, nnir-article-number)
(nnir-article-rsv, nnir-article-ids, nnir-categorize)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-hyrex-additional-switches)
(gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms)
(nnir-read-parm, nnir-read-server-parm, nnir-search-thread):
* lisp/gnus/nnmairix.el (nnmairix-default-group)
(nnmairix-propagate-marks):
* lisp/gnus/smime.el (smime-keys, smime-crl-check)
(smime-verify-buffer, smime-noverify-buffer):
* lisp/gnus/spam-report.el (spam-report-url-ping-mm-url):
* lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header)
(spam-spamassassin-spam-status-header, spam-sa-learn-rebuild)
(spam-classifications, spam-check-stat, spam-spamassassin-score):
* lisp/help.el (describe-minor-mode-from-symbol):
* lisp/hippie-exp.el (hippie-expand-ignore-buffers):
* lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face)
(hfy-begin-span):
* lisp/ibuf-ext.el (ibuffer-update-saved-filters-format)
(ibuffer-saved-filters, ibuffer-old-saved-filters-warning)
(ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters)
(eval, ibuffer-unary-operand, file-extension, directory):
* lisp/image-dired.el (image-dired-cmd-pngcrush-options):
* lisp/image-mode.el (image-toggle-display):
* lisp/international/ccl.el (ccl-compile-read-multibyte-character)
(ccl-compile-write-multibyte-character):
* lisp/international/kkc.el (kkc-save-init-file):
* lisp/international/latin1-disp.el (latin1-display):
* lisp/international/ogonek.el (ogonek-name-encoding-alist)
(ogonek-information, ogonek-lookup-encoding)
(ogonek-deprefixify-region):
* lisp/isearch.el (isearch-filter-predicate)
(isearch--momentary-message):
* lisp/jsonrpc.el (jsonrpc-connection-send)
(jsonrpc-process-connection, jsonrpc-shutdown)
(jsonrpc--async-request-1):
* lisp/language/tibet-util.el (tibetan-char-p):
* lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date)
(feedmail-last-chance-hook, feedmail-before-fcc-hook)
(feedmail-send-it-immediately-wrapper, feedmail-find-eoh):
* lisp/mail/hashcash.el (hashcash-generate-payment)
(hashcash-generate-payment-async, hashcash-insert-payment)
(hashcash-verify-payment):
* lisp/mail/rmail.el (rmail-movemail-variant-in-use)
(rmail-get-attr-value):
* lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime):
* lisp/mail/rmailsum.el (rmail-summary-show-message):
* lisp/mail/supercite.el (sc-raw-mode-toggle):
* lisp/man.el (Man-start-calling):
* lisp/mh-e/mh-acros.el (mh-do-at-event-location)
(mh-iterate-on-messages-in-region, mh-iterate-on-range):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases)
(mh-alias-reload, mh-alias-ali)
(mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file)
(mh-alias-add-alias):
* lisp/mouse.el (mouse-save-then-kill):
* lisp/net/browse-url.el (browse-url-default-macosx-browser):
* lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value)
(eudc-variable-server-value, eudc-update-variable)
(eudc-expand-inline):
* lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result):
* lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list):
* lisp/net/pop3.el (pop3-list):
* lisp/net/soap-client.el (soap-namespace-put)
(soap-xs-parse-sequence, soap-parse-envelope):
* lisp/net/soap-inspect.el (soap-inspect-xs-complex-type):
* lisp/nxml/rng-xsd.el (rng-xsd-date-to-days):
* lisp/org/ob-C.el (org-babel-prep-session:C)
(org-babel-load-session:C):
* lisp/org/ob-J.el (org-babel-execute:J):
* lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote):
* lisp/org/ob-awk.el (org-babel-execute:awk):
* lisp/org/ob-core.el (org-babel-process-file-name):
* lisp/org/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/org/ob-forth.el (org-babel-execute:forth):
* lisp/org/ob-fortran.el (org-babel-execute:fortran)
(org-babel-prep-session:fortran, org-babel-load-session:fortran):
* lisp/org/ob-groovy.el (org-babel-execute:groovy):
* lisp/org/ob-io.el (org-babel-execute:io):
* lisp/org/ob-js.el (org-babel-execute:js):
* lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond)
(org-babel-lilypond-compile-post-tangle)
(org-babel-lilypond-display-pdf-post-tangle)
(org-babel-lilypond-tangle)
(org-babel-lilypond-execute-tangled-ly)
(org-babel-lilypond-compile-lilyfile)
(org-babel-lilypond-check-for-compile-error)
(org-babel-lilypond-process-compile-error)
(org-babel-lilypond-mark-error-line)
(org-babel-lilypond-parse-error-line)
(org-babel-lilypond-attempt-to-open-pdf)
(org-babel-lilypond-attempt-to-play-midi)
(org-babel-lilypond-switch-extension)
(org-babel-lilypond-set-header-args):
* lisp/org/ob-lua.el (org-babel-prep-session:lua):
* lisp/org/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/org/ob-processing.el (org-babel-prep-session:processing):
* lisp/org/ob-python.el (org-babel-prep-session:python):
* lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message)
(org-babel-scheme-execute-with-geiser, org-babel-execute:scheme):
* lisp/org/ob-shen.el (org-babel-execute:shen):
* lisp/org/org-agenda.el (org-agenda-entry-types)
(org-agenda-move-date-from-past-immediately-to-today)
(org-agenda-time-grid, org-agenda-sorting-strategy)
(org-agenda-filter-by-category, org-agenda-forward-block):
* lisp/org/org-colview.el (org-columns--overlay-text):
* lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces):
* lisp/org/org-indent.el (org-indent-set-line-properties):
* lisp/org/org-macs.el (org-get-limited-outline-regexp):
* lisp/org/org-mobile.el (org-mobile-files):
* lisp/org/org.el (org-use-fast-todo-selection)
(org-extend-today-until, org-use-property-inheritance)
(org-refresh-effort-properties, org-open-at-point-global)
(org-track-ordered-property-with-tag, org-shiftright):
* lisp/org/ox-html.el (org-html-checkbox-type):
* lisp/org/ox-man.el (org-man-source-highlight)
(org-man-verse-block):
* lisp/org/ox-publish.el (org-publish-sitemap-default):
* lisp/outline.el (outline-head-from-level):
* lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1)
(dcl-calc-command-indent, dcl-indent-to):
* lisp/progmodes/flymake.el (flymake-make-diagnostic)
(flymake--overlays, flymake-diagnostic-functions)
(flymake-diagnostic-types-alist, flymake--backend-state)
(flymake-is-running, flymake--collect, flymake-mode):
* lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop)
(gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer):
* lisp/progmodes/grep.el (grep-error-screen-columns):
* lisp/progmodes/gud.el (gud-prev-expr):
* lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column)
(ps-run-goto-error):
* lisp/progmodes/python.el (python-eldoc-get-doc)
(python-eldoc-function-timeout-permanent, python-eldoc-function):
* lisp/shadowfile.el (shadow-make-group):
* lisp/speedbar.el (speedbar-obj-do-check):
* lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook):
* lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib):
* lisp/textmodes/reftex-index.el (reftex-index-goto-entry)
(reftex-index-kill, reftex-index-undo):
* lisp/textmodes/reftex-parse.el (reftex-context-substring):
* lisp/textmodes/reftex.el (reftex-TeX-master-file):
* lisp/textmodes/rst.el (rst-next-hdr, rst-toc)
(rst-uncomment-region, rst-font-lock-extend-region-internal):
* lisp/thumbs.el (thumbs-mode):
* lisp/vc/ediff-util.el (ediff-restore-diff):
* lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag):
* lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p):
* lisp/wid-edit.el (widget-field-value-set, string):
* lisp/x-dnd.el (x-dnd-version-from-flags)
(x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-21 00:27:53 +02:00
|
|
|
\"Read error: 110\". The same applies for \"Ping Timeout\"."
|
2006-01-29 13:08:58 +00:00
|
|
|
(setq nick (regexp-quote nick)
|
2014-11-08 20:51:43 -05:00
|
|
|
login (regexp-quote login)
|
|
|
|
host (regexp-quote host))
|
2006-01-29 13:08:58 +00:00
|
|
|
(or (when (string-match (concat "^\\(Read error\\) to "
|
2014-11-08 20:51:43 -05:00
|
|
|
nick "\\[" host "\\]: "
|
|
|
|
"\\(.+\\)$")
|
|
|
|
reason)
|
|
|
|
(concat (match-string 1 reason) ": " (match-string 2 reason)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(when (string-match (concat "^\\(Ping timeout\\) for "
|
2014-11-08 20:51:43 -05:00
|
|
|
nick "\\[" host "\\]$")
|
|
|
|
reason)
|
|
|
|
(match-string 1 reason))
|
2006-01-29 13:08:58 +00:00
|
|
|
reason))
|
|
|
|
|
2023-06-08 23:49:23 -07:00
|
|
|
(cl-defmethod erc--nickname-in-use-make-request (_nick temp)
|
|
|
|
"Request nickname TEMP in place of rejected NICK."
|
|
|
|
(erc-cmd-NICK temp))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-nickname-in-use (nick reason)
|
|
|
|
"If NICK is unavailable, tell the user the REASON.
|
|
|
|
|
|
|
|
See also `erc-display-error-notice'."
|
2006-07-14 02:29:50 +00:00
|
|
|
(if (or (not erc-try-new-nick-p)
|
2014-11-08 20:51:43 -05:00
|
|
|
;; how many default-nicks are left + one more try...
|
|
|
|
(eq erc-nick-change-attempt-count
|
|
|
|
(if (consp erc-nick)
|
|
|
|
(+ (length erc-nick) 1)
|
|
|
|
1)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-display-error-notice
|
|
|
|
nil
|
|
|
|
(format "Nickname %s is %s, try another." nick reason))
|
|
|
|
(setq erc-nick-change-attempt-count (+ erc-nick-change-attempt-count 1))
|
|
|
|
(let ((newnick (nth 1 erc-default-nicks))
|
2021-08-12 03:10:31 -07:00
|
|
|
(nicklen (erc-with-server-buffer
|
|
|
|
(erc--get-isupport-entry 'NICKLEN 'single))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(setq erc-bad-nick t)
|
|
|
|
;; try to use a different nick
|
|
|
|
(if erc-default-nicks
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq erc-default-nicks (cdr erc-default-nicks)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (not newnick)
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq newnick (concat (truncate-string-to-width
|
|
|
|
nick
|
|
|
|
(if (and erc-server-connected nicklen)
|
|
|
|
(- (string-to-number nicklen)
|
|
|
|
(length erc-nick-uniquifier))
|
|
|
|
;; rfc2812 max nick length = 9
|
|
|
|
;; we must assume this is the
|
|
|
|
;; server's setting if we haven't
|
|
|
|
;; established a connection yet
|
|
|
|
(- 9 (length erc-nick-uniquifier))))
|
2015-06-06 12:12:06 -07:00
|
|
|
erc-nick-uniquifier)))
|
2023-06-08 23:49:23 -07:00
|
|
|
(erc--nickname-in-use-make-request nick newnick)
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-display-error-notice
|
|
|
|
nil
|
|
|
|
(format "Nickname %s is %s, trying %s"
|
2014-11-08 20:51:43 -05:00
|
|
|
nick reason newnick)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;;; Server messages
|
|
|
|
|
2023-04-21 07:30:18 -07:00
|
|
|
;; FIXME remove on next major version release. This group is all but
|
|
|
|
;; unused because most `erc-server-FOO-functions' are plain variables
|
|
|
|
;; and not user options as implied by this doc string.
|
2006-01-29 13:08:58 +00:00
|
|
|
(defgroup erc-server-hooks nil
|
|
|
|
"Server event callbacks.
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
Every server event - like numeric replies - has its own hook.
|
2006-01-29 13:08:58 +00:00
|
|
|
Those hooks are all called using `run-hook-with-args-until-success'.
|
|
|
|
They receive as first argument the process object from where the event
|
|
|
|
originated from,
|
|
|
|
and as second argument the event parsed as a vector."
|
|
|
|
:group 'erc-hooks)
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-display-server-message (_proc parsed)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Display the message sent by the server as a notice."
|
|
|
|
(erc-display-message
|
|
|
|
parsed 'notice 'active (erc-response.contents parsed)))
|
|
|
|
|
|
|
|
(defun erc-auto-query (proc parsed)
|
|
|
|
;; FIXME: This needs more documentation, unless it's not a user function --
|
|
|
|
;; Lawrence 2004-01-08
|
|
|
|
"Put this on `erc-server-PRIVMSG-functions'."
|
|
|
|
(when erc-auto-query
|
|
|
|
(let* ((nick (car (erc-parse-user (erc-response.sender parsed))))
|
2014-11-08 20:51:43 -05:00
|
|
|
(target (car (erc-response.command-args parsed)))
|
|
|
|
(msg (erc-response.contents parsed))
|
|
|
|
(query (if (not erc-query-on-unjoined-chan-privmsg)
|
|
|
|
nick
|
|
|
|
(if (erc-current-nick-p target)
|
|
|
|
nick
|
|
|
|
target))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(and (not (erc-ignored-user-p (erc-response.sender parsed)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(or erc-query-on-unjoined-chan-privmsg
|
|
|
|
(string= target (erc-current-nick)))
|
|
|
|
(not (erc-get-buffer query proc))
|
|
|
|
(not (erc-is-message-ctcp-and-not-action-p msg))
|
|
|
|
(let ((erc-query-display erc-auto-query))
|
|
|
|
(erc-cmd-QUERY query))
|
|
|
|
nil))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2021-05-07 01:52:41 -07:00
|
|
|
(make-obsolete 'erc-auto-query "try erc-cmd-QUERY instead" "29.1")
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-is-message-ctcp-p (message)
|
|
|
|
"Check if MESSAGE is a CTCP message or not."
|
|
|
|
(string-match "^\C-a\\([^\C-a]*\\)\C-a?$" message))
|
|
|
|
|
|
|
|
(defun erc-is-message-ctcp-and-not-action-p (message)
|
|
|
|
"Check if MESSAGE is a CTCP message or not."
|
|
|
|
(and (erc-is-message-ctcp-p message)
|
Fix regular-expression glitches and typos
Problems reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2019-03/msg00085.html
* admin/admin.el (set-version):
* lisp/allout.el (allout-latexify-one-item):
* lisp/arc-mode.el (archive-arc-rename-entry)
(archive-rar-summarize):
* lisp/calc/calc-graph.el (calc-graph-set-styles)
(calc-graph-hide):
* lisp/calc/calc-help.el (calc-describe-key):
* lisp/calc/calc-lang.el (math-compose-tex-func, eqn):
* lisp/calc/calc.el (calcDigit-key):
* lisp/cedet/ede/makefile-edit.el (makefile-macro-file-list):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/comint.el (comint-substitute-in-file-name):
* lisp/dired.el (dired-actual-switches):
* lisp/emacs-lisp/chart.el (chart-rmail-from):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/rx.el (rx-not, rx-atomic-p):
* lisp/emulation/viper-ex.el (viper-get-ex-token)
(viper-get-ex-pat, ex-set-read-variable):
* lisp/epg.el (epg--status-SIG_CREATED):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-user):
(erc-speedbar-expand-channel, erc-speedbar-expand-server)
* lisp/erc/erc.el (erc-is-message-ctcp-and-not-action-p)
(erc-banlist-update):
* lisp/eshell/em-dirs.el (eshell-parse-drive-letter, eshell/pwd):
* lisp/find-dired.el (find-dired):
* lisp/frame.el (frame-set-background-mode):
* lisp/generic-x.el (apache-log-generic-mode):
* lisp/gnus/gnus-art.el (gnus-button-valid-localpart-regexp):
* lisp/gnus/gnus.el (gnus-short-group-name):
* lisp/gnus/message.el (message-mailer-swallows-blank-line):
* lisp/ibuffer.el (ibuffer-fontification-alist):
* lisp/ido.el (ido-set-matches-1):
* lisp/info-xref.el (info-xref-lock-file-p):
* lisp/info.el (Info-dir-remove-duplicates)
(Info-unescape-quotes, Info-split-parameter-string)
(Info-speedbar-expand-node):
* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/language/ethio-util.el (ethio-fidel-to-tex-buffer):
* lisp/mail/rmail.el (rmail-collect-deleted):
* lisp/mh-e/mh-alias.el (mh-alias-suggest-alias):
* lisp/mh-e/mh-comp.el (mh-forward):
* lisp/mh-e/mh-search.el (mh-index-next-folder)
(mh-index-create-imenu-index):
* lisp/mh-e/mh-xface.el (mh-picon-get-image):
* lisp/minibuffer.el (completion--embedded-envvar-re):
* lisp/net/ange-ftp.el (ange-ftp-ls-parser):
* lisp/net/goto-addr.el (goto-address-mail-regexp)
(goto-address-find-address-at-point):
* lisp/net/pop3.el (pop3-read-response, pop3-user)
(pop3-pass, pop3-apop):
* lisp/net/tramp.el (tramp-ipv6-regexp)
(tramp-replace-environment-variables):
* lisp/nxml/nxml-maint.el (nxml-insert-target-repertoire-glyph-set):
* lisp/nxml/rng-uri.el (rng-uri-escape-multibyte):
* lisp/nxml/rng-xsd.el (rng-xsd-convert-any-uri):
* lisp/obsolete/pgg.el (pgg-fetch-key):
* lisp/obsolete/vip.el (vip-get-ex-token):
* lisp/org/ob-core.el (org-babel-string-read):
* lisp/org/org-agenda.el:
(org-agenda-add-entry-to-org-agenda-diary-file):
* lisp/org/org-element.el (org-element-keyword-parser):
* lisp/org/org-list.el (org-list-indent-item-generic):
* lisp/org/org-mhe.el (org-mhe-get-message-folder-from-index):
* lisp/org/org-mobile.el (org-mobile-apply):
* lisp/org/org-mouse.el (org-mouse-context-menu):
* lisp/org/org-plot.el (org-plot/gnuplot):
* lisp/org/org-protocol.el (org-protocol-flatten-greedy):
* lisp/org/org-table.el (org-table-copy-down)
(org-table-formula-make-cmp-string)
(org-table-get-stored-formulas, org-table-recalculate)
(org-table-edit-formulas):
* lisp/org/org.el (org-translate-link-from-planner)
(org-fill-line-break-nobreak-p):
* lisp/org/ox-ascii.el (org-ascii-item):
* lisp/org/ox-latex.el (org-latex-clean-invalid-line-breaks):
* lisp/org/ox.el (org-export-expand-include-keyword):
* lisp/progmodes/ada-xref.el (ada-treat-cmd-string):
* lisp/progmodes/cfengine.el (cfengine2-font-lock-keywords):
* lisp/progmodes/cperl-mode.el (cperl-to-comment-or-eol)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-have-help-regexp, cperl-word-at-point-hard)
(cperl-make-regexp-x):
* lisp/progmodes/dcl-mode.el (dcl-option-value-offset):
* lisp/progmodes/etags.el (tag-implicit-name-match-p):
* lisp/progmodes/fortran.el (fortran-fill):
* lisp/progmodes/gdb-mi.el (gdb-speedbar-expand-node)
(gdb-locals-handler-custom):
* lisp/progmodes/grep.el (grep-mode-font-lock-keywords):
* lisp/progmodes/gud.el (gud-jdb-find-source-using-classpath):
* lisp/progmodes/js.el (js--continued-expression-p):
* lisp/progmodes/m4-mode.el (m4-font-lock-keywords):
* lisp/progmodes/meta-mode.el (meta-indent-level-count):
* lisp/progmodes/mixal-mode.el (mixal-font-lock-keywords):
* lisp/progmodes/opascal.el (opascal-find-unit-in-directory):
* lisp/progmodes/pascal.el (pascal-progbeg-re):
* lisp/progmodes/ruby-mode.el (ruby-expression-expansion-re)
(ruby-expr-beg, ruby-parse-partial)
(ruby-toggle-string-quotes, ruby-font-lock-keywords):
* lisp/progmodes/sql.el (sql--make-help-docstring):
* lisp/progmodes/verilog-mode.el (verilog-coverpoint-re)
(verilog-skip-forward-comment-p)
(verilog-read-sub-decls-gate)
(verilog-read-auto-template-middle):
* lisp/progmodes/vhdl-mode.el (vhdl-resolve-env-variable)
(vhdl-speedbar-expand-project, vhdl-speedbar-expand-entity)
(vhdl-speedbar-expand-architecture)
(vhdl-speedbar-expand-config, vhdl-speedbar-expand-package)
(vhdl-speedbar-dired):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/textmodes/dns-mode.el (dns-mode-font-lock-keywords):
* lisp/textmodes/flyspell.el (flyspell-debug-signal-word-checked):
* lisp/textmodes/ispell.el (ispell-process-line):
* lisp/textmodes/reftex-cite.el (reftex-end-of-bib-entry):
* lisp/textmodes/reftex-ref.el (reftex-replace-prefix-escapes):
* lisp/url/url-parse.el (url-generic-parse-url):
* lisp/url/url-util.el (url-truncate-url-for-viewing):
* lisp/vc/diff-mode.el (diff-unified->context):
* lisp/vc/vc-bzr.el (vc-bzr-error-regexp-alist):
* lisp/vc/vc-cvs.el (vc-cvs-parse-status):
* lisp/woman.el (woman0-el, woman-if-ignore)
(woman-change-fonts):
* lisp/xdg.el (xdg--substitute-home-env):
Fix regular-expression infelicities and typos.
Fix regular expression typos
Fix typos reported by Mattias Engdegård in:
that occurred in preloaded modules.
* lisp/frame.el (frame-set-background-mode):
* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/minibuffer.el (completion--embedded-envvar-re):
2019-03-04 18:00:00 -08:00
|
|
|
(not (string-match "^\C-aACTION.*\C-a$" message))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(defun erc--get-speaker-bounds ()
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
"Return the bounds of `erc--speaker' text property when present.
|
2023-06-30 23:42:01 -07:00
|
|
|
Assume buffer is narrowed to the confines of an inserted message."
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(and-let* (((erc--check-msg-prop 'erc--msg 'msg))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(beg (text-property-not-all (point-min) (point-max)
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
'erc--speaker nil)))
|
|
|
|
(cons beg (next-single-property-change beg 'erc--speaker))))
|
2023-06-30 23:42:01 -07:00
|
|
|
|
Spoof channel users in erc-button--phantom-users-mode
* lisp/erc/erc-backend.el (erc--cmem-from-nick-function): Update
forward declaration.
(erc-server-PRIVMSG): Use new name for `erc--user-from-nick-function',
now `erc--cmem-from-nick-function'.
* lisp/erc/erc-button.el (erc-button--phantom-users,
erc-button--phantom-cmems): Rename former to latter.
(erc-button--fallback-user-function,
erc-button--fallback-cmem-function): Rename former to latter.
(erc--phantom-channel-user, erc--phantom-server-user): New superficial
`cl-struct' definitions "subclassing" `erc-channel-user' and
`erc-server-user'. Note that these symbols lack an `erc-button'
prefix.
(erc-button--add-phantom-speaker): Look for channel member instead of
server user, creating one if necessary. Return a made-up
`erc-channel-user' along with a fake `erc-server-user'.
(erc-button--get-phantom-user, erc-button--get-phantom-cmem): Rename
former to latter.
(erc-button--phantom-users-mode, erc-button--phantom-users-enable,
erc-button--phantom-users-disable): Use updated "cmem" names for
function-valued interface variables and their implementing functions.
Remove obsolete comment.
(erc-button-add-nickname-buttons): Attempt to query fallback function
for channel member instead of server user.
* lisp/erc/erc.el (erc--user-from-nick-function,
erc--cmem-from-nick-function): Rename former to latter.
(erc--examine-nick, erc--cmem-get-existing): Rename former to
latter. (Bug#60933)
2023-09-06 19:40:11 -07:00
|
|
|
(defvar erc--cmem-from-nick-function #'erc--cmem-get-existing
|
|
|
|
"Function maybe returning a \"channel member\" cons from a nick.
|
|
|
|
Must return either nil or a cons of an `erc-server-user' and an
|
|
|
|
`erc-channel-user' (see `erc-channel-users') for use in
|
|
|
|
formatting a user's nick prior to insertion. Called in the
|
|
|
|
appropriate target buffer with the downcased nick, the parsed
|
|
|
|
NUH, and the current `erc-response' object.")
|
|
|
|
|
|
|
|
(defun erc--cmem-get-existing (downcased _nuh _parsed)
|
2023-04-28 06:34:09 -07:00
|
|
|
(and erc-channel-users (gethash downcased erc-channel-users)))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-format-privmessage (nick msg privp msgp)
|
2011-11-19 01:18:31 -08:00
|
|
|
"Format a PRIVMSG in an insertable fashion."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let* ((mark-s (if msgp (if privp "*" "<") "-"))
|
2014-11-08 20:51:43 -05:00
|
|
|
(mark-e (if msgp (if privp "*" ">") "-"))
|
|
|
|
(str (format "%s%s%s %s" mark-s nick mark-e msg))
|
|
|
|
(nick-face (if privp 'erc-nick-msg-face 'erc-nick-default-face))
|
2023-06-24 18:33:20 -07:00
|
|
|
(nick-prefix-face (get-text-property 0 'font-lock-face nick))
|
|
|
|
(prefix-len (or (and nick-prefix-face (text-property-not-all
|
|
|
|
0 (length nick) 'font-lock-face
|
|
|
|
nick-prefix-face nick))
|
|
|
|
0))
|
2014-11-08 20:51:43 -05:00
|
|
|
(msg-face (if privp 'erc-direct-msg-face 'erc-default-face)))
|
2006-01-29 13:08:58 +00:00
|
|
|
;; add text properties to text before the nick, the nick and after the nick
|
2016-04-07 14:23:18 +02:00
|
|
|
(erc-put-text-property 0 (length mark-s) 'font-lock-face msg-face str)
|
2023-06-24 18:33:20 -07:00
|
|
|
(erc-put-text-properties (+ (length mark-s) prefix-len)
|
|
|
|
(+ (length mark-s) (length nick))
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
'(font-lock-face erc--speaker) str
|
2023-06-24 18:33:20 -07:00
|
|
|
(list nick-face
|
|
|
|
(substring-no-properties nick prefix-len)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-put-text-property (+ (length mark-s) (length nick)) (length str)
|
2016-04-07 14:23:18 +02:00
|
|
|
'font-lock-face msg-face str)
|
2006-01-29 13:08:58 +00:00
|
|
|
str))
|
|
|
|
|
|
|
|
(defcustom erc-format-nick-function 'erc-format-nick
|
2012-04-09 21:05:48 +08:00
|
|
|
"Function to format a nickname for message display."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-display
|
|
|
|
:type 'function)
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-format-nick (&optional user _channel-data)
|
2006-11-20 06:50:29 +00:00
|
|
|
"Return the nickname of USER.
|
|
|
|
See also `erc-format-nick-function'."
|
|
|
|
(when user (erc-server-user-nickname user)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2014-11-08 20:51:43 -05:00
|
|
|
(defun erc-get-user-mode-prefix (user)
|
2006-11-20 06:50:29 +00:00
|
|
|
(when user
|
2014-11-08 20:51:43 -05:00
|
|
|
(cond ((erc-channel-user-owner-p user)
|
Make more erc function aliases obsolete
* lisp/erc/erc-compat.el (erc-propertize, erc-view-mode-enter)
(erc-function-arglist, erc-delete-dups)
(erc-replace-regexp-in-string): Make these aliases obsolete.
* lisp/erc/erc-capab.el (erc-capab-identify-add-prefix)
(erc-capab-identify-remove/set-identified-flag):
* lisp/erc/erc-dcc.el (erc-dcc-chat-parse-output)
(erc-dcc-unquote-filename, pcomplete/erc-mode/DCC):
* lisp/erc/erc-list.el (erc-list-menu-mode, erc-list-button)
(erc-list-make-string):
* lisp/erc/erc-log.el (erc-log-standardize-name):
* lisp/erc/erc-match.el (erc-log-matches-make-buffer):
* lisp/erc/erc-networks.el (erc-server-select):
* lisp/erc/erc.el (erc-message-english-PART)
(erc-update-mode-line-buffer, erc-format-my-nick)
(erc-format-@nick, erc-get-user-mode-prefix, erc-display-prompt)
(erc-part-reason-zippy, erc-quit-reason-zippy, erc-get-arglist)
(erc-toggle-debug-irc-protocol, erc-log-irc-protocol)
(erc-migrate-modules): Adjust callers.
2020-08-07 13:54:50 +02:00
|
|
|
(propertize "~" 'help-echo "owner"))
|
2014-11-08 20:51:43 -05:00
|
|
|
((erc-channel-user-admin-p user)
|
Make more erc function aliases obsolete
* lisp/erc/erc-compat.el (erc-propertize, erc-view-mode-enter)
(erc-function-arglist, erc-delete-dups)
(erc-replace-regexp-in-string): Make these aliases obsolete.
* lisp/erc/erc-capab.el (erc-capab-identify-add-prefix)
(erc-capab-identify-remove/set-identified-flag):
* lisp/erc/erc-dcc.el (erc-dcc-chat-parse-output)
(erc-dcc-unquote-filename, pcomplete/erc-mode/DCC):
* lisp/erc/erc-list.el (erc-list-menu-mode, erc-list-button)
(erc-list-make-string):
* lisp/erc/erc-log.el (erc-log-standardize-name):
* lisp/erc/erc-match.el (erc-log-matches-make-buffer):
* lisp/erc/erc-networks.el (erc-server-select):
* lisp/erc/erc.el (erc-message-english-PART)
(erc-update-mode-line-buffer, erc-format-my-nick)
(erc-format-@nick, erc-get-user-mode-prefix, erc-display-prompt)
(erc-part-reason-zippy, erc-quit-reason-zippy, erc-get-arglist)
(erc-toggle-debug-irc-protocol, erc-log-irc-protocol)
(erc-migrate-modules): Adjust callers.
2020-08-07 13:54:50 +02:00
|
|
|
(propertize "&" 'help-echo "admin"))
|
2014-11-08 20:51:43 -05:00
|
|
|
((erc-channel-user-op-p user)
|
Make more erc function aliases obsolete
* lisp/erc/erc-compat.el (erc-propertize, erc-view-mode-enter)
(erc-function-arglist, erc-delete-dups)
(erc-replace-regexp-in-string): Make these aliases obsolete.
* lisp/erc/erc-capab.el (erc-capab-identify-add-prefix)
(erc-capab-identify-remove/set-identified-flag):
* lisp/erc/erc-dcc.el (erc-dcc-chat-parse-output)
(erc-dcc-unquote-filename, pcomplete/erc-mode/DCC):
* lisp/erc/erc-list.el (erc-list-menu-mode, erc-list-button)
(erc-list-make-string):
* lisp/erc/erc-log.el (erc-log-standardize-name):
* lisp/erc/erc-match.el (erc-log-matches-make-buffer):
* lisp/erc/erc-networks.el (erc-server-select):
* lisp/erc/erc.el (erc-message-english-PART)
(erc-update-mode-line-buffer, erc-format-my-nick)
(erc-format-@nick, erc-get-user-mode-prefix, erc-display-prompt)
(erc-part-reason-zippy, erc-quit-reason-zippy, erc-get-arglist)
(erc-toggle-debug-irc-protocol, erc-log-irc-protocol)
(erc-migrate-modules): Adjust callers.
2020-08-07 13:54:50 +02:00
|
|
|
(propertize "@" 'help-echo "operator"))
|
2014-11-08 20:51:43 -05:00
|
|
|
((erc-channel-user-halfop-p user)
|
Make more erc function aliases obsolete
* lisp/erc/erc-compat.el (erc-propertize, erc-view-mode-enter)
(erc-function-arglist, erc-delete-dups)
(erc-replace-regexp-in-string): Make these aliases obsolete.
* lisp/erc/erc-capab.el (erc-capab-identify-add-prefix)
(erc-capab-identify-remove/set-identified-flag):
* lisp/erc/erc-dcc.el (erc-dcc-chat-parse-output)
(erc-dcc-unquote-filename, pcomplete/erc-mode/DCC):
* lisp/erc/erc-list.el (erc-list-menu-mode, erc-list-button)
(erc-list-make-string):
* lisp/erc/erc-log.el (erc-log-standardize-name):
* lisp/erc/erc-match.el (erc-log-matches-make-buffer):
* lisp/erc/erc-networks.el (erc-server-select):
* lisp/erc/erc.el (erc-message-english-PART)
(erc-update-mode-line-buffer, erc-format-my-nick)
(erc-format-@nick, erc-get-user-mode-prefix, erc-display-prompt)
(erc-part-reason-zippy, erc-quit-reason-zippy, erc-get-arglist)
(erc-toggle-debug-irc-protocol, erc-log-irc-protocol)
(erc-migrate-modules): Adjust callers.
2020-08-07 13:54:50 +02:00
|
|
|
(propertize "%" 'help-echo "half-op"))
|
2014-11-08 20:51:43 -05:00
|
|
|
((erc-channel-user-voice-p user)
|
Make more erc function aliases obsolete
* lisp/erc/erc-compat.el (erc-propertize, erc-view-mode-enter)
(erc-function-arglist, erc-delete-dups)
(erc-replace-regexp-in-string): Make these aliases obsolete.
* lisp/erc/erc-capab.el (erc-capab-identify-add-prefix)
(erc-capab-identify-remove/set-identified-flag):
* lisp/erc/erc-dcc.el (erc-dcc-chat-parse-output)
(erc-dcc-unquote-filename, pcomplete/erc-mode/DCC):
* lisp/erc/erc-list.el (erc-list-menu-mode, erc-list-button)
(erc-list-make-string):
* lisp/erc/erc-log.el (erc-log-standardize-name):
* lisp/erc/erc-match.el (erc-log-matches-make-buffer):
* lisp/erc/erc-networks.el (erc-server-select):
* lisp/erc/erc.el (erc-message-english-PART)
(erc-update-mode-line-buffer, erc-format-my-nick)
(erc-format-@nick, erc-get-user-mode-prefix, erc-display-prompt)
(erc-part-reason-zippy, erc-quit-reason-zippy, erc-get-arglist)
(erc-toggle-debug-irc-protocol, erc-log-irc-protocol)
(erc-migrate-modules): Adjust callers.
2020-08-07 13:54:50 +02:00
|
|
|
(propertize "+" 'help-echo "voice"))
|
2014-11-08 20:51:43 -05:00
|
|
|
(t ""))))
|
|
|
|
|
|
|
|
(defun erc-format-@nick (&optional user _channel-data)
|
|
|
|
"Format the nickname of USER showing if USER has a voice, is an
|
lisp/*.el: Fix typos and other trivial doc fixes
* lisp/allout-widgets.el (allout-widgets-auto-activation)
(allout-current-decorated-p):
* lisp/auth-source.el (auth-source-protocols):
* lisp/autorevert.el (auto-revert-set-timer):
* lisp/battery.el (battery-mode-line-limit):
* lisp/calc/calcalg3.el (math-map-binop):
* lisp/calendar/cal-dst.el (calendar-dst-find-startend):
* lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute):
* lisp/calendar/calendar.el (calendar-date-echo-text)
(calendar-generate-month, calendar-string-spread)
(calendar-cursor-to-date, calendar-read, calendar-read-date)
(calendar-mark-visible-date, calendar-dayname-on-or-before):
* lisp/calendar/diary-lib.el (diary-ordinal-suffix):
* lisp/cedet/ede/autoconf-edit.el (autoconf-new-program)
(autoconf-find-last-macro, autoconf-parameter-strip):
* lisp/cedet/ede/config.el (ede-target-with-config-build):
* lisp/cedet/ede/linux.el (ede-linux--detect-architecture)
(ede-linux--get-architecture):
* lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache)
(semantic-displayer-abstract, semantic-displayer-point-position):
* lisp/cedet/semantic/format.el (semantic-format-face-alist)
(semantic-format-tag-short-doc):
* lisp/cedet/semantic/fw.el (semantic-find-file-noselect):
* lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time)
(semantic-idle-breadcrumbs-display-function)
(semantic-idle-breadcrumbs-format-tag-list-function):
* lisp/cedet/semantic/lex.el (semantic-lex-map-types)
(define-lex, define-lex-block-type-analyzer):
* lisp/cedet/semantic/senator.el (senator-search-default-tag-filter):
* lisp/cedet/semantic/symref.el (semantic-symref-result)
(semantic-symref-hit-to-tag-via-db):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-new-variable)
(semantic-tag-new-include, semantic-tag-new-package)
(semantic-tag-set-faux, semantic-create-tag-proxy)
(semantic-tag-function-parent)
(semantic-tag-components-with-overlays):
* lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces)
(srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict):
* lisp/cedet/srecode/dictionary.el (srecode-create-dictionary)
(srecode-dictionary-add-entries, srecode-dictionary-lookup-name)
(srecode-create-dictionaries-from-tags):
* lisp/cmuscheme.el (scheme-compile-region):
* lisp/color.el (color-lab-to-lch):
* lisp/doc-view.el (doc-view-image-width)
(doc-view-set-up-single-converter):
* lisp/dynamic-setting.el (font-setting-change-default-font)
(dynamic-setting-handle-config-changed-event):
* lisp/elec-pair.el (electric-pair-text-pairs)
(electric-pair-skip-whitespace-function)
(electric-pair-string-bound-function):
* lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance)
(avl-tree-member, avl-tree-mapcar, avl-tree-iter):
* lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree):
* lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag)
(checkdoc-spellcheck-documentation-flag, checkdoc-ispell)
(checkdoc-ispell-current-buffer, checkdoc-ispell-interactive)
(checkdoc-ispell-message-interactive)
(checkdoc-ispell-message-text, checkdoc-ispell-start)
(checkdoc-ispell-continue, checkdoc-ispell-comments)
(checkdoc-ispell-defun):
* lisp/emacs-lisp/cl-generic.el (cl--generic-search-method):
* lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group):
* lisp/emacs-lisp/lisp.el (forward-sexp, up-list):
* lisp/emacs-lisp/package-x.el (package--archive-contents-from-file):
* lisp/emacs-lisp/package.el (package-desc)
(package--make-autoloads-and-stuff, package-hidden-regexps):
* lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup):
* lisp/emacs-lisp/testcover.el (testcover-nohits)
(testcover-1value):
* lisp/epg.el (epg-receive-keys, epg-start-edit-key):
* lisp/erc/erc-backend.el (erc-server-processing-p)
(erc-split-line-length, erc-server-coding-system)
(erc-server-send, erc-message):
* lisp/erc/erc-button.el (erc-button-face, erc-button-alist)
(erc-browse-emacswiki):
* lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login):
* lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation):
* lisp/erc/erc-log.el (erc-current-logfile):
* lisp/erc/erc-match.el (erc-log-match-format)
(erc-text-matched-hook):
* lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug):
* lisp/erc/erc-networks.el (erc-server-alist)
(erc-networks-alist, erc-current-network):
* lisp/erc/erc-ring.el (erc-input-ring-index):
* lisp/erc/erc-speedbar.el (erc-speedbar)
(erc-speedbar-update-channel):
* lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag):
* lisp/erc/erc-track.el (erc-track-position-in-mode-line)
(erc-track-remove-from-mode-line, erc-modified-channels-update)
(erc-track-last-non-erc-buffer, erc-track-sort-by-importance)
(erc-track-get-active-buffer):
* lisp/erc/erc.el (erc-get-channel-user-list)
(erc-echo-notice-hook, erc-echo-notice-always-hook)
(erc-wash-quit-reason, erc-format-@nick):
* lisp/ffap.el (ffap-latex-mode):
* lisp/files.el (abort-if-file-too-large)
(dir-locals--get-sort-score, buffer-stale--default-function):
* lisp/filesets.el (filesets-tree-max-level, filesets-data)
(filesets-update-pre010505):
* lisp/gnus/gnus-agent.el (gnus-agent-flush-cache):
* lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol)
(gnus-button-prefer-mid-or-mail):
* lisp/gnus/gnus-cus.el (gnus-group-parameters):
* lisp/gnus/gnus-demon.el (gnus-demon-handlers)
(gnus-demon-run-callback):
* lisp/gnus/gnus-dired.el (gnus-dired-print):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer):
* lisp/gnus/gnus-range.el (gnus-range-normalize):
* lisp/gnus/gnus-spec.el (gnus-pad-form):
* lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud)
(gnus-server-opened, gnus-server-closed, gnus-server-denied)
(gnus-server-offline):
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir)
(gnus-refer-thread-limit-to-thread)
(gnus-summary-limit-include-thread, gnus-summary-refer-thread)
(gnus-summary-find-matching):
* lisp/gnus/gnus-util.el (gnus-rescale-image):
* lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server):
* lisp/gnus/mail-source.el (mail-source-incoming-file-prefix):
* lisp/gnus/message.el (message-cite-reply-position)
(message-cite-style-outlook, message-cite-style-thunderbird)
(message-cite-style-gmail, message--send-mail-maybe-partially):
* lisp/gnus/mm-extern.el (mm-inline-external-body):
* lisp/gnus/mm-partial.el (mm-inline-partial):
* lisp/gnus/mml-sec.el (mml-secure-message-sign)
(mml-secure-message-sign-encrypt, mml-secure-message-encrypt):
* lisp/gnus/mml2015.el (mml2015-epg-key-image)
(mml2015-epg-key-image-to-string):
* lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail):
* lisp/gnus/nnheader.el (nnheader-directory-files-is-safe):
* lisp/gnus/nnir.el (nnir-search-history)
(nnir-imap-search-other, nnir-artlist-length)
(nnir-artlist-article, nnir-artitem-group, nnir-artitem-number)
(nnir-artitem-rsv, nnir-article-group, nnir-article-number)
(nnir-article-rsv, nnir-article-ids, nnir-categorize)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-hyrex-additional-switches)
(gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms)
(nnir-read-parm, nnir-read-server-parm, nnir-search-thread):
* lisp/gnus/nnmairix.el (nnmairix-default-group)
(nnmairix-propagate-marks):
* lisp/gnus/smime.el (smime-keys, smime-crl-check)
(smime-verify-buffer, smime-noverify-buffer):
* lisp/gnus/spam-report.el (spam-report-url-ping-mm-url):
* lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header)
(spam-spamassassin-spam-status-header, spam-sa-learn-rebuild)
(spam-classifications, spam-check-stat, spam-spamassassin-score):
* lisp/help.el (describe-minor-mode-from-symbol):
* lisp/hippie-exp.el (hippie-expand-ignore-buffers):
* lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face)
(hfy-begin-span):
* lisp/ibuf-ext.el (ibuffer-update-saved-filters-format)
(ibuffer-saved-filters, ibuffer-old-saved-filters-warning)
(ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters)
(eval, ibuffer-unary-operand, file-extension, directory):
* lisp/image-dired.el (image-dired-cmd-pngcrush-options):
* lisp/image-mode.el (image-toggle-display):
* lisp/international/ccl.el (ccl-compile-read-multibyte-character)
(ccl-compile-write-multibyte-character):
* lisp/international/kkc.el (kkc-save-init-file):
* lisp/international/latin1-disp.el (latin1-display):
* lisp/international/ogonek.el (ogonek-name-encoding-alist)
(ogonek-information, ogonek-lookup-encoding)
(ogonek-deprefixify-region):
* lisp/isearch.el (isearch-filter-predicate)
(isearch--momentary-message):
* lisp/jsonrpc.el (jsonrpc-connection-send)
(jsonrpc-process-connection, jsonrpc-shutdown)
(jsonrpc--async-request-1):
* lisp/language/tibet-util.el (tibetan-char-p):
* lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date)
(feedmail-last-chance-hook, feedmail-before-fcc-hook)
(feedmail-send-it-immediately-wrapper, feedmail-find-eoh):
* lisp/mail/hashcash.el (hashcash-generate-payment)
(hashcash-generate-payment-async, hashcash-insert-payment)
(hashcash-verify-payment):
* lisp/mail/rmail.el (rmail-movemail-variant-in-use)
(rmail-get-attr-value):
* lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime):
* lisp/mail/rmailsum.el (rmail-summary-show-message):
* lisp/mail/supercite.el (sc-raw-mode-toggle):
* lisp/man.el (Man-start-calling):
* lisp/mh-e/mh-acros.el (mh-do-at-event-location)
(mh-iterate-on-messages-in-region, mh-iterate-on-range):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases)
(mh-alias-reload, mh-alias-ali)
(mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file)
(mh-alias-add-alias):
* lisp/mouse.el (mouse-save-then-kill):
* lisp/net/browse-url.el (browse-url-default-macosx-browser):
* lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value)
(eudc-variable-server-value, eudc-update-variable)
(eudc-expand-inline):
* lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result):
* lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list):
* lisp/net/pop3.el (pop3-list):
* lisp/net/soap-client.el (soap-namespace-put)
(soap-xs-parse-sequence, soap-parse-envelope):
* lisp/net/soap-inspect.el (soap-inspect-xs-complex-type):
* lisp/nxml/rng-xsd.el (rng-xsd-date-to-days):
* lisp/org/ob-C.el (org-babel-prep-session:C)
(org-babel-load-session:C):
* lisp/org/ob-J.el (org-babel-execute:J):
* lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote):
* lisp/org/ob-awk.el (org-babel-execute:awk):
* lisp/org/ob-core.el (org-babel-process-file-name):
* lisp/org/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/org/ob-forth.el (org-babel-execute:forth):
* lisp/org/ob-fortran.el (org-babel-execute:fortran)
(org-babel-prep-session:fortran, org-babel-load-session:fortran):
* lisp/org/ob-groovy.el (org-babel-execute:groovy):
* lisp/org/ob-io.el (org-babel-execute:io):
* lisp/org/ob-js.el (org-babel-execute:js):
* lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond)
(org-babel-lilypond-compile-post-tangle)
(org-babel-lilypond-display-pdf-post-tangle)
(org-babel-lilypond-tangle)
(org-babel-lilypond-execute-tangled-ly)
(org-babel-lilypond-compile-lilyfile)
(org-babel-lilypond-check-for-compile-error)
(org-babel-lilypond-process-compile-error)
(org-babel-lilypond-mark-error-line)
(org-babel-lilypond-parse-error-line)
(org-babel-lilypond-attempt-to-open-pdf)
(org-babel-lilypond-attempt-to-play-midi)
(org-babel-lilypond-switch-extension)
(org-babel-lilypond-set-header-args):
* lisp/org/ob-lua.el (org-babel-prep-session:lua):
* lisp/org/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/org/ob-processing.el (org-babel-prep-session:processing):
* lisp/org/ob-python.el (org-babel-prep-session:python):
* lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message)
(org-babel-scheme-execute-with-geiser, org-babel-execute:scheme):
* lisp/org/ob-shen.el (org-babel-execute:shen):
* lisp/org/org-agenda.el (org-agenda-entry-types)
(org-agenda-move-date-from-past-immediately-to-today)
(org-agenda-time-grid, org-agenda-sorting-strategy)
(org-agenda-filter-by-category, org-agenda-forward-block):
* lisp/org/org-colview.el (org-columns--overlay-text):
* lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces):
* lisp/org/org-indent.el (org-indent-set-line-properties):
* lisp/org/org-macs.el (org-get-limited-outline-regexp):
* lisp/org/org-mobile.el (org-mobile-files):
* lisp/org/org.el (org-use-fast-todo-selection)
(org-extend-today-until, org-use-property-inheritance)
(org-refresh-effort-properties, org-open-at-point-global)
(org-track-ordered-property-with-tag, org-shiftright):
* lisp/org/ox-html.el (org-html-checkbox-type):
* lisp/org/ox-man.el (org-man-source-highlight)
(org-man-verse-block):
* lisp/org/ox-publish.el (org-publish-sitemap-default):
* lisp/outline.el (outline-head-from-level):
* lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1)
(dcl-calc-command-indent, dcl-indent-to):
* lisp/progmodes/flymake.el (flymake-make-diagnostic)
(flymake--overlays, flymake-diagnostic-functions)
(flymake-diagnostic-types-alist, flymake--backend-state)
(flymake-is-running, flymake--collect, flymake-mode):
* lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop)
(gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer):
* lisp/progmodes/grep.el (grep-error-screen-columns):
* lisp/progmodes/gud.el (gud-prev-expr):
* lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column)
(ps-run-goto-error):
* lisp/progmodes/python.el (python-eldoc-get-doc)
(python-eldoc-function-timeout-permanent, python-eldoc-function):
* lisp/shadowfile.el (shadow-make-group):
* lisp/speedbar.el (speedbar-obj-do-check):
* lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook):
* lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib):
* lisp/textmodes/reftex-index.el (reftex-index-goto-entry)
(reftex-index-kill, reftex-index-undo):
* lisp/textmodes/reftex-parse.el (reftex-context-substring):
* lisp/textmodes/reftex.el (reftex-TeX-master-file):
* lisp/textmodes/rst.el (rst-next-hdr, rst-toc)
(rst-uncomment-region, rst-font-lock-extend-region-internal):
* lisp/thumbs.el (thumbs-mode):
* lisp/vc/ediff-util.el (ediff-restore-diff):
* lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag):
* lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p):
* lisp/wid-edit.el (widget-field-value-set, string):
* lisp/x-dnd.el (x-dnd-version-from-flags)
(x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-21 00:27:53 +02:00
|
|
|
operator, half-op, admin or owner. Owners have \"~\", admins have
|
2014-11-08 20:51:43 -05:00
|
|
|
\"&\", operators have \"@\" and users with voice have \"+\" as a
|
|
|
|
prefix. Use CHANNEL-DATA to determine op and voice status. See
|
|
|
|
also `erc-format-nick-function'."
|
|
|
|
(when user
|
|
|
|
(let ((nick (erc-server-user-nickname user)))
|
Make more erc function aliases obsolete
* lisp/erc/erc-compat.el (erc-propertize, erc-view-mode-enter)
(erc-function-arglist, erc-delete-dups)
(erc-replace-regexp-in-string): Make these aliases obsolete.
* lisp/erc/erc-capab.el (erc-capab-identify-add-prefix)
(erc-capab-identify-remove/set-identified-flag):
* lisp/erc/erc-dcc.el (erc-dcc-chat-parse-output)
(erc-dcc-unquote-filename, pcomplete/erc-mode/DCC):
* lisp/erc/erc-list.el (erc-list-menu-mode, erc-list-button)
(erc-list-make-string):
* lisp/erc/erc-log.el (erc-log-standardize-name):
* lisp/erc/erc-match.el (erc-log-matches-make-buffer):
* lisp/erc/erc-networks.el (erc-server-select):
* lisp/erc/erc.el (erc-message-english-PART)
(erc-update-mode-line-buffer, erc-format-my-nick)
(erc-format-@nick, erc-get-user-mode-prefix, erc-display-prompt)
(erc-part-reason-zippy, erc-quit-reason-zippy, erc-get-arglist)
(erc-toggle-debug-irc-protocol, erc-log-irc-protocol)
(erc-migrate-modules): Adjust callers.
2020-08-07 13:54:50 +02:00
|
|
|
(concat (propertize
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-get-user-mode-prefix nick)
|
2016-04-07 14:23:18 +02:00
|
|
|
'font-lock-face 'erc-nick-prefix-face)
|
2014-11-08 20:51:43 -05:00
|
|
|
nick))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-format-my-nick ()
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
"Return the beginning of this user's message, correctly propertized."
|
2006-01-29 13:08:58 +00:00
|
|
|
(if erc-show-my-nick
|
2014-11-08 20:51:43 -05:00
|
|
|
(let* ((open "<")
|
|
|
|
(close "> ")
|
|
|
|
(nick (erc-current-nick))
|
|
|
|
(mode (erc-get-user-mode-prefix nick)))
|
|
|
|
(concat
|
Make more erc function aliases obsolete
* lisp/erc/erc-compat.el (erc-propertize, erc-view-mode-enter)
(erc-function-arglist, erc-delete-dups)
(erc-replace-regexp-in-string): Make these aliases obsolete.
* lisp/erc/erc-capab.el (erc-capab-identify-add-prefix)
(erc-capab-identify-remove/set-identified-flag):
* lisp/erc/erc-dcc.el (erc-dcc-chat-parse-output)
(erc-dcc-unquote-filename, pcomplete/erc-mode/DCC):
* lisp/erc/erc-list.el (erc-list-menu-mode, erc-list-button)
(erc-list-make-string):
* lisp/erc/erc-log.el (erc-log-standardize-name):
* lisp/erc/erc-match.el (erc-log-matches-make-buffer):
* lisp/erc/erc-networks.el (erc-server-select):
* lisp/erc/erc.el (erc-message-english-PART)
(erc-update-mode-line-buffer, erc-format-my-nick)
(erc-format-@nick, erc-get-user-mode-prefix, erc-display-prompt)
(erc-part-reason-zippy, erc-quit-reason-zippy, erc-get-arglist)
(erc-toggle-debug-irc-protocol, erc-log-irc-protocol)
(erc-migrate-modules): Adjust callers.
2020-08-07 13:54:50 +02:00
|
|
|
(propertize open 'font-lock-face 'erc-default-face)
|
|
|
|
(propertize mode 'font-lock-face 'erc-my-nick-prefix-face)
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(propertize nick 'font-lock-face 'erc-my-nick-face 'erc--speaker nick)
|
Make more erc function aliases obsolete
* lisp/erc/erc-compat.el (erc-propertize, erc-view-mode-enter)
(erc-function-arglist, erc-delete-dups)
(erc-replace-regexp-in-string): Make these aliases obsolete.
* lisp/erc/erc-capab.el (erc-capab-identify-add-prefix)
(erc-capab-identify-remove/set-identified-flag):
* lisp/erc/erc-dcc.el (erc-dcc-chat-parse-output)
(erc-dcc-unquote-filename, pcomplete/erc-mode/DCC):
* lisp/erc/erc-list.el (erc-list-menu-mode, erc-list-button)
(erc-list-make-string):
* lisp/erc/erc-log.el (erc-log-standardize-name):
* lisp/erc/erc-match.el (erc-log-matches-make-buffer):
* lisp/erc/erc-networks.el (erc-server-select):
* lisp/erc/erc.el (erc-message-english-PART)
(erc-update-mode-line-buffer, erc-format-my-nick)
(erc-format-@nick, erc-get-user-mode-prefix, erc-display-prompt)
(erc-part-reason-zippy, erc-quit-reason-zippy, erc-get-arglist)
(erc-toggle-debug-irc-protocol, erc-log-irc-protocol)
(erc-migrate-modules): Adjust callers.
2020-08-07 13:54:50 +02:00
|
|
|
(propertize close 'font-lock-face 'erc-default-face)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((prefix "> "))
|
Make more erc function aliases obsolete
* lisp/erc/erc-compat.el (erc-propertize, erc-view-mode-enter)
(erc-function-arglist, erc-delete-dups)
(erc-replace-regexp-in-string): Make these aliases obsolete.
* lisp/erc/erc-capab.el (erc-capab-identify-add-prefix)
(erc-capab-identify-remove/set-identified-flag):
* lisp/erc/erc-dcc.el (erc-dcc-chat-parse-output)
(erc-dcc-unquote-filename, pcomplete/erc-mode/DCC):
* lisp/erc/erc-list.el (erc-list-menu-mode, erc-list-button)
(erc-list-make-string):
* lisp/erc/erc-log.el (erc-log-standardize-name):
* lisp/erc/erc-match.el (erc-log-matches-make-buffer):
* lisp/erc/erc-networks.el (erc-server-select):
* lisp/erc/erc.el (erc-message-english-PART)
(erc-update-mode-line-buffer, erc-format-my-nick)
(erc-format-@nick, erc-get-user-mode-prefix, erc-display-prompt)
(erc-part-reason-zippy, erc-quit-reason-zippy, erc-get-arglist)
(erc-toggle-debug-irc-protocol, erc-log-irc-protocol)
(erc-migrate-modules): Adjust callers.
2020-08-07 13:54:50 +02:00
|
|
|
(propertize prefix 'font-lock-face 'erc-default-face))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-echo-notice-in-default-buffer (s parsed buffer _sender)
|
2021-09-14 08:43:18 +02:00
|
|
|
"Echo a private notice in the default buffer, namely the
|
2006-01-29 13:08:58 +00:00
|
|
|
target buffer specified by BUFFER, or there is no target buffer,
|
|
|
|
the server buffer. This function is designed to be added to
|
|
|
|
either `erc-echo-notice-hook' or `erc-echo-notice-always-hook',
|
|
|
|
and always returns t."
|
|
|
|
(erc-display-message parsed nil buffer s)
|
|
|
|
t)
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-echo-notice-in-target-buffer (s parsed buffer _sender)
|
2021-09-14 08:43:18 +02:00
|
|
|
"Echo a private notice in BUFFER, if BUFFER is non-nil.
|
|
|
|
This function is designed to be added to either
|
|
|
|
`erc-echo-notice-hook' or `erc-echo-notice-always-hook', and
|
|
|
|
returns non-nil if BUFFER is non-nil."
|
2006-01-29 13:08:58 +00:00
|
|
|
(if buffer
|
|
|
|
(progn (erc-display-message parsed nil buffer s) t)
|
|
|
|
nil))
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-echo-notice-in-minibuffer (s _parsed _buffer _sender)
|
2021-09-14 08:43:18 +02:00
|
|
|
"Echo a private notice in the minibuffer.
|
|
|
|
This function is designed to be added to either
|
|
|
|
`erc-echo-notice-hook' or `erc-echo-notice-always-hook', and
|
|
|
|
always returns t."
|
2006-01-29 13:08:58 +00:00
|
|
|
(message "%s" (concat "NOTICE: " s))
|
|
|
|
t)
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-echo-notice-in-server-buffer (s parsed _buffer _sender)
|
2021-09-14 08:43:18 +02:00
|
|
|
"Echo a private notice in the server buffer.
|
|
|
|
This function is designed to be added to either
|
|
|
|
`erc-echo-notice-hook' or `erc-echo-notice-always-hook', and
|
|
|
|
always returns t."
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-display-message parsed nil nil s)
|
|
|
|
t)
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-echo-notice-in-active-non-server-buffer (s parsed _buffer _sender)
|
2021-09-14 08:43:18 +02:00
|
|
|
"Echo a private notice in the active buffer if the active
|
2006-01-29 13:08:58 +00:00
|
|
|
buffer is not the server buffer. This function is designed to be
|
|
|
|
added to either `erc-echo-notice-hook' or
|
2007-08-08 07:18:57 +00:00
|
|
|
`erc-echo-notice-always-hook', and returns non-nil if the active
|
2006-01-29 13:08:58 +00:00
|
|
|
buffer is not the server buffer."
|
|
|
|
(if (not (eq (erc-server-buffer) (erc-active-buffer)))
|
|
|
|
(progn (erc-display-message parsed nil 'active s) t)
|
|
|
|
nil))
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-echo-notice-in-active-buffer (s parsed _buffer _sender)
|
2021-09-14 08:43:18 +02:00
|
|
|
"Echo a private notice in the active buffer.
|
|
|
|
This function is designed to be added to either
|
|
|
|
`erc-echo-notice-hook' or `erc-echo-notice-always-hook', and
|
|
|
|
always returns t."
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-display-message parsed nil 'active s)
|
|
|
|
t)
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-echo-notice-in-user-buffers (s parsed _buffer sender)
|
2021-09-19 12:59:01 +02:00
|
|
|
"Echo a private notice in all of the buffers for which SENDER is a member.
|
|
|
|
This function is designed to be added to either
|
2006-01-29 13:08:58 +00:00
|
|
|
`erc-echo-notice-hook' or `erc-echo-notice-always-hook', and
|
2007-08-08 07:18:57 +00:00
|
|
|
returns non-nil if there is at least one buffer for which the
|
2006-01-29 13:08:58 +00:00
|
|
|
sender is a member.
|
|
|
|
|
|
|
|
See also: `erc-echo-notice-in-first-user-buffer',
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
`erc-buffer-list-with-nick'."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((buffers (erc-buffer-list-with-nick sender erc-server-process)))
|
|
|
|
(if buffers
|
2014-11-08 20:51:43 -05:00
|
|
|
(progn (erc-display-message parsed nil buffers s) t)
|
2006-01-29 13:08:58 +00:00
|
|
|
nil)))
|
|
|
|
|
|
|
|
(defun erc-echo-notice-in-user-and-target-buffers (s parsed buffer sender)
|
2021-09-19 12:59:01 +02:00
|
|
|
"Echo a private notice in BUFFER and in all buffers for which SENDER is a member.
|
|
|
|
This function is designed to be added to either
|
|
|
|
`erc-echo-notice-hook' or `erc-echo-notice-always-hook', and
|
|
|
|
returns non-nil if there is at least one buffer for which the
|
|
|
|
sender is a member or the default target.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
See also: `erc-echo-notice-in-user-buffers',
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
`erc-buffer-list-with-nick'."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((buffers (erc-buffer-list-with-nick sender erc-server-process)))
|
2013-08-22 00:06:45 -04:00
|
|
|
(unless (memq buffer buffers) (push buffer buffers))
|
2014-11-08 20:51:43 -05:00
|
|
|
(if buffers ;FIXME: How could it be nil?
|
|
|
|
(progn (erc-display-message parsed nil buffers s) t)
|
2006-01-29 13:08:58 +00:00
|
|
|
nil)))
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-echo-notice-in-first-user-buffer (s parsed _buffer sender)
|
2021-09-19 12:59:01 +02:00
|
|
|
"Echo a private notice in one of the buffers for which SENDER is a member.
|
|
|
|
This function is designed to be added to either
|
2006-01-29 13:08:58 +00:00
|
|
|
`erc-echo-notice-hook' or `erc-echo-notice-always-hook', and
|
2007-08-08 07:18:57 +00:00
|
|
|
returns non-nil if there is at least one buffer for which the
|
2006-01-29 13:08:58 +00:00
|
|
|
sender is a member.
|
|
|
|
|
|
|
|
See also: `erc-echo-notice-in-user-buffers',
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
`erc-buffer-list-with-nick'."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((buffers (erc-buffer-list-with-nick sender erc-server-process)))
|
|
|
|
(if buffers
|
2014-11-08 20:51:43 -05:00
|
|
|
(progn (erc-display-message parsed nil (car buffers) s) t)
|
2006-01-29 13:08:58 +00:00
|
|
|
nil)))
|
|
|
|
|
|
|
|
;;; Ban manipulation
|
|
|
|
|
|
|
|
(defun erc-banlist-store (proc parsed)
|
|
|
|
"Record ban entries for a channel."
|
Use cl-lib instead of cl, and interactive-p => called-interactively-p.
* lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
called-interactively-p instead of cl.
* lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
* lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
* lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
* lisp/erc/erc-capab.el: Don't require cl since we don't use it.
* lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
(erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
* lisp/json.el: Don't require cl since we don't use it.
* lisp/color.el: Don't require cl.
(color-complement): `caddr' -> `nth 2'.
* test/automated/ert-x-tests.el: Use cl-lib.
* test/automated/ert-tests.el: Use lexical-binding and cl-lib.
2012-11-19 12:24:12 -05:00
|
|
|
(pcase-let ((`(,channel ,mask ,whoset)
|
2014-11-08 20:51:43 -05:00
|
|
|
(cdr (erc-response.command-args parsed))))
|
2006-01-29 13:08:58 +00:00
|
|
|
;; Determine to which buffer the message corresponds
|
|
|
|
(let ((buffer (erc-get-buffer channel proc)))
|
|
|
|
(with-current-buffer buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(unless (member (cons whoset mask) erc-channel-banlist)
|
|
|
|
(setq erc-channel-banlist (cons (cons whoset mask)
|
|
|
|
erc-channel-banlist))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
nil)
|
|
|
|
|
|
|
|
(defun erc-banlist-finished (proc parsed)
|
|
|
|
"Record that we have received the banlist."
|
Use cl-lib instead of cl, and interactive-p => called-interactively-p.
* lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
called-interactively-p instead of cl.
* lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
* lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
* lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
* lisp/erc/erc-capab.el: Don't require cl since we don't use it.
* lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
(erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
* lisp/json.el: Don't require cl since we don't use it.
* lisp/color.el: Don't require cl.
(color-complement): `caddr' -> `nth 2'.
* test/automated/ert-x-tests.el: Use cl-lib.
* test/automated/ert-tests.el: Use lexical-binding and cl-lib.
2012-11-19 12:24:12 -05:00
|
|
|
(let* ((channel (nth 1 (erc-response.command-args parsed)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(buffer (erc-get-buffer channel proc)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(with-current-buffer buffer
|
|
|
|
(put 'erc-channel-banlist 'received-from-server t)))
|
2014-11-08 20:51:43 -05:00
|
|
|
t) ; suppress the 'end of banlist' message
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-banlist-update (proc parsed)
|
|
|
|
"Check MODE commands for bans and update the banlist appropriately."
|
|
|
|
;; FIXME: Possibly incorrect. -- Lawrence 2004-05-11
|
Use cl-lib instead of cl, and interactive-p => called-interactively-p.
* lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
called-interactively-p instead of cl.
* lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
* lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
* lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
* lisp/erc/erc-capab.el: Don't require cl since we don't use it.
* lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
(erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
* lisp/json.el: Don't require cl since we don't use it.
* lisp/color.el: Don't require cl.
(color-complement): `caddr' -> `nth 2'.
* test/automated/ert-x-tests.el: Use cl-lib.
* test/automated/ert-tests.el: Use lexical-binding and cl-lib.
2012-11-19 12:24:12 -05:00
|
|
|
(let* ((tgt (car (erc-response.command-args parsed)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(mode (erc-response.contents parsed))
|
|
|
|
(whoset (erc-response.sender parsed))
|
|
|
|
(buffer (erc-get-buffer tgt proc)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(when buffer
|
|
|
|
(with-current-buffer buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(cond ((not (get 'erc-channel-banlist 'received-from-server)) nil)
|
|
|
|
((string-match "^\\([+-]\\)b" mode)
|
|
|
|
;; This is a ban
|
|
|
|
(cond
|
|
|
|
((string-match "^-" mode)
|
|
|
|
;; Remove the unbanned masks from the ban list
|
|
|
|
(setq erc-channel-banlist
|
2020-08-12 19:32:52 +02:00
|
|
|
(cl-delete-if
|
2021-04-09 00:04:13 +02:00
|
|
|
(lambda (y)
|
|
|
|
(member (upcase (cdr y))
|
|
|
|
(mapcar #'upcase
|
|
|
|
(cdr (split-string mode)))))
|
2014-11-08 20:51:43 -05:00
|
|
|
erc-channel-banlist)))
|
Fix regular-expression glitches and typos
Problems reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2019-03/msg00085.html
* admin/admin.el (set-version):
* lisp/allout.el (allout-latexify-one-item):
* lisp/arc-mode.el (archive-arc-rename-entry)
(archive-rar-summarize):
* lisp/calc/calc-graph.el (calc-graph-set-styles)
(calc-graph-hide):
* lisp/calc/calc-help.el (calc-describe-key):
* lisp/calc/calc-lang.el (math-compose-tex-func, eqn):
* lisp/calc/calc.el (calcDigit-key):
* lisp/cedet/ede/makefile-edit.el (makefile-macro-file-list):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/comint.el (comint-substitute-in-file-name):
* lisp/dired.el (dired-actual-switches):
* lisp/emacs-lisp/chart.el (chart-rmail-from):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/rx.el (rx-not, rx-atomic-p):
* lisp/emulation/viper-ex.el (viper-get-ex-token)
(viper-get-ex-pat, ex-set-read-variable):
* lisp/epg.el (epg--status-SIG_CREATED):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-user):
(erc-speedbar-expand-channel, erc-speedbar-expand-server)
* lisp/erc/erc.el (erc-is-message-ctcp-and-not-action-p)
(erc-banlist-update):
* lisp/eshell/em-dirs.el (eshell-parse-drive-letter, eshell/pwd):
* lisp/find-dired.el (find-dired):
* lisp/frame.el (frame-set-background-mode):
* lisp/generic-x.el (apache-log-generic-mode):
* lisp/gnus/gnus-art.el (gnus-button-valid-localpart-regexp):
* lisp/gnus/gnus.el (gnus-short-group-name):
* lisp/gnus/message.el (message-mailer-swallows-blank-line):
* lisp/ibuffer.el (ibuffer-fontification-alist):
* lisp/ido.el (ido-set-matches-1):
* lisp/info-xref.el (info-xref-lock-file-p):
* lisp/info.el (Info-dir-remove-duplicates)
(Info-unescape-quotes, Info-split-parameter-string)
(Info-speedbar-expand-node):
* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/language/ethio-util.el (ethio-fidel-to-tex-buffer):
* lisp/mail/rmail.el (rmail-collect-deleted):
* lisp/mh-e/mh-alias.el (mh-alias-suggest-alias):
* lisp/mh-e/mh-comp.el (mh-forward):
* lisp/mh-e/mh-search.el (mh-index-next-folder)
(mh-index-create-imenu-index):
* lisp/mh-e/mh-xface.el (mh-picon-get-image):
* lisp/minibuffer.el (completion--embedded-envvar-re):
* lisp/net/ange-ftp.el (ange-ftp-ls-parser):
* lisp/net/goto-addr.el (goto-address-mail-regexp)
(goto-address-find-address-at-point):
* lisp/net/pop3.el (pop3-read-response, pop3-user)
(pop3-pass, pop3-apop):
* lisp/net/tramp.el (tramp-ipv6-regexp)
(tramp-replace-environment-variables):
* lisp/nxml/nxml-maint.el (nxml-insert-target-repertoire-glyph-set):
* lisp/nxml/rng-uri.el (rng-uri-escape-multibyte):
* lisp/nxml/rng-xsd.el (rng-xsd-convert-any-uri):
* lisp/obsolete/pgg.el (pgg-fetch-key):
* lisp/obsolete/vip.el (vip-get-ex-token):
* lisp/org/ob-core.el (org-babel-string-read):
* lisp/org/org-agenda.el:
(org-agenda-add-entry-to-org-agenda-diary-file):
* lisp/org/org-element.el (org-element-keyword-parser):
* lisp/org/org-list.el (org-list-indent-item-generic):
* lisp/org/org-mhe.el (org-mhe-get-message-folder-from-index):
* lisp/org/org-mobile.el (org-mobile-apply):
* lisp/org/org-mouse.el (org-mouse-context-menu):
* lisp/org/org-plot.el (org-plot/gnuplot):
* lisp/org/org-protocol.el (org-protocol-flatten-greedy):
* lisp/org/org-table.el (org-table-copy-down)
(org-table-formula-make-cmp-string)
(org-table-get-stored-formulas, org-table-recalculate)
(org-table-edit-formulas):
* lisp/org/org.el (org-translate-link-from-planner)
(org-fill-line-break-nobreak-p):
* lisp/org/ox-ascii.el (org-ascii-item):
* lisp/org/ox-latex.el (org-latex-clean-invalid-line-breaks):
* lisp/org/ox.el (org-export-expand-include-keyword):
* lisp/progmodes/ada-xref.el (ada-treat-cmd-string):
* lisp/progmodes/cfengine.el (cfengine2-font-lock-keywords):
* lisp/progmodes/cperl-mode.el (cperl-to-comment-or-eol)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-have-help-regexp, cperl-word-at-point-hard)
(cperl-make-regexp-x):
* lisp/progmodes/dcl-mode.el (dcl-option-value-offset):
* lisp/progmodes/etags.el (tag-implicit-name-match-p):
* lisp/progmodes/fortran.el (fortran-fill):
* lisp/progmodes/gdb-mi.el (gdb-speedbar-expand-node)
(gdb-locals-handler-custom):
* lisp/progmodes/grep.el (grep-mode-font-lock-keywords):
* lisp/progmodes/gud.el (gud-jdb-find-source-using-classpath):
* lisp/progmodes/js.el (js--continued-expression-p):
* lisp/progmodes/m4-mode.el (m4-font-lock-keywords):
* lisp/progmodes/meta-mode.el (meta-indent-level-count):
* lisp/progmodes/mixal-mode.el (mixal-font-lock-keywords):
* lisp/progmodes/opascal.el (opascal-find-unit-in-directory):
* lisp/progmodes/pascal.el (pascal-progbeg-re):
* lisp/progmodes/ruby-mode.el (ruby-expression-expansion-re)
(ruby-expr-beg, ruby-parse-partial)
(ruby-toggle-string-quotes, ruby-font-lock-keywords):
* lisp/progmodes/sql.el (sql--make-help-docstring):
* lisp/progmodes/verilog-mode.el (verilog-coverpoint-re)
(verilog-skip-forward-comment-p)
(verilog-read-sub-decls-gate)
(verilog-read-auto-template-middle):
* lisp/progmodes/vhdl-mode.el (vhdl-resolve-env-variable)
(vhdl-speedbar-expand-project, vhdl-speedbar-expand-entity)
(vhdl-speedbar-expand-architecture)
(vhdl-speedbar-expand-config, vhdl-speedbar-expand-package)
(vhdl-speedbar-dired):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/textmodes/dns-mode.el (dns-mode-font-lock-keywords):
* lisp/textmodes/flyspell.el (flyspell-debug-signal-word-checked):
* lisp/textmodes/ispell.el (ispell-process-line):
* lisp/textmodes/reftex-cite.el (reftex-end-of-bib-entry):
* lisp/textmodes/reftex-ref.el (reftex-replace-prefix-escapes):
* lisp/url/url-parse.el (url-generic-parse-url):
* lisp/url/url-util.el (url-truncate-url-for-viewing):
* lisp/vc/diff-mode.el (diff-unified->context):
* lisp/vc/vc-bzr.el (vc-bzr-error-regexp-alist):
* lisp/vc/vc-cvs.el (vc-cvs-parse-status):
* lisp/woman.el (woman0-el, woman-if-ignore)
(woman-change-fonts):
* lisp/xdg.el (xdg--substitute-home-env):
Fix regular-expression infelicities and typos.
Fix regular expression typos
Fix typos reported by Mattias Engdegård in:
that occurred in preloaded modules.
* lisp/frame.el (frame-set-background-mode):
* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/minibuffer.el (completion--embedded-envvar-re):
2019-03-04 18:00:00 -08:00
|
|
|
((string-match "^\\+" mode)
|
2014-11-08 20:51:43 -05:00
|
|
|
;; Add the banned mask(s) to the ban list
|
|
|
|
(mapc
|
|
|
|
(lambda (mask)
|
|
|
|
(unless (member (cons whoset mask) erc-channel-banlist)
|
|
|
|
(setq erc-channel-banlist
|
|
|
|
(cons (cons whoset mask) erc-channel-banlist))))
|
|
|
|
(cdr (split-string mode))))))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
nil)
|
|
|
|
|
|
|
|
;; used for the banlist cmds
|
|
|
|
(defun erc-group-list (list n)
|
|
|
|
"Group LIST into sublists of length N."
|
|
|
|
(cond ((null list) nil)
|
2014-11-08 20:51:43 -05:00
|
|
|
((null (nthcdr n list)) (list list))
|
2020-08-12 19:32:52 +02:00
|
|
|
(t (cons (cl-subseq list 0 n) (erc-group-list (nthcdr n list) n)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
;;; MOTD numreplies
|
|
|
|
|
|
|
|
(defun erc-handle-login ()
|
|
|
|
"Handle the logging in process of connection."
|
|
|
|
(unless erc-logged-in
|
|
|
|
(setq erc-logged-in t)
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
(message "Logging in as `%s'... done" (erc-current-nick))
|
2006-01-29 13:08:58 +00:00
|
|
|
;; execute a startup script
|
|
|
|
(let ((f (erc-select-startup-file)))
|
|
|
|
(when f
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-load-script f)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-connection-established (proc parsed)
|
2023-10-15 13:20:07 -07:00
|
|
|
"Set user mode and run `erc-after-connect' hook in server buffer."
|
2007-04-01 13:36:38 +00:00
|
|
|
(with-current-buffer (process-buffer proc)
|
|
|
|
(unless erc-server-connected ; only once per session
|
|
|
|
(let ((server (or erc-server-announced-name
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-response.sender parsed)))
|
|
|
|
(nick (car (erc-response.command-args parsed)))
|
|
|
|
(buffer (process-buffer proc)))
|
|
|
|
(setq erc-server-connected t)
|
2021-11-18 23:39:54 -08:00
|
|
|
(setq erc--server-last-reconnect-count erc-server-reconnect-count
|
|
|
|
erc-server-reconnect-count 0)
|
2023-04-20 19:20:59 -07:00
|
|
|
(setq erc--server-reconnect-display-timer
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(run-at-time erc-auto-reconnect-display-timeout nil
|
2023-04-20 19:20:59 -07:00
|
|
|
#'erc--server-last-reconnect-display-reset
|
|
|
|
(current-buffer)))
|
|
|
|
(add-hook 'erc-disconnected-hook
|
|
|
|
#'erc--server-last-reconnect-on-disconnect nil t)
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-update-mode-line)
|
|
|
|
(erc-set-initial-user-mode nick buffer)
|
|
|
|
(erc-server-setup-periodical-ping buffer)
|
2023-10-15 13:20:07 -07:00
|
|
|
(when erc-unhide-query-prompt
|
|
|
|
(erc-with-all-buffers-of-server erc-server-process nil
|
|
|
|
(when (and erc--target (not (erc--target-channel-p erc--target)))
|
|
|
|
(erc--unhide-prompt))))
|
|
|
|
(run-hook-with-args 'erc-after-connect server nick)))))
|
2007-04-01 13:36:38 +00:00
|
|
|
|
|
|
|
(defun erc-set-initial-user-mode (nick buffer)
|
|
|
|
"If `erc-user-mode' is non-nil for NICK, set the user modes.
|
|
|
|
The server buffer is given by BUFFER."
|
|
|
|
(with-current-buffer buffer
|
|
|
|
(when erc-user-mode
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(let* ((mode (if (functionp erc-user-mode)
|
|
|
|
(funcall erc-user-mode)
|
|
|
|
erc-user-mode))
|
|
|
|
(groups (erc--parse-user-modes mode (erc--user-modes) t))
|
|
|
|
(superfluous (last groups 2))
|
|
|
|
(redundant-want (car superfluous))
|
|
|
|
(redundant-drop (cadr superfluous)))
|
|
|
|
(when redundant-want
|
|
|
|
(erc-display-message nil 'notice buffer 'user-mode-redundant-add
|
|
|
|
?m (apply #'string redundant-want)))
|
|
|
|
(when redundant-drop
|
|
|
|
(erc-display-message nil 'notice buffer 'user-mode-redundant-drop
|
|
|
|
?m (apply #'string redundant-drop)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(when (stringp mode)
|
|
|
|
(erc-log (format "changing mode for %s to %s" nick mode))
|
|
|
|
(erc-server-send (format "MODE %s %s" nick mode)))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-display-error-notice (parsed string)
|
|
|
|
"Display STRING as an error notice.
|
|
|
|
|
|
|
|
See also `erc-display-message'."
|
|
|
|
(erc-display-message
|
|
|
|
parsed '(notice error) 'active string))
|
|
|
|
|
|
|
|
(defun erc-process-ctcp-query (proc parsed nick login host)
|
|
|
|
;; FIXME: This needs a proper docstring -- Lawrence 2004-01-08
|
|
|
|
"Process a CTCP query."
|
|
|
|
(let ((queries (delete "" (split-string (erc-response.contents parsed)
|
2014-11-08 20:51:43 -05:00
|
|
|
"\C-a"))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (> (length queries) 4)
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-display-message
|
|
|
|
parsed (list 'notice 'error) proc 'ctcp-too-many)
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (= 0 (length queries))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-display-message
|
|
|
|
parsed (list 'notice 'error) proc
|
|
|
|
'ctcp-empty ?n nick)
|
|
|
|
(while queries
|
|
|
|
(let* ((type (upcase (car (split-string (car queries)))))
|
2023-06-24 18:33:20 -07:00
|
|
|
(hook (intern-soft (concat "erc-ctcp-query-" type "-hook")))
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(erc--msg-prop-overrides `((erc--msg . msg)
|
|
|
|
(erc--ctcp . ,(intern type))
|
2023-09-02 13:43:22 -07:00
|
|
|
,@erc--msg-prop-overrides)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(if (and hook (boundp hook))
|
|
|
|
(if (string-equal type "ACTION")
|
|
|
|
(run-hook-with-args-until-success
|
|
|
|
hook proc parsed nick login host
|
|
|
|
(car (erc-response.command-args parsed))
|
|
|
|
(car queries))
|
|
|
|
(when erc-paranoid
|
|
|
|
(if (erc-current-nick-p
|
|
|
|
(car (erc-response.command-args parsed)))
|
|
|
|
(erc-display-message
|
|
|
|
parsed 'error 'active 'ctcp-request
|
|
|
|
?n nick ?u login ?h host ?r (car queries))
|
|
|
|
(erc-display-message
|
|
|
|
parsed 'error 'active 'ctcp-request-to
|
|
|
|
?n nick ?u login ?h host ?r (car queries)
|
|
|
|
?t (car (erc-response.command-args parsed)))))
|
|
|
|
(run-hook-with-args-until-success
|
|
|
|
hook proc nick login host
|
|
|
|
(car (erc-response.command-args parsed))
|
|
|
|
(car queries)))
|
|
|
|
(erc-display-message
|
|
|
|
parsed (list 'notice 'error) proc
|
|
|
|
'undefined-ctcp)))
|
|
|
|
(setq queries (cdr queries)))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defvar erc-ctcp-query-ACTION-hook '(erc-ctcp-query-ACTION))
|
|
|
|
|
|
|
|
(defun erc-ctcp-query-ACTION (proc parsed nick login host to msg)
|
|
|
|
"Respond to a CTCP ACTION query."
|
|
|
|
(when (string-match "^ACTION\\s-\\(.*\\)\\s-*$" msg)
|
|
|
|
(let ((s (match-string 1 msg))
|
2014-11-08 20:51:43 -05:00
|
|
|
(buf (or (erc-get-buffer to proc)
|
|
|
|
(erc-get-buffer nick proc)
|
|
|
|
(process-buffer proc))))
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(setq nick (propertize nick 'erc--speaker nick))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-display-message
|
|
|
|
parsed 'action buf
|
|
|
|
'ACTION ?n nick ?u login ?h host ?a s))))
|
|
|
|
|
|
|
|
(defvar erc-ctcp-query-CLIENTINFO-hook '(erc-ctcp-query-CLIENTINFO))
|
|
|
|
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-query-CLIENTINFO (_proc nick _login _host _to msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Respond to a CTCP CLIENTINFO query."
|
|
|
|
(when (string-match "^CLIENTINFO\\(\\s-*\\|\\s-+.*\\)$" msg)
|
|
|
|
(let ((s (erc-client-info (erc-trim-string (match-string 1 msg)))))
|
|
|
|
(unless erc-disable-ctcp-replies
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-send-ctcp-notice nick (format "CLIENTINFO %s" s)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
nil)
|
|
|
|
|
|
|
|
(defvar erc-ctcp-query-ECHO-hook '(erc-ctcp-query-ECHO))
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-query-ECHO (_proc nick _login _host _to msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Respond to a CTCP ECHO query."
|
|
|
|
(when (string-match "^ECHO\\s-+\\(.*\\)\\s-*$" msg)
|
|
|
|
(let ((s (match-string 1 msg)))
|
|
|
|
(unless erc-disable-ctcp-replies
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-send-ctcp-notice nick (format "ECHO %s" s)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
nil)
|
|
|
|
|
|
|
|
(defvar erc-ctcp-query-FINGER-hook '(erc-ctcp-query-FINGER))
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-query-FINGER (_proc nick _login _host _to _msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Respond to a CTCP FINGER query."
|
|
|
|
(unless erc-disable-ctcp-replies
|
|
|
|
(let ((s (if erc-anonymous-login
|
2014-11-08 20:51:43 -05:00
|
|
|
(format "FINGER I'm %s." (erc-current-nick))
|
|
|
|
(format "FINGER %s (%s@%s)."
|
|
|
|
(user-full-name)
|
|
|
|
(user-login-name)
|
|
|
|
(system-name))))
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-22 18:32:31 -08:00
|
|
|
(ns (erc-time-diff erc-server-last-sent-time nil)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(when (> ns 0)
|
|
|
|
(setq s (concat s " Idle for " (erc-sec-to-time ns))))
|
|
|
|
(erc-send-ctcp-notice nick s)))
|
2006-01-29 13:08:58 +00:00
|
|
|
nil)
|
|
|
|
|
|
|
|
(defvar erc-ctcp-query-PING-hook '(erc-ctcp-query-PING))
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-query-PING (_proc nick _login _host _to msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Respond to a CTCP PING query."
|
|
|
|
(when (string-match "^PING\\s-+\\(.*\\)" msg)
|
|
|
|
(unless erc-disable-ctcp-replies
|
|
|
|
(let ((arg (match-string 1 msg)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-send-ctcp-notice nick (format "PING %s" arg)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
nil)
|
|
|
|
|
|
|
|
(defvar erc-ctcp-query-TIME-hook '(erc-ctcp-query-TIME))
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-query-TIME (_proc nick _login _host _to _msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Respond to a CTCP TIME query."
|
|
|
|
(unless erc-disable-ctcp-replies
|
|
|
|
(erc-send-ctcp-notice nick (format "TIME %s" (current-time-string))))
|
|
|
|
nil)
|
|
|
|
|
|
|
|
(defvar erc-ctcp-query-USERINFO-hook '(erc-ctcp-query-USERINFO))
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-query-USERINFO (_proc nick _login _host _to _msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Respond to a CTCP USERINFO query."
|
|
|
|
(unless erc-disable-ctcp-replies
|
|
|
|
(erc-send-ctcp-notice nick (format "USERINFO %s" erc-user-information)))
|
|
|
|
nil)
|
|
|
|
|
|
|
|
(defvar erc-ctcp-query-VERSION-hook '(erc-ctcp-query-VERSION))
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-query-VERSION (_proc nick _login _host _to _msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Respond to a CTCP VERSION query."
|
|
|
|
(unless erc-disable-ctcp-replies
|
|
|
|
(erc-send-ctcp-notice
|
|
|
|
nick (format
|
2021-10-06 21:50:56 -04:00
|
|
|
"VERSION %s (\C-b%s\C-b)"
|
|
|
|
(erc-version nil 'bold-erc)
|
2014-11-08 20:51:43 -05:00
|
|
|
erc-official-location)))
|
2006-01-29 13:08:58 +00:00
|
|
|
nil)
|
|
|
|
|
|
|
|
(defun erc-process-ctcp-reply (proc parsed nick login host msg)
|
|
|
|
"Process MSG as a CTCP reply."
|
|
|
|
(let* ((type (car (split-string msg)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(hook (intern (concat "erc-ctcp-reply-" type "-hook"))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (boundp hook)
|
2014-11-08 20:51:43 -05:00
|
|
|
(run-hook-with-args-until-success
|
|
|
|
hook proc nick login host
|
|
|
|
(car (erc-response.command-args parsed)) msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-display-message
|
|
|
|
parsed 'notice 'active
|
|
|
|
'CTCP-UNKNOWN ?n nick ?u login ?h host ?m msg))))
|
|
|
|
|
|
|
|
(defvar erc-ctcp-reply-ECHO-hook '(erc-ctcp-reply-ECHO))
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-reply-ECHO (_proc nick _login _host _to msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Handle a CTCP ECHO reply."
|
|
|
|
(when (string-match "^ECHO\\s-+\\(.*\\)\\s-*$" msg)
|
|
|
|
(let ((message (match-string 1 msg)))
|
|
|
|
(erc-display-message
|
|
|
|
nil '(notice action) 'active
|
|
|
|
'CTCP-ECHO ?n nick ?m message)))
|
|
|
|
nil)
|
|
|
|
|
|
|
|
(defvar erc-ctcp-reply-CLIENTINFO-hook '(erc-ctcp-reply-CLIENTINFO))
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-reply-CLIENTINFO (_proc nick _login _host _to msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Handle a CTCP CLIENTINFO reply."
|
|
|
|
(when (string-match "^CLIENTINFO\\s-+\\(.*\\)\\s-*$" msg)
|
|
|
|
(let ((message (match-string 1 msg)))
|
|
|
|
(erc-display-message
|
|
|
|
nil 'notice 'active
|
|
|
|
'CTCP-CLIENTINFO ?n nick ?m message)))
|
|
|
|
nil)
|
|
|
|
|
|
|
|
(defvar erc-ctcp-reply-FINGER-hook '(erc-ctcp-reply-FINGER))
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-reply-FINGER (_proc nick _login _host _to msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Handle a CTCP FINGER reply."
|
|
|
|
(when (string-match "^FINGER\\s-+\\(.*\\)\\s-*$" msg)
|
|
|
|
(let ((message (match-string 1 msg)))
|
|
|
|
(erc-display-message
|
|
|
|
nil 'notice 'active
|
|
|
|
'CTCP-FINGER ?n nick ?m message)))
|
|
|
|
nil)
|
|
|
|
|
|
|
|
(defvar erc-ctcp-reply-PING-hook '(erc-ctcp-reply-PING))
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-reply-PING (_proc nick _login _host _to msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Handle a CTCP PING reply."
|
|
|
|
(if (not (string-match "^PING\\s-+\\([0-9.]+\\)" msg))
|
|
|
|
nil
|
|
|
|
(let ((time (match-string 1 msg)))
|
|
|
|
(condition-case nil
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-22 18:32:31 -08:00
|
|
|
(let ((delta (erc-time-diff (string-to-number time) nil)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-display-message
|
|
|
|
nil 'notice 'active
|
|
|
|
'CTCP-PING ?n nick
|
|
|
|
?t (erc-sec-to-time delta)))
|
|
|
|
(range-error
|
|
|
|
(erc-display-message
|
|
|
|
nil 'error 'active
|
|
|
|
'bad-ping-response ?n nick ?t time))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defvar erc-ctcp-reply-TIME-hook '(erc-ctcp-reply-TIME))
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-reply-TIME (_proc nick _login _host _to msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Handle a CTCP TIME reply."
|
|
|
|
(when (string-match "^TIME\\s-+\\(.*\\)\\s-*$" msg)
|
|
|
|
(let ((message (match-string 1 msg)))
|
|
|
|
(erc-display-message
|
|
|
|
nil 'notice 'active
|
|
|
|
'CTCP-TIME ?n nick ?m message)))
|
|
|
|
nil)
|
|
|
|
|
|
|
|
(defvar erc-ctcp-reply-VERSION-hook '(erc-ctcp-reply-VERSION))
|
2013-08-22 00:06:45 -04:00
|
|
|
(defun erc-ctcp-reply-VERSION (_proc nick _login _host _to msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Handle a CTCP VERSION reply."
|
|
|
|
(when (string-match "^VERSION\\s-+\\(.*\\)\\s-*$" msg)
|
|
|
|
(let ((message (match-string 1 msg)))
|
|
|
|
(erc-display-message
|
|
|
|
nil 'notice 'active
|
|
|
|
'CTCP-VERSION ?n nick ?m message)))
|
|
|
|
nil)
|
|
|
|
|
|
|
|
(defun erc-process-away (proc away-p)
|
2007-01-17 18:17:25 +00:00
|
|
|
"Toggle the away status of the user depending on the value of AWAY-P.
|
|
|
|
|
|
|
|
If nil, set the user as away.
|
|
|
|
If non-nil, return from being away."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((sessionbuf (process-buffer proc)))
|
|
|
|
(when sessionbuf
|
|
|
|
(with-current-buffer sessionbuf
|
2014-11-08 20:51:43 -05:00
|
|
|
(when erc-away-nickname
|
|
|
|
(erc-log (format "erc-process-away: away-nick: %s, away-p: %s"
|
|
|
|
erc-away-nickname away-p))
|
|
|
|
(erc-cmd-NICK (if away-p
|
|
|
|
erc-away-nickname
|
|
|
|
erc-nick)))
|
|
|
|
(cond
|
|
|
|
(away-p
|
|
|
|
(setq erc-away (current-time)))
|
|
|
|
(t
|
|
|
|
(let ((away-time erc-away))
|
|
|
|
;; away must be set to NIL BEFORE sending anything to prevent
|
|
|
|
;; an infinite recursion
|
|
|
|
(setq erc-away nil)
|
|
|
|
(with-current-buffer (erc-active-buffer)
|
|
|
|
(when erc-public-away-p
|
|
|
|
(erc-send-action
|
|
|
|
(erc-default-target)
|
|
|
|
(if away-time
|
|
|
|
(format "is back (gone for %s)"
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-22 18:32:31 -08:00
|
|
|
(erc-sec-to-time (erc-time-diff away-time nil)))
|
2014-11-08 20:51:43 -05:00
|
|
|
"is back")))))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-update-mode-line)))
|
|
|
|
|
|
|
|
;;;; List of channel members handling
|
|
|
|
|
|
|
|
(defun erc-channel-begin-receiving-names ()
|
|
|
|
"Internal function.
|
|
|
|
|
|
|
|
Used when a channel names list is about to be received. Should
|
|
|
|
be called with the current buffer set to the channel buffer.
|
|
|
|
|
|
|
|
See also `erc-channel-end-receiving-names'."
|
|
|
|
(setq erc-channel-new-member-names (make-hash-table :test 'equal)))
|
|
|
|
|
|
|
|
(defun erc-channel-end-receiving-names ()
|
|
|
|
"Internal function.
|
|
|
|
|
|
|
|
Used to fix `erc-channel-users' after a channel names list has been
|
|
|
|
received. Should be called with the current buffer set to the
|
|
|
|
channel buffer.
|
|
|
|
|
|
|
|
See also `erc-channel-begin-receiving-names'."
|
2013-08-22 00:06:45 -04:00
|
|
|
(maphash (lambda (nick _user)
|
2014-11-08 20:51:43 -05:00
|
|
|
(if (null (gethash nick erc-channel-new-member-names))
|
|
|
|
(erc-remove-channel-user nick)))
|
|
|
|
erc-channel-users)
|
2006-01-29 13:08:58 +00:00
|
|
|
(setq erc-channel-new-member-names nil))
|
|
|
|
|
2007-09-08 03:07:09 +00:00
|
|
|
(defun erc-parse-prefix ()
|
|
|
|
"Return an alist of valid prefix character types and their representations.
|
2023-11-13 18:24:59 -08:00
|
|
|
For example, if the current ISUPPORT \"PREFIX\" is \"(ov)@+\",
|
|
|
|
return an alist `equal' to ((?v . ?+) (?o . ?@)). For historical
|
|
|
|
reasons, ensure the ordering of the returned alist is opposite
|
|
|
|
that of the advertised parameter."
|
|
|
|
(let* ((str (or (erc--get-isupport-entry 'PREFIX t) "(qaohv)~&@%+"))
|
|
|
|
(i 0)
|
|
|
|
(j (string-search ")" str))
|
|
|
|
collected)
|
|
|
|
(when j
|
|
|
|
(while-let ((u (aref str (cl-incf i)))
|
|
|
|
((not (= ?\) u))))
|
|
|
|
(push (cons u (aref str (cl-incf j))) collected)))
|
|
|
|
collected))
|
|
|
|
|
|
|
|
(defvar-local erc--parsed-prefix nil
|
|
|
|
"Possibly stale `erc--parsed-prefix' struct instance for the server.
|
|
|
|
Use the \"getter\" function of the same name to obtain the current
|
|
|
|
value.")
|
|
|
|
|
|
|
|
(defun erc--parsed-prefix ()
|
|
|
|
"Return possibly cached `erc--parsed-prefix' object for the server.
|
|
|
|
Ensure the returned value describes the most recent \"PREFIX\"
|
|
|
|
parameter advertised by the current server, with the original
|
|
|
|
ordering intact. If no such parameter has yet arrived, return a
|
|
|
|
stand-in from the fallback value \"(qaohv)~&@%+\"."
|
|
|
|
(erc--with-isupport-data PREFIX erc--parsed-prefix
|
|
|
|
(let ((alist (nreverse (erc-parse-prefix))))
|
|
|
|
(make-erc--parsed-prefix
|
|
|
|
:key key
|
|
|
|
:letters (apply #'string (map-keys alist))
|
|
|
|
:statuses (apply #'string (map-values alist))
|
|
|
|
:alist alist))))
|
2007-09-08 03:07:09 +00:00
|
|
|
|
Move ERC's core dependencies to separate file
Asking people to order require's is about as effective
as asking kids to keep off the grass.
* lisp/erc/erc-backend.el (erc--target, erc-auto-query,
erc-channel-list, erc-channel-users, erc-default-nicks,
erc-default-recipients, erc-format-nick-function,
erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker,
erc-insert-marker, erc-invitation, erc-join-buffer,
erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p,
erc-minibuffer-ignored, erc-networks--id, erc-nick,
erc-nick-change-attempt-count, erc-prompt-for-channel-key,
erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping,
erc-whowas-on-nosuchnick): Forward-declare variables.
(erc--open-target, erc--target-from-string, erc-active-buffer,
erc-add-default-channel, erc-banlist-update, erc-buffer-filter,
erc-buffer-list-with-nick, erc-channel-begin-receiving-names,
erc-channel-end-receiving-names, erc-channel-p,
erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established,
erc-current-nick, erc-current-nick-p, erc-current-time,
erc-default-target, erc-delete-default-channel,
erc-display-error-notice, erc-display-server-message,
erc-emacs-time-to-erc-time, erc-format-message,
erc-format-privmessage, erc-get-buffer, erc-handle-login,
erc-handle-user-status-change, erc-ignored-reply-p,
erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p,
erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login,
erc-make-notice, erc-network, erc-networks--id-given,
erc-networks--id-reload, erc-nickname-in-use, erc-parse-user,
erc-process-away, erc-process-ctcp-query, erc-query-buffer-p,
erc-remove-channel-member, erc-remove-channel-users, erc-remove-user,
erc-sec-to-time, erc-server-buffer, erc-set-active-buffer,
erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string,
erc-update-mode-line, erc-update-mode-line-buffer,
erc-wash-quit-reason, erc-display-message, erc-get-buffer-create,
erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes,
erc-update-user-nick, erc-open, erc-update-channel-member):
Forward-declare functions.
(erc-response): Move to lisp/erc/erc-common.el.
(erc-compat--with-memoization): Use "erc-compat-" prefixed macro.
* lisp/erc/erc-common.el: New file. Change indentation for
`erc-with-all-buffers-of-server' from 1 to 2.
* lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro
from `erc-backend' and rename.
* lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'.
(erc-controls-highlight-regexp, erc-controls-remove-regexp,
erc-input-marker, erc-insert-marker, erc-server-process, erc-modules,
erc-log-p): Forward declare variables.
(erc-buffer-list, erc-error, erc-extract-command-from-line):
Forward-declare functions.
* lisp/erc/erc-networks.el (erc--target, erc-insert-marker,
erc-kill-buffer-hook, erc-kill-server-hook, erc-modules,
erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name,
erc-server-connected, erc-server-parameters, erc-server-process,
erc-session-server): Forward declare variables.
(erc--default-target, erc--get-isupport-entry, erc-buffer-filter,
erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer,
erc-server-buffer, erc-server-process-alive): Forward-declare
functions.
(erc-obsolete-var): Also suppress free-variable warnings.
* lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and
`erc-backend' at top of file. Don't require `erc-compat'.
(erc--server-last-reconnect-count, erc--server-reconnecting,
erc-channel-members-changed-hook, erc-network, erc-networks--id,
erc-server-367-functions, erc-server-announced-name,
erc-server-connect-function, erc-server-connected,
erc-server-current-nick, erc-server-lag, erc-server-last-sent-time,
erc-server-process, erc-server-quitting, erc-server-reconnect-count,
erc-server-reconnecting, erc-session-client-certificate,
erc-session-connector, erc-session-port, erc-session-server,
erc-session-user-full-name) Remove superfluous forward declarations.
(erc-message-parsed, tabbar--local-hlf, motif-version-string):
Relocate forward declares to central location.
(erc-session-password): Move to `erc-backend'.
(erc-downcase, erc-with-server-buffer, erc-server-user,
erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to
lisp/erc/erc-common.el.
(erc-add-server-user, erc-remove-server-user,
erc-channel-user-owner-p, erc-channel-user-admin-p,
erc-channel-user-op-p, erc-channel-user-halfop-p,
erc-channel-user-voice-p): Convert from inline functions to normal
functions.
(define-erc-module, erc--target, erc--target-channel,
erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer,
erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el.
(erc-channel-members-changed-hook): Relocate option to avoid compiler
warning.
(erc-input, erc--input-split): Move to lisp/erc/erc-common.el.
(erc-controls-strip): Remove forward declaration temporarily until
this file stops requiring `erc-goodies'.
* test/lisp/erc/erc-networks-tests.el: Require `erc' instead of
`erc-networks'.
* test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove
obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
|
|
|
(defcustom erc-channel-members-changed-hook nil
|
|
|
|
"This hook is called every time the variable `channel-members' changes.
|
|
|
|
The buffer where the change happened is current while this hook is called."
|
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-channel-receive-names (names-string)
|
|
|
|
"This function is for internal use only.
|
|
|
|
|
|
|
|
Update `erc-channel-users' according to NAMES-STRING.
|
|
|
|
NAMES-STRING is a string listing some of the names on the
|
|
|
|
channel."
|
2023-11-13 18:24:59 -08:00
|
|
|
(let* ((prefix (erc--parsed-prefix-alist (erc--parsed-prefix)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(voice-ch (cdr (assq ?v prefix)))
|
|
|
|
(op-ch (cdr (assq ?o prefix)))
|
|
|
|
(hop-ch (cdr (assq ?h prefix)))
|
|
|
|
(adm-ch (cdr (assq ?a prefix)))
|
|
|
|
(own-ch (cdr (assq ?q prefix)))
|
|
|
|
(names (delete "" (split-string names-string)))
|
|
|
|
name op voice halfop admin owner)
|
2007-09-08 03:07:09 +00:00
|
|
|
(let ((erc-channel-members-changed-hook nil))
|
|
|
|
(dolist (item names)
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((updatep t)
|
|
|
|
(ch (aref item 0)))
|
|
|
|
(setq name item op 'off voice 'off halfop 'off admin 'off owner 'off)
|
|
|
|
(if (rassq ch prefix)
|
|
|
|
(if (= (length item) 1)
|
|
|
|
(setq updatep nil)
|
|
|
|
(setq name (substring item 1))
|
|
|
|
(setf (pcase ch
|
|
|
|
((pred (eq voice-ch)) voice)
|
|
|
|
((pred (eq hop-ch)) halfop)
|
|
|
|
((pred (eq op-ch)) op)
|
|
|
|
((pred (eq adm-ch)) admin)
|
|
|
|
((pred (eq own-ch)) owner)
|
2016-02-04 16:52:01 +11:00
|
|
|
(_ (message "Unknown prefix char `%S'" ch) voice))
|
2014-11-08 20:51:43 -05:00
|
|
|
'on)))
|
|
|
|
(when updatep
|
2015-12-27 21:33:01 +01:00
|
|
|
;; If we didn't issue the NAMES request (consider two clients
|
|
|
|
;; talking to an IRC proxy), `erc-channel-begin-receiving-names'
|
|
|
|
;; will not have been called, so we have to do it here.
|
|
|
|
(unless erc-channel-new-member-names
|
|
|
|
(erc-channel-begin-receiving-names))
|
2014-11-08 20:51:43 -05:00
|
|
|
(puthash (erc-downcase name) t
|
|
|
|
erc-channel-new-member-names)
|
|
|
|
(erc-update-current-channel-member
|
|
|
|
name name t voice halfop op admin owner)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(run-hooks 'erc-channel-members-changed-hook)))
|
|
|
|
|
|
|
|
(defun erc-update-user-nick (nick &optional new-nick
|
2014-11-08 20:51:43 -05:00
|
|
|
host login full-name info)
|
2013-08-22 00:06:45 -04:00
|
|
|
"Update the stored user information for the user with nickname NICK.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
See also: `erc-update-user'."
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-update-user (erc-get-server-user nick) new-nick
|
2014-11-08 20:51:43 -05:00
|
|
|
host login full-name info))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-update-user (user &optional new-nick
|
2014-11-08 20:51:43 -05:00
|
|
|
host login full-name info)
|
2021-09-14 08:43:18 +02:00
|
|
|
"Update user info for USER.
|
|
|
|
USER must be an erc-server-user struct. Any of NEW-NICK, HOST,
|
|
|
|
LOGIN, FULL-NAME, INFO which are non-nil and not equal to the
|
|
|
|
existing values for USER are used to replace the stored values in
|
|
|
|
USER.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
If, and only if, a change is made,
|
2006-01-29 13:08:58 +00:00
|
|
|
`erc-channel-members-changed-hook' is run for each channel for
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
which USER is a member, and t is returned."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let (changed)
|
|
|
|
(when user
|
|
|
|
(when (and new-nick
|
2014-11-08 20:51:43 -05:00
|
|
|
(not (equal (erc-server-user-nickname user)
|
|
|
|
new-nick)))
|
|
|
|
(setq changed t)
|
|
|
|
(erc-change-user-nickname user new-nick))
|
2006-01-29 13:08:58 +00:00
|
|
|
(when (and host
|
2014-11-08 20:51:43 -05:00
|
|
|
(not (equal (erc-server-user-host user) host)))
|
|
|
|
(setq changed t)
|
|
|
|
(setf (erc-server-user-host user) host))
|
2006-01-29 13:08:58 +00:00
|
|
|
(when (and login
|
2014-11-08 20:51:43 -05:00
|
|
|
(not (equal (erc-server-user-login user) login)))
|
|
|
|
(setq changed t)
|
|
|
|
(setf (erc-server-user-login user) login))
|
2006-01-29 13:08:58 +00:00
|
|
|
(when (and full-name
|
2014-11-08 20:51:43 -05:00
|
|
|
(not (equal (erc-server-user-full-name user)
|
|
|
|
full-name)))
|
|
|
|
(setq changed t)
|
|
|
|
(setf (erc-server-user-full-name user) full-name))
|
2006-01-29 13:08:58 +00:00
|
|
|
(when (and info
|
2014-11-08 20:51:43 -05:00
|
|
|
(not (equal (erc-server-user-info user) info)))
|
|
|
|
(setq changed t)
|
|
|
|
(setf (erc-server-user-info user) info))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if changed
|
2014-11-08 20:51:43 -05:00
|
|
|
(dolist (buf (erc-server-user-buffers user))
|
|
|
|
(if (buffer-live-p buf)
|
|
|
|
(with-current-buffer buf
|
|
|
|
(run-hooks 'erc-channel-members-changed-hook))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
changed))
|
|
|
|
|
|
|
|
(defun erc-update-current-channel-member
|
2014-11-08 20:51:43 -05:00
|
|
|
(nick new-nick &optional add voice halfop op admin owner host login full-name info
|
|
|
|
update-message-time)
|
2013-08-22 00:06:45 -04:00
|
|
|
"Update the stored user information for the user with nickname NICK.
|
|
|
|
`erc-update-user' is called to handle changes to nickname,
|
2014-11-08 20:51:43 -05:00
|
|
|
HOST, LOGIN, FULL-NAME, and INFO. If VOICE HALFOP OP ADMIN or OWNER
|
|
|
|
are non-nil, they must be equal to either `on' or `off', in which
|
|
|
|
case the status of the user in the current channel is changed accordingly.
|
|
|
|
If UPDATE-MESSAGE-TIME is non-nil, the last-message-time of the user
|
|
|
|
in the current channel is set to (current-time).
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
If ADD is non-nil, the user will be added with the specified
|
|
|
|
information if it is not already present in the user or channel
|
|
|
|
lists.
|
|
|
|
|
|
|
|
If, and only if, changes are made, or the user is added,
|
2020-09-23 13:35:55 +02:00
|
|
|
`erc-channel-members-changed-hook' is run, and t is returned.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
See also: `erc-update-user' and `erc-update-channel-member'."
|
|
|
|
(let* (changed user-changed
|
2014-11-08 20:51:43 -05:00
|
|
|
(channel-data (erc-get-channel-user nick))
|
|
|
|
(cuser (cdr channel-data))
|
|
|
|
(user (if channel-data (car channel-data)
|
|
|
|
(erc-get-server-user nick))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if cuser
|
2014-11-08 20:51:43 -05:00
|
|
|
(progn
|
|
|
|
(erc-log (format "update-member: user = %S, cuser = %S" user cuser))
|
|
|
|
(when (and voice
|
|
|
|
(not (eq (erc-channel-user-voice cuser) voice)))
|
|
|
|
(setq changed t)
|
|
|
|
(setf (erc-channel-user-voice cuser)
|
|
|
|
(cond ((eq voice 'on) t)
|
|
|
|
((eq voice 'off) nil)
|
|
|
|
(t voice))))
|
|
|
|
(when (and halfop
|
|
|
|
(not (eq (erc-channel-user-halfop cuser) halfop)))
|
|
|
|
(setq changed t)
|
|
|
|
(setf (erc-channel-user-halfop cuser)
|
|
|
|
(cond ((eq halfop 'on) t)
|
|
|
|
((eq halfop 'off) nil)
|
|
|
|
(t halfop))))
|
|
|
|
(when (and op
|
|
|
|
(not (eq (erc-channel-user-op cuser) op)))
|
|
|
|
(setq changed t)
|
|
|
|
(setf (erc-channel-user-op cuser)
|
|
|
|
(cond ((eq op 'on) t)
|
|
|
|
((eq op 'off) nil)
|
|
|
|
(t op))))
|
|
|
|
(when (and admin
|
|
|
|
(not (eq (erc-channel-user-admin cuser) admin)))
|
|
|
|
(setq changed t)
|
|
|
|
(setf (erc-channel-user-admin cuser)
|
|
|
|
(cond ((eq admin 'on) t)
|
|
|
|
((eq admin 'off) nil)
|
|
|
|
(t admin))))
|
|
|
|
(when (and owner
|
|
|
|
(not (eq (erc-channel-user-owner cuser) owner)))
|
|
|
|
(setq changed t)
|
|
|
|
(setf (erc-channel-user-owner cuser)
|
|
|
|
(cond ((eq owner 'on) t)
|
|
|
|
((eq owner 'off) nil)
|
|
|
|
(t owner))))
|
|
|
|
(when update-message-time
|
|
|
|
(setf (erc-channel-user-last-message-time cuser) (current-time)))
|
|
|
|
(setq user-changed
|
|
|
|
(erc-update-user user new-nick
|
|
|
|
host login full-name info)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(when add
|
2014-11-08 20:51:43 -05:00
|
|
|
(if (null user)
|
|
|
|
(progn
|
|
|
|
(setq user (make-erc-server-user
|
|
|
|
:nickname nick
|
|
|
|
:host host
|
|
|
|
:full-name full-name
|
|
|
|
:login login
|
|
|
|
:info info
|
|
|
|
:buffers (list (current-buffer))))
|
|
|
|
(erc-add-server-user nick user))
|
|
|
|
(setf (erc-server-user-buffers user)
|
|
|
|
(cons (current-buffer)
|
|
|
|
(erc-server-user-buffers user))))
|
|
|
|
(setq cuser (make-erc-channel-user
|
|
|
|
:voice (cond ((eq voice 'on) t)
|
|
|
|
((eq voice 'off) nil)
|
|
|
|
(t voice))
|
|
|
|
:halfop (cond ((eq halfop 'on) t)
|
|
|
|
((eq halfop 'off) nil)
|
|
|
|
(t halfop))
|
|
|
|
:op (cond ((eq op 'on) t)
|
|
|
|
((eq op 'off) nil)
|
|
|
|
(t op))
|
|
|
|
:admin (cond ((eq admin 'on) t)
|
|
|
|
((eq admin 'off) nil)
|
|
|
|
(t admin))
|
|
|
|
:owner (cond ((eq owner 'on) t)
|
|
|
|
((eq owner 'off) nil)
|
|
|
|
(t owner))
|
|
|
|
:last-message-time
|
|
|
|
(if update-message-time (current-time))))
|
|
|
|
(puthash (erc-downcase nick) (cons user cuser)
|
|
|
|
erc-channel-users)
|
|
|
|
(setq changed t)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(when (and changed (null user-changed))
|
|
|
|
(run-hooks 'erc-channel-members-changed-hook))
|
|
|
|
(or changed user-changed add)))
|
|
|
|
|
|
|
|
(defun erc-update-channel-member (channel nick new-nick
|
2014-11-08 20:51:43 -05:00
|
|
|
&optional add voice halfop op admin owner host login
|
|
|
|
full-name info update-message-time)
|
2021-09-19 12:59:01 +02:00
|
|
|
"Update user and channel for user with nickname NICK in channel CHANNEL.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
See also: `erc-update-current-channel-member'."
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-with-buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(channel)
|
|
|
|
(erc-update-current-channel-member nick new-nick add voice halfop op admin owner host
|
|
|
|
login full-name info
|
|
|
|
update-message-time)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-remove-current-channel-member (nick)
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
"Remove NICK from current channel membership list.
|
|
|
|
Runs `erc-channel-members-changed-hook'."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((channel-data (erc-get-channel-user nick)))
|
|
|
|
(when channel-data
|
|
|
|
(erc-remove-channel-user nick)
|
|
|
|
(run-hooks 'erc-channel-members-changed-hook))))
|
|
|
|
|
|
|
|
(defun erc-remove-channel-member (channel nick)
|
|
|
|
"Remove NICK from CHANNEL's membership list.
|
|
|
|
|
|
|
|
See also `erc-remove-current-channel-member'."
|
|
|
|
(erc-with-buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(channel)
|
|
|
|
(erc-remove-current-channel-member nick)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-update-channel-topic (channel topic &optional modify)
|
|
|
|
"Find a buffer for CHANNEL and set the TOPIC for it.
|
|
|
|
|
2015-11-17 15:28:50 -08:00
|
|
|
If optional MODIFY is `append' or `prepend', then append or prepend the
|
2006-01-29 13:08:58 +00:00
|
|
|
TOPIC string to the current topic."
|
|
|
|
(erc-with-buffer (channel)
|
|
|
|
(cond ((eq modify 'append)
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq erc-channel-topic (concat erc-channel-topic topic)))
|
|
|
|
((eq modify 'prepend)
|
|
|
|
(setq erc-channel-topic (concat topic erc-channel-topic)))
|
|
|
|
(t (setq erc-channel-topic topic)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-update-mode-line-buffer (current-buffer))))
|
|
|
|
|
|
|
|
(defun erc-set-modes (tgt mode-string)
|
|
|
|
"Set the modes for the TGT provided as MODE-STRING."
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(declare (obsolete "see comment atop `erc--update-modes'" "30.1"))
|
|
|
|
(let* ((modes (with-suppressed-warnings ((obsolete erc-parse-modes))
|
|
|
|
(erc-parse-modes mode-string)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(add-modes (nth 0 modes))
|
|
|
|
;; list of triples: (mode-char 'on/'off argument)
|
|
|
|
(arg-modes (nth 2 modes)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(cond ((erc-channel-p tgt); channel modes
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((buf (and erc-server-process
|
|
|
|
(erc-get-buffer tgt erc-server-process))))
|
|
|
|
(when buf
|
|
|
|
(with-current-buffer buf
|
|
|
|
(setq erc-channel-modes add-modes)
|
|
|
|
(setq erc-channel-user-limit nil)
|
|
|
|
(setq erc-channel-key nil)
|
|
|
|
(while arg-modes
|
|
|
|
(let ((mode (nth 0 (car arg-modes)))
|
|
|
|
(onoff (nth 1 (car arg-modes)))
|
|
|
|
(arg (nth 2 (car arg-modes))))
|
|
|
|
(cond ((string-match "^[Ll]" mode)
|
|
|
|
(erc-update-channel-limit tgt onoff arg))
|
|
|
|
((string-match "^[Kk]" mode)
|
|
|
|
(erc-update-channel-key tgt onoff arg))
|
|
|
|
(t nil)))
|
|
|
|
(setq arg-modes (cdr arg-modes)))
|
|
|
|
(erc-update-mode-line-buffer buf)))))
|
|
|
|
;; we do not keep our nick's modes yet
|
|
|
|
;;(t (setq erc-user-modes add-modes))
|
|
|
|
)
|
2006-01-29 13:08:58 +00:00
|
|
|
))
|
|
|
|
|
|
|
|
(defun erc-sort-strings (list-of-strings)
|
|
|
|
"Sort LIST-OF-STRINGS in lexicographic order.
|
|
|
|
|
|
|
|
Side-effect free."
|
2021-03-18 23:14:33 -04:00
|
|
|
(sort (copy-sequence list-of-strings) #'string<))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-parse-modes (mode-string)
|
|
|
|
"Parse MODE-STRING into a list.
|
|
|
|
|
|
|
|
Returns a list of three elements:
|
|
|
|
|
|
|
|
(ADD-MODES REMOVE-MODES ARG-MODES).
|
|
|
|
|
|
|
|
The add-modes and remove-modes are lists of single-character strings
|
|
|
|
for modes without parameters to add and remove respectively. The
|
|
|
|
arg-modes is a list of triples of the form:
|
|
|
|
|
|
|
|
(MODE-CHAR ON/OFF ARGUMENT)."
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(declare (obsolete "see comment atop `erc--update-modes'" "30.1"))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (string-match "^\\s-*\\(\\S-+\\)\\(\\s-.*$\\|$\\)" mode-string)
|
2015-03-16 14:49:01 -04:00
|
|
|
(let ((chars (mapcar #'char-to-string (match-string 1 mode-string)))
|
2014-11-08 20:51:43 -05:00
|
|
|
;; arguments in channel modes
|
|
|
|
(args-str (match-string 2 mode-string))
|
|
|
|
(args nil)
|
|
|
|
(add-modes nil)
|
|
|
|
(remove-modes nil)
|
|
|
|
(arg-modes nil); list of triples: (mode-char 'on/'off argument)
|
|
|
|
(add-p t))
|
|
|
|
;; make the argument list
|
|
|
|
(while (string-match "^\\s-*\\(\\S-+\\)\\(\\s-+.*$\\|$\\)" args-str)
|
|
|
|
(setq args (cons (match-string 1 args-str) args))
|
|
|
|
(setq args-str (match-string 2 args-str)))
|
|
|
|
(setq args (nreverse args))
|
|
|
|
;; collect what modes changed, and match them with arguments
|
|
|
|
(while chars
|
|
|
|
(cond ((string= (car chars) "+") (setq add-p t))
|
|
|
|
((string= (car chars) "-") (setq add-p nil))
|
|
|
|
((string-match "^[qaovhbQAOVHB]" (car chars))
|
|
|
|
(setq arg-modes (cons (list (car chars)
|
|
|
|
(if add-p 'on 'off)
|
|
|
|
(if args (car args) nil))
|
|
|
|
arg-modes))
|
|
|
|
(if args (setq args (cdr args))))
|
|
|
|
((string-match "^[LlKk]" (car chars))
|
|
|
|
(setq arg-modes (cons (list (car chars)
|
|
|
|
(if add-p 'on 'off)
|
|
|
|
(if (and add-p args)
|
|
|
|
(car args) nil))
|
|
|
|
arg-modes))
|
|
|
|
(if (and add-p args) (setq args (cdr args))))
|
|
|
|
(add-p (setq add-modes (cons (car chars) add-modes)))
|
|
|
|
(t (setq remove-modes (cons (car chars) remove-modes))))
|
|
|
|
(setq chars (cdr chars)))
|
|
|
|
(setq add-modes (nreverse add-modes))
|
|
|
|
(setq remove-modes (nreverse remove-modes))
|
|
|
|
(setq arg-modes (nreverse arg-modes))
|
|
|
|
(list add-modes remove-modes arg-modes))
|
2006-01-29 13:08:58 +00:00
|
|
|
nil))
|
|
|
|
|
2014-11-08 20:51:43 -05:00
|
|
|
(defun erc-update-modes (tgt mode-string &optional _nick _host _login)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Update the mode information for TGT, provided as MODE-STRING.
|
|
|
|
Optional arguments: NICK, HOST and LOGIN - the attributes of the
|
|
|
|
person who changed the modes."
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(declare (obsolete "see comment atop `erc--update-modes'" "30.1"))
|
2013-08-22 00:06:45 -04:00
|
|
|
;; FIXME: neither of nick, host, and login are used!
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(let* ((modes (with-suppressed-warnings ((obsolete erc-parse-modes))
|
|
|
|
(erc-parse-modes mode-string)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(add-modes (nth 0 modes))
|
|
|
|
(remove-modes (nth 1 modes))
|
|
|
|
;; list of triples: (mode-char 'on/'off argument)
|
|
|
|
(arg-modes (nth 2 modes)))
|
2006-01-29 13:08:58 +00:00
|
|
|
;; now parse the modes changes and do the updates
|
|
|
|
(cond ((erc-channel-p tgt); channel modes
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((buf (and erc-server-process
|
|
|
|
(erc-get-buffer tgt erc-server-process))))
|
|
|
|
(when buf
|
|
|
|
;; FIXME! This used to have an original buffer
|
|
|
|
;; variable, but it never switched back to the original
|
|
|
|
;; buffer. Is this wanted behavior?
|
|
|
|
(set-buffer buf)
|
|
|
|
(if (not (boundp 'erc-channel-modes))
|
|
|
|
(setq erc-channel-modes nil))
|
|
|
|
(while remove-modes
|
|
|
|
(setq erc-channel-modes (delete (car remove-modes)
|
|
|
|
erc-channel-modes)
|
|
|
|
remove-modes (cdr remove-modes)))
|
|
|
|
(while add-modes
|
|
|
|
(setq erc-channel-modes (cons (car add-modes)
|
|
|
|
erc-channel-modes)
|
|
|
|
add-modes (cdr add-modes)))
|
|
|
|
(setq erc-channel-modes (erc-sort-strings erc-channel-modes))
|
|
|
|
(while arg-modes
|
|
|
|
(let ((mode (nth 0 (car arg-modes)))
|
|
|
|
(onoff (nth 1 (car arg-modes)))
|
|
|
|
(arg (nth 2 (car arg-modes))))
|
|
|
|
(cond ((string-match "^[Vv]" mode)
|
|
|
|
(erc-update-channel-member tgt arg arg nil onoff))
|
|
|
|
((string-match "^[hH]" mode)
|
|
|
|
(erc-update-channel-member tgt arg arg nil nil onoff))
|
|
|
|
((string-match "^[oO]" mode)
|
|
|
|
(erc-update-channel-member tgt arg arg nil nil nil onoff))
|
|
|
|
((string-match "^[aA]" mode)
|
|
|
|
(erc-update-channel-member tgt arg arg nil nil nil nil onoff))
|
|
|
|
((string-match "^[qQ]" mode)
|
|
|
|
(erc-update-channel-member tgt arg arg nil nil nil nil nil onoff))
|
|
|
|
((string-match "^[Ll]" mode)
|
|
|
|
(erc-update-channel-limit tgt onoff arg))
|
|
|
|
((string-match "^[Kk]" mode)
|
|
|
|
(erc-update-channel-key tgt onoff arg))
|
|
|
|
(t nil)); only ops are tracked now
|
|
|
|
(setq arg-modes (cdr arg-modes))))
|
|
|
|
(erc-update-mode-line buf))))
|
|
|
|
;; nick modes - ignored at this point
|
|
|
|
(t nil))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(defun erc--update-membership-prefix (nick letter state)
|
|
|
|
"Update status prefixes for NICK in current channel buffer.
|
|
|
|
Expect LETTER to be a status char and STATE to be a boolean."
|
|
|
|
(erc-update-current-channel-member nick nil nil
|
|
|
|
(and (= letter ?v) state)
|
|
|
|
(and (= letter ?h) state)
|
|
|
|
(and (= letter ?o) state)
|
|
|
|
(and (= letter ?a) state)
|
|
|
|
(and (= letter ?q) state)))
|
|
|
|
|
|
|
|
(defvar-local erc--channel-modes nil
|
|
|
|
"When non-nil, a hash table of current channel modes.
|
|
|
|
Keys are characters. Values are either a string, for types A-C,
|
|
|
|
or t, for type D.")
|
|
|
|
|
|
|
|
(defvar-local erc--channel-mode-types nil
|
|
|
|
"Possibly stale `erc--channel-mode-types' instance for the server.
|
|
|
|
Use the getter of the same name to retrieve the current value.")
|
|
|
|
|
2023-11-20 19:45:30 -08:00
|
|
|
(defvar-local erc--mode-line-mode-string nil
|
|
|
|
"Computed mode-line or header-line component for user/channel modes.")
|
|
|
|
|
|
|
|
(defvar erc--mode-line-chanmodes-arg-len 10
|
|
|
|
"Max length at which to truncate channel-mode args in header line.")
|
|
|
|
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(defun erc--channel-mode-types ()
|
|
|
|
"Return variable `erc--channel-mode-types', possibly initializing it."
|
|
|
|
(erc--with-isupport-data CHANMODES erc--channel-mode-types
|
|
|
|
(let ((types (or key '(nil "Kk" "Ll" nil)))
|
|
|
|
(ct (make-char-table 'erc--channel-mode-types))
|
|
|
|
(type ?a))
|
|
|
|
(dolist (cs types)
|
2023-12-03 19:19:37 -08:00
|
|
|
(erc--doarray (c cs)
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(aset ct c type))
|
|
|
|
(cl-incf type))
|
|
|
|
(make-erc--channel-mode-types :key key
|
|
|
|
:fallbackp (null key)
|
|
|
|
:table ct))))
|
|
|
|
|
|
|
|
(defun erc--process-channel-modes (string args &optional status-letters)
|
|
|
|
"Parse channel \"MODE\" changes and call unary letter handlers.
|
|
|
|
Update `erc-channel-modes' and `erc--channel-modes'. With
|
|
|
|
STATUS-LETTERS, also update channel membership prefixes. Expect
|
|
|
|
STRING to be the second argument from an incoming \"MODE\"
|
|
|
|
command and ARGS to be the remaining arguments, which should
|
|
|
|
complement relevant letters in STRING."
|
|
|
|
(cl-assert (erc--target-channel-p erc--target))
|
|
|
|
(let* ((obj (erc--channel-mode-types))
|
|
|
|
(table (erc--channel-mode-types-table obj))
|
|
|
|
(fallbackp (erc--channel-mode-types-fallbackp obj))
|
|
|
|
(+p t))
|
2023-12-03 19:19:37 -08:00
|
|
|
(erc--doarray (c string)
|
|
|
|
(cond ((= ?+ c) (setq +p t))
|
|
|
|
((= ?- c) (setq +p nil))
|
|
|
|
((and status-letters (string-search (string c) status-letters))
|
|
|
|
(erc--update-membership-prefix (pop args) c (if +p 'on 'off)))
|
|
|
|
((and-let* ((group (or (aref table c) (and fallbackp ?d))))
|
|
|
|
(erc--handle-channel-mode group c +p
|
|
|
|
(and (/= group ?d)
|
|
|
|
(or (/= group ?c) +p)
|
|
|
|
(pop args)))
|
|
|
|
t))
|
|
|
|
((not fallbackp)
|
|
|
|
(erc-display-message nil '(notice error) (erc-server-buffer)
|
|
|
|
(format "Unknown channel mode: %S" c)))))
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(setq erc-channel-modes (sort erc-channel-modes #'string<))
|
2023-11-20 19:45:30 -08:00
|
|
|
(setq erc--mode-line-mode-string
|
|
|
|
(concat "+" (erc--channel-modes erc--mode-line-chanmodes-arg-len)))
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(erc-update-mode-line (current-buffer))))
|
|
|
|
|
|
|
|
(defvar-local erc--user-modes nil
|
|
|
|
"Sorted list of current user \"MODE\" letters.
|
|
|
|
Analogous to `erc-channel-modes' but chars rather than strings.")
|
|
|
|
|
|
|
|
(defun erc--user-modes (&optional as-type)
|
|
|
|
"Return user \"MODE\" letters in a form described by AS-TYPE.
|
|
|
|
When AS-TYPE is the symbol `strings' (plural), return a list of
|
|
|
|
strings. When it's `string' (singular), return the same list
|
2023-11-20 19:45:30 -08:00
|
|
|
concatenated into a single string. When AS-TYPE is nil, return a
|
|
|
|
list of chars."
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(let ((modes (or erc--user-modes (erc-with-server-buffer erc--user-modes))))
|
|
|
|
(pcase as-type
|
|
|
|
('strings (mapcar #'char-to-string modes))
|
|
|
|
('string (apply #'string modes))
|
|
|
|
(_ modes))))
|
|
|
|
|
2023-11-20 19:45:30 -08:00
|
|
|
(defun erc--channel-modes (&optional as-type sep)
|
|
|
|
"Return channel \"MODE\" settings in a form described by AS-TYPE.
|
|
|
|
When AS-TYPE is the symbol `strings' (plural), return letter keys
|
|
|
|
as a list of sorted string. When it's `string' (singular),
|
|
|
|
return keys as a single string. When it's a number N, return a
|
|
|
|
single string consisting of the concatenated and sorted keys
|
|
|
|
followed by a space and then their corresponding args, each
|
|
|
|
truncated to N chars max. ERC joins these args together with
|
|
|
|
SEP, which defaults to a single space. Otherwise, return a
|
|
|
|
sorted alist of letter and arg pairs. In all cases that include
|
|
|
|
values, respect `erc-show-channel-key-p' and optionally omit the
|
|
|
|
secret key associated with the letter k."
|
|
|
|
(and-let* ((modes erc--channel-modes)
|
|
|
|
(tobj (erc--channel-mode-types))
|
|
|
|
(types (erc--channel-mode-types-table tobj)))
|
|
|
|
(let (out)
|
|
|
|
(maphash (lambda (k v)
|
|
|
|
(unless (eq ?a (aref types k))
|
|
|
|
(push (cons k
|
|
|
|
(and (not (eq t v))
|
|
|
|
(not (and (eq k ?k)
|
|
|
|
(not (bound-and-true-p
|
|
|
|
erc-show-channel-key-p))))
|
|
|
|
v))
|
|
|
|
out)))
|
|
|
|
modes)
|
|
|
|
(setq out (cl-sort out #'< :key #'car))
|
|
|
|
(pcase as-type
|
|
|
|
('strings (mapcar (lambda (o) (char-to-string (car o))) out))
|
|
|
|
('string (apply #'string (mapcar #'car out)))
|
|
|
|
((and (pred natnump) c)
|
|
|
|
(let (keys vals)
|
|
|
|
(pcase-dolist (`(,k . ,v) out)
|
|
|
|
(when v
|
|
|
|
(push (if (> (length v) c)
|
|
|
|
(with-memoization
|
|
|
|
(gethash (list c k v)
|
|
|
|
(erc--channel-mode-types-shortargs tobj))
|
|
|
|
(truncate-string-to-width v c 0 nil t))
|
|
|
|
v)
|
|
|
|
vals))
|
|
|
|
(push k keys))
|
|
|
|
(concat (apply #'string (nreverse keys)) (and vals " ")
|
|
|
|
(string-join (nreverse vals) (or sep " ")))))
|
|
|
|
(_ out)))))
|
|
|
|
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(defun erc--parse-user-modes (string &optional current extrap)
|
|
|
|
"Return lists of chars from STRING to add to and drop from CURRENT.
|
|
|
|
Expect STRING to be a so-called \"modestring\", the second
|
|
|
|
parameter of a \"MODE\" command, here containing only valid
|
|
|
|
user-mode letters. Expect CURRENT to be a list of chars
|
|
|
|
resembling those found in `erc--user-modes'. With EXTRAP, return
|
|
|
|
two additional lists of chars: those that would be added were
|
|
|
|
they not already present in CURRENT and those that would be
|
|
|
|
dropped were they not already absent."
|
|
|
|
(let ((addp t)
|
|
|
|
;;
|
|
|
|
redundant-add redundant-drop adding dropping)
|
2023-12-03 19:19:37 -08:00
|
|
|
(erc--doarray (c string)
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(pcase c
|
|
|
|
(?+ (setq addp t))
|
|
|
|
(?- (setq addp nil))
|
|
|
|
(_ (push c (let ((hasp (and current (memq c current))))
|
|
|
|
(if addp
|
|
|
|
(if hasp redundant-add adding)
|
|
|
|
(if hasp dropping redundant-drop)))))))
|
|
|
|
(if extrap
|
|
|
|
(list (nreverse adding) (nreverse dropping)
|
|
|
|
(nreverse redundant-add) (nreverse redundant-drop))
|
|
|
|
(list (nreverse adding) (nreverse dropping)))))
|
|
|
|
|
|
|
|
(defun erc--update-user-modes (string)
|
|
|
|
"Update `erc--user-modes' from \"MODE\" STRING.
|
|
|
|
Return its value, a list of characters sorted by character code."
|
2023-11-20 19:45:30 -08:00
|
|
|
(prog1
|
|
|
|
(setq erc--user-modes
|
|
|
|
(pcase-let ((`(,adding ,dropping)
|
|
|
|
(erc--parse-user-modes string erc--user-modes)))
|
|
|
|
(sort (seq-difference (nconc erc--user-modes adding) dropping)
|
|
|
|
#'<)))
|
|
|
|
(setq erc--mode-line-mode-string
|
|
|
|
(concat "+" (erc--user-modes 'string)))))
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
|
|
|
|
(defun erc--update-channel-modes (string &rest args)
|
|
|
|
"Update `erc-channel-modes' and call individual mode handlers.
|
|
|
|
Also update membership prefixes, as needed. Expect STRING to be
|
|
|
|
a \"modestring\" and ARGS to match mode-specific parameters."
|
|
|
|
(let ((status-letters (or (erc-with-server-buffer
|
|
|
|
(erc--parsed-prefix-letters
|
|
|
|
(erc--parsed-prefix)))
|
|
|
|
"qaovhbQAOVHB")))
|
|
|
|
(erc--process-channel-modes string args status-letters)))
|
|
|
|
|
|
|
|
;; XXX this comment is referenced elsewhere (grep before deleting).
|
|
|
|
;;
|
|
|
|
;; The function `erc-update-modes' was deprecated in ERC 5.6 with no
|
|
|
|
;; immediate public replacement. Third parties needing such a thing
|
|
|
|
;; are encouraged to write to emacs-erc@gnu.org with ideas for a
|
|
|
|
;; mode-handler API, possibly one incorporating letter-specific
|
|
|
|
;; handlers, like `erc--handle-channel-mode' (below), which only
|
|
|
|
;; handles mode types A-C.
|
|
|
|
(defun erc--update-modes (raw-args)
|
|
|
|
"Handle user or channel \"MODE\" update from server.
|
|
|
|
Expect RAW-ARGS be a list consisting of a \"modestring\" followed
|
|
|
|
by mode-specific arguments."
|
|
|
|
(if (and erc--target (erc--target-channel-p erc--target))
|
|
|
|
(apply #'erc--update-channel-modes raw-args)
|
|
|
|
(erc--update-user-modes (car raw-args))))
|
|
|
|
|
|
|
|
(defun erc--init-channel-modes (channel raw-args)
|
|
|
|
"Set CHANNEL modes from RAW-ARGS.
|
|
|
|
Expect RAW-ARGS to be a \"modestring\" without any status-prefix
|
|
|
|
chars, followed by applicable arguments."
|
|
|
|
(erc-with-buffer (channel)
|
|
|
|
(erc--process-channel-modes (car raw-args) (cdr raw-args))))
|
|
|
|
|
|
|
|
(cl-defgeneric erc--handle-channel-mode (type letter state arg)
|
|
|
|
"Handle a STATE change for mode LETTER of TYPE with ARG.
|
|
|
|
Expect to be called in the affected target buffer. Expect TYPE
|
|
|
|
to be a character, like ?a, representing an advertised
|
|
|
|
\"CHANMODES\" group. Expect LETTER to also be a character, and
|
|
|
|
expect STATE to be a boolean and ARGUMENT either a string or nil."
|
|
|
|
(erc-log (format "Channel-mode %c (type %s, arg %S) %s"
|
|
|
|
letter type arg (if state 'enabled 'disabled))))
|
|
|
|
|
2023-11-20 19:45:30 -08:00
|
|
|
(cl-defmethod erc--handle-channel-mode :before (type c state arg)
|
|
|
|
"Record STATE change for mode letter C.
|
|
|
|
When STATE is non-nil, add or update C's mapping in
|
|
|
|
`erc--channel-modes', associating it with ARG if C takes a
|
|
|
|
parameter and t otherwise. When STATE is nil, forget the
|
|
|
|
mapping. For type A, add up update a permanent mapping for C,
|
|
|
|
associating it with an integer indicating a running total of
|
|
|
|
STATE changes since joining the channel. In most cases, this
|
|
|
|
won't match the number known to the server."
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(unless erc--channel-modes
|
|
|
|
(cl-assert (erc--target-channel-p erc--target))
|
|
|
|
(setq erc--channel-modes (make-hash-table)))
|
2023-11-20 19:45:30 -08:00
|
|
|
(if (= type ?a)
|
|
|
|
(cl-callf (lambda (s) (+ (or s 0) (if state +1 -1)))
|
|
|
|
(gethash c erc--channel-modes))
|
|
|
|
(if state
|
|
|
|
(puthash c (or arg t) erc--channel-modes)
|
|
|
|
(remhash c erc--channel-modes))))
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
|
|
|
|
(cl-defmethod erc--handle-channel-mode :before ((_ (eql ?d)) c state _)
|
|
|
|
"Update `erc-channel-modes' for any character C of nullary type D.
|
|
|
|
Remember when STATE is non-nil and forget otherwise."
|
|
|
|
(setq erc-channel-modes
|
|
|
|
(if state
|
|
|
|
(cl-pushnew (char-to-string c) erc-channel-modes :test #'equal)
|
|
|
|
(delete (char-to-string c) erc-channel-modes))))
|
|
|
|
|
|
|
|
;; We could specialize on type C, but that may be too brittle.
|
|
|
|
(cl-defmethod erc--handle-channel-mode (_ (_ (eql ?l)) state arg)
|
|
|
|
"Update channel user limit, remembering ARG when STATE is non-nil."
|
|
|
|
(erc-update-channel-limit (erc--target-string erc--target)
|
|
|
|
(if state 'on 'off)
|
|
|
|
arg))
|
|
|
|
|
|
|
|
;; We could specialize on type B, but that may be too brittle.
|
|
|
|
(cl-defmethod erc--handle-channel-mode (_ (_ (eql ?k)) state arg)
|
|
|
|
"Update channel key, remembering ARG when state is non-nil."
|
|
|
|
;; Mimic old parsing behavior in which an ARG of "*" was discarded
|
|
|
|
;; even though `erc-update-channel-limit' checks STATE first.
|
|
|
|
(erc-update-channel-key (erc--target-string erc--target)
|
|
|
|
(if state 'on 'off)
|
|
|
|
(if (equal arg "*") nil arg)))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-update-channel-limit (channel onoff n)
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
"Update CHANNEL's user limit to N.
|
|
|
|
Expect ONOFF to be `on' when the mode is being enabled and `off'
|
|
|
|
otherwise. And because this mode is of \"type C\", expect N to
|
|
|
|
be non-nil only when enabling."
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (or (not (eq onoff 'on))
|
2014-11-08 20:51:43 -05:00
|
|
|
(and (stringp n) (string-match "^[0-9]+$" n)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-with-buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(channel)
|
|
|
|
(cond ((eq onoff 'on) (setq erc-channel-user-limit (string-to-number n)))
|
|
|
|
(t (setq erc-channel-user-limit nil))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-update-channel-key (channel onoff key)
|
2015-11-17 15:28:50 -08:00
|
|
|
"Update CHANNEL's key to KEY if ONOFF is `on' or to nil if it's `off'."
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-with-buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(channel)
|
|
|
|
(cond ((eq onoff 'on) (setq erc-channel-key key))
|
|
|
|
(t (setq erc-channel-key nil)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-handle-user-status-change (type nlh &optional l)
|
|
|
|
"Handle changes in any user's status.
|
|
|
|
|
|
|
|
So far, only nick change is handled.
|
|
|
|
|
|
|
|
Generally, the TYPE argument is a symbol describing the change type, NLH is
|
|
|
|
a list containing the original nickname, login name and hostname for the user,
|
|
|
|
and L is a list containing additional TYPE-specific arguments.
|
|
|
|
|
|
|
|
So far the following TYPE/L pairs are supported:
|
|
|
|
|
2014-11-08 20:51:43 -05:00
|
|
|
Event TYPE L
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2015-09-03 15:31:12 -07:00
|
|
|
nickname change `nick' (NEW-NICK)"
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-log (format "user-change: type: %S nlh: %S l: %S" type nlh l))
|
|
|
|
(cond
|
|
|
|
;; nickname change
|
|
|
|
((equal type 'nick)
|
|
|
|
t)
|
|
|
|
(t
|
|
|
|
nil)))
|
|
|
|
|
|
|
|
(defun erc-highlight-notice (s)
|
|
|
|
"Highlight notice message S and return it.
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
See also variable `erc-notice-highlight-type'."
|
2006-01-29 13:08:58 +00:00
|
|
|
(cond
|
|
|
|
((eq erc-notice-highlight-type 'prefix)
|
|
|
|
(erc-put-text-property 0 (length erc-notice-prefix)
|
2016-04-07 14:23:18 +02:00
|
|
|
'font-lock-face 'erc-notice-face s)
|
2006-01-29 13:08:58 +00:00
|
|
|
s)
|
|
|
|
((eq erc-notice-highlight-type 'all)
|
2016-04-07 14:23:18 +02:00
|
|
|
(erc-put-text-property 0 (length s) 'font-lock-face 'erc-notice-face s)
|
2006-01-29 13:08:58 +00:00
|
|
|
s)
|
|
|
|
(t s)))
|
|
|
|
|
|
|
|
(defun erc-make-notice (message)
|
|
|
|
"Notify the user of MESSAGE."
|
|
|
|
(when erc-minibuffer-notice
|
|
|
|
(message "%s" message))
|
|
|
|
(erc-highlight-notice (concat erc-notice-prefix message)))
|
|
|
|
|
|
|
|
(defun erc-highlight-error (s)
|
|
|
|
"Highlight error message S and return it."
|
2016-04-07 14:23:18 +02:00
|
|
|
(erc-put-text-property 0 (length s) 'font-lock-face 'erc-error-face s)
|
2006-01-29 13:08:58 +00:00
|
|
|
s)
|
|
|
|
|
2023-06-24 18:33:20 -07:00
|
|
|
(defun erc-put-text-property (start end property value &optional object)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Set text-property for an object (usually a string).
|
|
|
|
START and END define the characters covered.
|
|
|
|
PROPERTY is the text-property set, usually the symbol `face'.
|
|
|
|
VALUE is the value for the text-property, usually a face symbol such as
|
|
|
|
the face `bold' or `erc-pal-face'.
|
|
|
|
OBJECT is a string which will be modified and returned.
|
|
|
|
OBJECT is modified without being copied first.
|
|
|
|
|
|
|
|
You can redefine or `defadvice' this function in order to add
|
2023-06-24 18:33:20 -07:00
|
|
|
EmacsSpeak support."
|
Restore missing metadata props in erc-display-line
* etc/ERC-NEWS: Designate `erc-display-message' as the favored means
of inserting messages.
* lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing
`erc-ts' text property, when present, for the current message time.
* lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc
string and declare the former an obsolete alias for the latter,
`erc-insert-line'. Have `erc-log' label say `erc-display-message'
even though this function is actually `erc-insert-line'.
(erc-display-line): Convert to a thin wrapper around
`erc-display-message', and move its existing body to a new internal
function, `erc--route-insertion'.
(erc--route-insertion): Adopt former body of `erc-display-line', now a
convenience wrapper around `erc-display-message'. Copy
`erc--msg-props' hash table when inserting a message in multiple
buffers. At present, only `erc-server-QUIT' uses this facility, so
such a move shouldn't impact performance in any measurable way. Also,
improve readability with at most one recursive call for the
fall-through case.
(erc--compose-text-properties, erc--merge-text-properties-p): Rename
former to latter to avoid confusion with `composition' property.
(erc-display-message): Update doc string. Attempt to adapt a non-nil
TYPE parameter for use as the value of the `erc-msg' text property
before resorting to a value of `unknown'. But only do this when
PARSED is nil, and MSG is a string. Call `erc--route-insertion'
instead of `erc-display-line'. Use new name for
`erc--compose-text-properties'.
(erc-put-text-property): Update name of variable
`erc--compose-text-properties'.
* test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock
`erc--route-insertion' instead of `erc-display-line'.
* test/lisp/erc/erc-scenarios-display-message.el: New file.
* test/lisp/erc/erc-tests.el (erc--route-insertion): New test.
* test/lisp/erc/resources/base/display-message/multibuf.eld: New test
data.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
(Bug#60936)
2023-10-15 17:22:22 -07:00
|
|
|
(if erc--merge-text-properties-p
|
2023-06-24 18:33:20 -07:00
|
|
|
(erc--merge-prop start end property value object)
|
|
|
|
(put-text-property start end property value object)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2022-06-16 01:20:49 -07:00
|
|
|
(defalias 'erc-list 'ensure-list)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2023-09-01 20:05:35 -07:00
|
|
|
(defconst erc--parse-user-regexp-pedantic
|
2023-08-18 18:04:22 -07:00
|
|
|
(rx bot (? (? (group (+ (not (any "!@\r\n"))))) "!")
|
|
|
|
(? (? (group (+ nonl))) "@")
|
|
|
|
(? (group (+ nonl))) eot))
|
2023-09-01 20:05:35 -07:00
|
|
|
|
|
|
|
(defconst erc--parse-user-regexp-legacy
|
|
|
|
"^\\([^!\n]*\\)!\\([^@\n]*\\)@\\(.*\\)$")
|
|
|
|
|
|
|
|
(defvar erc--parse-user-regexp erc--parse-user-regexp-legacy)
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-parse-user (string)
|
|
|
|
"Parse STRING as a user specification (nick!login@host).
|
|
|
|
|
|
|
|
Return a list of the three separate tokens."
|
|
|
|
(cond
|
2023-09-01 20:05:35 -07:00
|
|
|
((string-match erc--parse-user-regexp string)
|
2006-01-29 13:08:58 +00:00
|
|
|
(list (match-string 1 string)
|
2014-11-08 20:51:43 -05:00
|
|
|
(match-string 2 string)
|
|
|
|
(match-string 3 string)))
|
2006-01-29 13:08:58 +00:00
|
|
|
;; Some bogus bouncers send Nick!(null), try to live with that.
|
2006-04-11 22:09:49 +00:00
|
|
|
((string-match "^\\([^!\n]*\\)!\\(.*\\)$" string)
|
2006-01-29 13:08:58 +00:00
|
|
|
(list (match-string 1 string)
|
2014-11-08 20:51:43 -05:00
|
|
|
""
|
|
|
|
(match-string 2 string)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(t
|
|
|
|
(list string "" ""))))
|
|
|
|
|
2023-08-18 18:04:22 -07:00
|
|
|
(defun erc--parse-nuh (string)
|
|
|
|
"Match STRING against `erc--parse-user-regexp-pedantic'.
|
|
|
|
Return matching groups or nil. Interpret a lone token or one
|
|
|
|
with only a leading \"!\" as a host. See associated unit test
|
|
|
|
for precise behavior."
|
|
|
|
(when (string-match erc--parse-user-regexp-pedantic string)
|
|
|
|
(list (match-string 1 string)
|
|
|
|
(match-string 2 string)
|
|
|
|
(match-string 3 string))))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-extract-nick (string)
|
|
|
|
"Return the nick corresponding to a user specification STRING.
|
|
|
|
|
|
|
|
See also `erc-parse-user'."
|
|
|
|
(car (erc-parse-user string)))
|
|
|
|
|
|
|
|
(defun erc-put-text-properties (start end properties
|
2014-11-08 20:51:43 -05:00
|
|
|
&optional object value-list)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Set text-properties for OBJECT.
|
|
|
|
|
|
|
|
START and END describe positions in OBJECT.
|
|
|
|
If VALUE-LIST is nil, set each property in PROPERTIES to t, else set
|
|
|
|
each property to the corresponding value in VALUE-LIST."
|
|
|
|
(unless value-list
|
2013-08-22 00:06:45 -04:00
|
|
|
(setq value-list (mapcar (lambda (_x) t)
|
2014-11-08 20:51:43 -05:00
|
|
|
properties)))
|
2008-06-19 04:59:11 +00:00
|
|
|
(while (and properties value-list)
|
|
|
|
(erc-put-text-property
|
|
|
|
start end (pop properties) (pop value-list) object)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;;; Input area handling:
|
|
|
|
|
|
|
|
(defun erc-beg-of-input-line ()
|
|
|
|
"Return the value of `point' at the beginning of the input line.
|
|
|
|
|
|
|
|
Specifically, return the position of `erc-insert-marker'."
|
|
|
|
(or (and (boundp 'erc-insert-marker)
|
2014-11-08 20:51:43 -05:00
|
|
|
(markerp erc-insert-marker))
|
2006-01-29 13:08:58 +00:00
|
|
|
(error "erc-insert-marker has no value, please report a bug"))
|
|
|
|
(marker-position erc-insert-marker))
|
|
|
|
|
|
|
|
(defun erc-end-of-input-line ()
|
|
|
|
"Return the value of `point' at the end of the input line."
|
|
|
|
(point-max))
|
|
|
|
|
2012-11-30 12:18:22 +08:00
|
|
|
(defvar erc-last-input-time 0
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
"Time of last successful call to `erc-send-current-line'.
|
2012-11-30 12:18:22 +08:00
|
|
|
If that function has never been called, the value is 0.")
|
|
|
|
|
2017-02-17 18:38:09 -05:00
|
|
|
(defcustom erc-accidental-paste-threshold-seconds 0.2
|
2012-11-30 12:18:22 +08:00
|
|
|
"Minimum time, in seconds, before sending new lines via IRC.
|
2014-01-30 22:39:51 -08:00
|
|
|
If the value is a number, `erc-send-current-line' signals an error
|
|
|
|
if its previous invocation was fewer than this many seconds ago.
|
2012-11-30 12:18:22 +08:00
|
|
|
If the value is nil, `erc-send-current-line' always considers any
|
2023-05-17 05:27:13 -07:00
|
|
|
submitted line to be intentional.
|
|
|
|
|
|
|
|
This option mainly prevents text accidentally entered into Emacs
|
|
|
|
from being sent to the server. Offending sources include
|
|
|
|
terminal multiplexers, desktop-automation scripts, and anything
|
|
|
|
capable of rapidly submitting successive lines of prompt input.
|
2023-07-15 19:11:37 -07:00
|
|
|
For example, if you could somehow manage to type \"one \\`RET'
|
|
|
|
two \\`RET' three \\`RET'\" at the prompt in less than
|
|
|
|
`erc-accidental-paste-threshold-seconds', ERC would send \"one\"
|
2023-05-17 05:27:13 -07:00
|
|
|
to the server, leave \"two\" at the prompt, and insert \"three\"
|
|
|
|
into an \"overflow\" buffer. See `erc-inhibit-multiline-input'
|
|
|
|
and `erc-warn-about-blank-lines' for suppression involving input
|
|
|
|
yanked from the clipboard or the kill ring, which is a related
|
|
|
|
but separate concern.
|
|
|
|
|
|
|
|
Users of terminal multiplexers, in particular, should look into
|
|
|
|
support for \"bracketed pasting\", provided on the Emacs side by
|
|
|
|
libraries like `xterm' (and usually enabled by default). When
|
|
|
|
everything's working smoothly, Emacs transparently arranges for
|
|
|
|
pasted text to appear on the kill ring, regardless of any
|
|
|
|
read-only warnings you may encounter. And when point is in the
|
|
|
|
prompt area, ERC automatically yanks that text for previewing but
|
|
|
|
holds off on submitting it, for obvious reasons."
|
2012-11-30 12:18:22 +08:00
|
|
|
:group 'erc
|
2017-02-17 18:38:09 -05:00
|
|
|
:version "26.1"
|
2012-11-30 12:18:22 +08:00
|
|
|
:type '(choice number (other :tag "disabled" nil)))
|
|
|
|
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
(defvar erc--input-line-delim-regexp (rx (| (: (? ?\r) ?\n) ?\r)))
|
|
|
|
|
2023-04-17 23:09:49 -07:00
|
|
|
(defvar erc-command-regexp "^/\\([A-Za-z']+\\)\\(\\s-+.*\\|\\s-*\\)$"
|
|
|
|
"Regular expression used for matching commands in ERC.")
|
|
|
|
|
2022-04-27 02:27:32 -07:00
|
|
|
(defun erc--check-prompt-input-for-excess-lines (_ lines)
|
|
|
|
"Return non-nil when trying to send too many LINES."
|
|
|
|
(when erc-inhibit-multiline-input
|
2023-04-30 07:12:56 -07:00
|
|
|
(let ((max (if (eq erc-inhibit-multiline-input t)
|
2022-04-27 02:27:32 -07:00
|
|
|
2
|
|
|
|
erc-inhibit-multiline-input))
|
|
|
|
(seen 0)
|
2023-04-30 07:12:56 -07:00
|
|
|
last msg)
|
|
|
|
(while (and lines (setq last (pop lines)) (< (cl-incf seen) max)))
|
2022-04-27 02:27:32 -07:00
|
|
|
(when (= seen max)
|
2023-04-30 07:12:56 -07:00
|
|
|
(push last lines)
|
|
|
|
(setq msg
|
|
|
|
(format "-- exceeded by %d (%d chars)"
|
|
|
|
(length lines)
|
|
|
|
(apply #'+ (mapcar #'length lines))))
|
2022-04-27 02:27:32 -07:00
|
|
|
(unless (and erc-ask-about-multiline-input
|
|
|
|
(y-or-n-p (concat "Send input " msg "?")))
|
|
|
|
(concat "Too many lines " msg))))))
|
|
|
|
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
(defun erc--check-prompt-input-for-something (string _)
|
|
|
|
(when (string-empty-p string)
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
(if erc-warn-about-blank-lines
|
|
|
|
"Blank line - ignoring..."
|
|
|
|
'invalid)))
|
|
|
|
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
(defun erc--count-blank-lines (lines)
|
|
|
|
"Report on the number of whitespace-only and empty LINES.
|
|
|
|
Return a list of (BLANKS TO-PAD TO-STRIP). Expect caller to know
|
|
|
|
that BLANKS includes non-empty whitespace-only lines and that no
|
|
|
|
padding or stripping has yet occurred."
|
|
|
|
(let ((real 0) (total 0) (pad 0) (strip 0))
|
|
|
|
(dolist (line lines)
|
|
|
|
(if (string-match (rx bot (* (in " \t\f")) eot) line)
|
|
|
|
(progn
|
|
|
|
(cl-incf total)
|
|
|
|
(if (zerop (match-end 0))
|
|
|
|
(cl-incf strip)
|
|
|
|
(cl-incf pad strip)
|
|
|
|
(setq strip 0)))
|
|
|
|
(cl-incf real)
|
|
|
|
(unless (zerop strip)
|
|
|
|
(cl-incf pad strip)
|
|
|
|
(setq strip 0))))
|
|
|
|
(when (and (zerop real) (not (zerop total)) (= total (+ pad strip)))
|
|
|
|
(cl-incf strip (1- pad))
|
|
|
|
(setq pad 1))
|
|
|
|
(list total pad strip)))
|
|
|
|
|
|
|
|
(defvar erc--check-prompt-explanation nil
|
|
|
|
"List of strings to print if no validator returns non-nil.")
|
|
|
|
|
|
|
|
(defun erc--check-prompt-input-for-multiline-blanks (_ lines)
|
|
|
|
"Return non-nil when multiline prompt input has blank LINES.
|
|
|
|
Consider newlines to be intervening delimiters, meaning the empty
|
|
|
|
\"logical\" line between a trailing newline and `eob' constitutes
|
|
|
|
a separate message."
|
|
|
|
(pcase-let ((`(,total ,pad ,strip)(erc--count-blank-lines lines)))
|
|
|
|
(cond ((zerop total) nil)
|
|
|
|
((and erc-warn-about-blank-lines erc-send-whitespace-lines)
|
|
|
|
(let (msg args)
|
|
|
|
(unless (zerop strip)
|
|
|
|
(push "stripping (%d)" msg)
|
|
|
|
(push strip args))
|
|
|
|
(unless (zerop pad)
|
|
|
|
(when msg
|
|
|
|
(push "and" msg))
|
|
|
|
(push "padding (%d)" msg)
|
|
|
|
(push pad args))
|
|
|
|
(when msg
|
|
|
|
(push "blank" msg)
|
|
|
|
(push (if (> (apply #'+ args) 1) "lines" "line") msg))
|
|
|
|
(when msg
|
|
|
|
(setf msg (nreverse msg)
|
|
|
|
(car msg) (capitalize (car msg))))
|
|
|
|
(when msg
|
|
|
|
(push (apply #'format (string-join msg " ") (nreverse args))
|
|
|
|
erc--check-prompt-explanation)
|
|
|
|
nil)))
|
|
|
|
(erc-warn-about-blank-lines
|
|
|
|
(concat (if (= total 1)
|
|
|
|
(if (zerop strip) "Blank" "Trailing")
|
|
|
|
(if (= total strip)
|
|
|
|
(format "%d trailing" strip)
|
|
|
|
(format "%d blank" total)))
|
|
|
|
(and (> total 1) (/= total strip) (not (zerop strip))
|
|
|
|
(format " (%d trailing)" strip))
|
|
|
|
(if (= total 1) " line" " lines")
|
|
|
|
" detected (see `erc-send-whitespace-lines')"))
|
|
|
|
(erc-send-whitespace-lines nil)
|
|
|
|
(t 'invalid))))
|
|
|
|
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
(defun erc--check-prompt-input-for-point-in-bounds (_ _)
|
|
|
|
"Return non-nil when point is before prompt."
|
|
|
|
(when (< (point) (erc-beg-of-input-line))
|
|
|
|
"Point is not in the input area"))
|
|
|
|
|
2023-11-27 19:41:09 -08:00
|
|
|
;; Originally, `erc-send-current-line' inhibited sends whenever a
|
|
|
|
;; server buffer was missing. In 2007, this was narrowed to
|
|
|
|
;; occurrences involving process-dependent commands. However, the
|
|
|
|
;; accompanying error message, which was identical to that emitted by
|
|
|
|
;; `erc-server-send', "ERC: No process running", was always inaccurate
|
|
|
|
;; because a server buffer can be alive and its process dead.
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
(defun erc--check-prompt-input-for-running-process (string _)
|
2023-11-27 19:41:09 -08:00
|
|
|
"Return non-nil if STRING is a slash command missing a process.
|
|
|
|
Also do so when the server buffer has been killed."
|
|
|
|
;; Even if the server buffer has been killed, the user should still
|
|
|
|
;; be able to /reconnect and recall previous commands.
|
|
|
|
(and (not (erc-command-no-process-p string))
|
|
|
|
(or (and (not (erc-server-buffer-live-p)) "Server buffer missing")
|
|
|
|
(and (not (erc-server-process-alive)) "Process not running"))))
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
|
2023-04-17 23:09:49 -07:00
|
|
|
(defun erc--check-prompt-input-for-multiline-command (line lines)
|
|
|
|
"Return non-nil when non-blank lines follow a command line."
|
|
|
|
(when (and (cdr lines)
|
|
|
|
(string-match erc-command-regexp line)
|
|
|
|
(seq-drop-while #'string-empty-p (reverse (cdr lines))))
|
|
|
|
"Excess input after command line"))
|
|
|
|
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
(defvar erc--check-prompt-input-functions
|
|
|
|
'(erc--check-prompt-input-for-point-in-bounds
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
erc--check-prompt-input-for-something
|
2023-06-09 21:00:03 -07:00
|
|
|
erc--check-prompt-input-for-multiline-command
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
erc--check-prompt-input-for-multiline-blanks
|
2022-04-27 02:27:32 -07:00
|
|
|
erc--check-prompt-input-for-running-process
|
2023-06-09 21:00:03 -07:00
|
|
|
erc--check-prompt-input-for-excess-lines)
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
"Validators for user input typed at prompt.
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
Called with two arguments: the current input submitted by the
|
|
|
|
user, as a string, along with the same input as a list of
|
|
|
|
strings. If any member function returns non-nil, ERC abandons
|
|
|
|
processing and leaves pending input untouched in the prompt area.
|
|
|
|
When the returned value is a string, ERC passes it to
|
|
|
|
`user-error'. Any other non-nil value tells ERC to abort
|
|
|
|
silently. If all members return nil, and the variable
|
|
|
|
`erc--check-prompt-explanation' is a nonempty list of strings,
|
|
|
|
ERC prints them as a single message joined by newlines.")
|
2023-04-30 07:12:56 -07:00
|
|
|
|
|
|
|
(defun erc--run-input-validation-checks (state)
|
|
|
|
"Run input checkers from STATE, an `erc--input-split' object."
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
(let* ((erc--check-prompt-explanation nil)
|
|
|
|
(msg (run-hook-with-args-until-success
|
|
|
|
'erc--check-prompt-input-functions
|
|
|
|
(erc--input-split-string state)
|
|
|
|
(erc--input-split-lines state))))
|
|
|
|
(cond ((stringp msg) (user-error msg))
|
|
|
|
(msg (push msg (erc--input-split-abortp state)))
|
|
|
|
(erc--check-prompt-explanation
|
|
|
|
(message "%s" (string-join (nreverse erc--check-prompt-explanation)
|
|
|
|
"\n"))))))
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
|
2023-06-09 21:00:03 -07:00
|
|
|
(defun erc--inhibit-slash-cmd-insertion (state)
|
|
|
|
"Don't insert STATE object's message if it's a \"slash\" command."
|
|
|
|
(when (erc--input-split-cmdp state)
|
|
|
|
(setf (erc--input-split-insertp state) nil)))
|
|
|
|
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(defun erc--make-input-split (string)
|
|
|
|
(make-erc--input-split
|
|
|
|
:string string
|
|
|
|
:insertp erc-insert-this
|
|
|
|
:sendp erc-send-this
|
|
|
|
:lines (split-string string erc--input-line-delim-regexp)
|
|
|
|
:cmdp (string-match erc-command-regexp string)))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-send-current-line ()
|
|
|
|
"Parse current line and send it to IRC."
|
|
|
|
(interactive)
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-22 18:32:31 -08:00
|
|
|
(let ((now (current-time)))
|
2012-11-30 12:18:22 +08:00
|
|
|
(if (or (not erc-accidental-paste-threshold-seconds)
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-22 18:32:31 -08:00
|
|
|
(time-less-p erc-accidental-paste-threshold-seconds
|
|
|
|
(time-subtract now erc-last-input-time)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(save-restriction
|
2020-10-16 17:36:20 +02:00
|
|
|
;; If there's an abbrev at the end of the line, expand it.
|
|
|
|
(when (and abbrev-mode
|
|
|
|
(eolp))
|
|
|
|
(expand-abbrev))
|
2014-11-08 20:51:43 -05:00
|
|
|
(widen)
|
2023-04-30 07:12:56 -07:00
|
|
|
(let* ((str (erc-user-input))
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(state (erc--make-input-split str)))
|
2023-04-30 07:12:56 -07:00
|
|
|
(run-hook-with-args 'erc--input-review-functions state)
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
(when-let (((not (erc--input-split-abortp state)))
|
|
|
|
(inhibit-read-only t)
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(erc--current-line-input-split state)
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
(old-buf (current-buffer)))
|
2023-11-08 21:20:54 -08:00
|
|
|
(progn ; unprogn this during next major surgery
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-set-active-buffer (current-buffer))
|
|
|
|
;; Kill the input and the prompt
|
2023-02-19 21:33:36 -08:00
|
|
|
(delete-region erc-input-marker (erc-end-of-input-line))
|
2014-11-08 20:51:43 -05:00
|
|
|
(unwind-protect
|
2023-04-30 07:12:56 -07:00
|
|
|
(erc--send-input-lines (erc--run-send-hooks state))
|
2014-11-08 20:51:43 -05:00
|
|
|
;; Fix the buffer if the command didn't kill it
|
|
|
|
(when (buffer-live-p old-buf)
|
|
|
|
(with-current-buffer old-buf
|
|
|
|
(save-restriction
|
|
|
|
(widen)
|
|
|
|
(let ((buffer-modified (buffer-modified-p)))
|
|
|
|
(set-buffer-modified-p buffer-modified))))))
|
|
|
|
|
|
|
|
;; Only when last hook has been run...
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
(run-hook-with-args 'erc-send-completed-hook str)))
|
|
|
|
(setq erc-last-input-time now)))
|
2012-11-30 12:18:22 +08:00
|
|
|
(switch-to-buffer "*ERC Accidental Paste Overflow*")
|
|
|
|
(lwarn 'erc :warning
|
2014-11-08 20:51:43 -05:00
|
|
|
"You seem to have accidentally pasted some text!"))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-user-input ()
|
|
|
|
"Return the input of the user in the current buffer."
|
2009-01-03 23:11:06 +00:00
|
|
|
(buffer-substring-no-properties
|
2006-01-29 13:08:58 +00:00
|
|
|
erc-input-marker
|
|
|
|
(erc-end-of-input-line)))
|
|
|
|
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
(defun erc--discard-trailing-multiline-nulls (state)
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
"Remove trailing empty lines from STATE, an `erc--input-split' object.
|
|
|
|
When all lines are empty, remove all but the first."
|
|
|
|
(when (erc--input-split-lines state)
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
(let ((reversed (nreverse (erc--input-split-lines state))))
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
(while (and (cdr reversed) (string-empty-p (car reversed)))
|
2023-04-17 23:09:49 -07:00
|
|
|
(setq reversed (cdr reversed)))
|
|
|
|
(setf (erc--input-split-lines state) (nreverse reversed)))))
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
|
2023-04-17 00:01:15 -07:00
|
|
|
(defun erc--split-lines (state)
|
|
|
|
"Partition non-command input into lines of protocol-compliant length."
|
|
|
|
;; Prior to ERC 5.6, line splitting used to be predicated on
|
|
|
|
;; `erc-flood-protect' being non-nil.
|
|
|
|
(unless (erc--input-split-cmdp state)
|
|
|
|
(setf (erc--input-split-lines state)
|
|
|
|
(mapcan #'erc--split-line (erc--input-split-lines state)))))
|
|
|
|
|
2023-12-01 13:54:12 -08:00
|
|
|
(defun erc--input-ensure-hook-context ()
|
|
|
|
(unless (erc--input-split-p erc--current-line-input-split)
|
|
|
|
(error "Invoked outside of `erc-pre-send-functions'")))
|
|
|
|
|
|
|
|
(defun erc-input-refoldp (_)
|
|
|
|
"Impersonate accessor for phony `erc-input' `refoldp' slot.
|
|
|
|
This function only works inside `erc-pre-send-functions' members."
|
|
|
|
(declare (gv-setter (lambda (v)
|
|
|
|
`(progn
|
|
|
|
(erc--input-ensure-hook-context)
|
|
|
|
(setf (erc--input-split-refoldp
|
|
|
|
erc--current-line-input-split)
|
|
|
|
,v)))))
|
|
|
|
(erc--input-ensure-hook-context)
|
|
|
|
(erc--input-split-refoldp erc--current-line-input-split))
|
|
|
|
|
2023-04-30 07:12:56 -07:00
|
|
|
(defun erc--run-send-hooks (lines-obj)
|
|
|
|
"Run send-related hooks that operate on the entire prompt input.
|
|
|
|
Sequester some of the back and forth involved in honoring old
|
|
|
|
interfaces, such as the reconstituting and re-splitting of
|
|
|
|
multiline input. Optionally readjust lines to protocol length
|
|
|
|
limits and pad empty ones, knowing full well that additional
|
|
|
|
processing may still corrupt messages before they reach the send
|
|
|
|
queue. Expect LINES-OBJ to be an `erc--input-split' object."
|
Improve erc-warn-about-blank-lines behavior
* etc/ERC-NEWS: Mention more detailed feedback when option
`erc-warn-about-blank-lines' is non-nil.
* lisp/erc/erc-common.el (erc--input-split): Add `abortp' slot to
allow a premature exit while validating prompt input.
* lisp/erc/erc.el (erc-warn-about-blank-lines): Clarify meaning of
"blank lines" in doc string, and mention interaction with
companion option `erc-send-whitespace-lines'.
(erc-inhibit-multiline-input): Fix inaccurate description in doc
string.
(erc--input-review-functions): Move
`erc--discard-trailing-multiline-nulls' to end of list, after
`erc--run-input-validation-checks' so that the latter doesn't have to
resplit the original input string in order to issue feedback.
(erc--blank-in-multiline-input-p): Remove unused internal function
originally slated to be part of ERC 5.6.
(erc--check-prompt-input-for-something): New trivial validation
function to check if the input is empty.
(erc--count-blank-lines): New function that tallies up the number of
blank and whitespace-only lines in the current input. One downside of
this design is that this function's conclusions aren't shared with
`erc--discard-trailing-multiline-nulls', which must decide on its own
how many lines to strip.
(erc--check-prompt-explanation): New variable.
(erc--check-prompt-input-for-multiline-blanks): Rework significantly
to provide more informative messages and more sensible behavior for
common cases with respect to relevant option values.
(erc--check-prompt-input-functions): Add new validation function
`erc--check-prompt-for-something'.
(erc--run-input-validation-checks): Set `abortp' slot of
`erc--input-split' when hooks return a non-string, rather than
generate an unhelpful fallback message. Also print a message when
the variable `erc--check-prompt-explanation' is non-nil.
(erc-send-current-line): When the `abortp' slot of the current
`erc--input-split' object is non-nil, forgo normal input processing.
This fixes a regression in 5.6-git, which previously emitted an error
message when it should have just exited the command.
(erc--discard-trailing-multiline-nulls): Always run, regardless of
`erc-send-whitespace-lines', and leave a blank line behind when
stripping a message consisting of only blank lines.
(erc--run-send-hooks): Always run hooks and surrounding logic rather
than only when hooks are populated.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Add assertion and
use default value for `erc--input-review-functions'.
(erc-ring-previous-command): Use default value for
`erc--input-review-functions' and ensure `erc-current-nick' does not
error.
(erc--blank-in-multiline-input-p): Remove obsolete test.
(erc--check-prompt-input-functions): Update expected message.
(erc--discard-trailing-multiline-nulls, erc--count-blank-lines): New
tests.
(erc-tests--check-prompt-input--expect,
erc-tests--check-prompt-input-messages): New helper variables.
(erc--check-prompt-input-for-multiline-blanks,
erc--check-prompt-input-for-multiline-blanks/explanations): New tests.
(erc-send-whitespace-lines): Expect hook-processing logic to pad empty
lines instead of deferring to `erc-send-input-line-function'.
(Bug#66073)
2023-09-15 06:08:55 -07:00
|
|
|
(progn ; FIXME remove `progn' after code review.
|
2023-04-30 07:12:56 -07:00
|
|
|
(with-suppressed-warnings ((lexical str) (obsolete erc-send-this))
|
|
|
|
(defvar str) ; see note in string `erc-send-input'.
|
|
|
|
(let* ((str (string-join (erc--input-split-lines lines-obj) "\n"))
|
|
|
|
(erc-send-this (erc--input-split-sendp lines-obj))
|
|
|
|
(erc-insert-this (erc--input-split-insertp lines-obj))
|
|
|
|
(state (progn
|
|
|
|
;; This may change `str' and `erc-*-this'.
|
|
|
|
(run-hook-with-args 'erc-send-pre-hook str)
|
|
|
|
(make-erc-input :string str
|
|
|
|
:insertp erc-insert-this
|
|
|
|
:sendp erc-send-this))))
|
|
|
|
(run-hook-with-args 'erc-pre-send-functions state)
|
|
|
|
(setf (erc--input-split-sendp lines-obj) (erc-input-sendp state)
|
|
|
|
(erc--input-split-insertp lines-obj) (erc-input-insertp state)
|
|
|
|
;; See note in test of same name re trailing newlines.
|
|
|
|
(erc--input-split-lines lines-obj)
|
2023-09-18 03:39:57 -07:00
|
|
|
(let ((lines (split-string (erc-input-string state)
|
|
|
|
erc--input-line-delim-regexp)))
|
|
|
|
(if erc--allow-empty-outgoing-lines-p
|
|
|
|
lines
|
|
|
|
(cl-nsubst " " "" lines :test #'equal))))
|
2023-12-01 13:54:12 -08:00
|
|
|
(when (erc--input-split-refoldp lines-obj)
|
2023-04-30 07:12:56 -07:00
|
|
|
(erc--split-lines lines-obj)))))
|
|
|
|
(when (and (erc--input-split-cmdp lines-obj)
|
|
|
|
(cdr (erc--input-split-lines lines-obj)))
|
|
|
|
(user-error "Multiline command detected" ))
|
|
|
|
lines-obj)
|
|
|
|
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(cl-defmethod erc--send-input-lines (lines-obj)
|
2023-04-30 07:12:56 -07:00
|
|
|
"Send lines in `erc--input-split-lines' object LINES-OBJ."
|
|
|
|
(when (erc--input-split-sendp lines-obj)
|
|
|
|
(dolist (line (erc--input-split-lines lines-obj))
|
2023-06-09 21:00:03 -07:00
|
|
|
(when (erc--input-split-insertp lines-obj)
|
Revive erc-command-indicator as new module
* doc/misc/erc.texi: Add entry for `command-indicator' to Modules
chapter.
* etc/ERC-NEWS: Mention new module `command-indicator'.
* lisp/erc/erc-goodies.el (erc-noncommands-list): Replace the
nonexistent `erc-cmd-SMV' with function `erc-cmd-SAY'.
(erc-noncommands-mode, erc-noncommands-enable,
erc-noncommands-disable): Deprecate this module because it's a no-op.
(erc-command-indicator-face, erc-command-indicator): Migrate from main
library.
(erc-command-indicator-mode, erc-command-indicator-enable,
erc-command-indicator-disable): New module to take the spiritual place
of `noncommands'.
(erc-command-indicator): Move function here from main library, along
with option namesake mentioned above.
(erc-command-indicator-toggle-hidden): New command to toggle echoed
command-line visibility.
(erc--command-indicator-permit-insertion): New function.
(erc--command-indicator-display): New function, a slightly revised
version of the old `erc-display-command' from the main library. Its
only call site was removed back in d1036d288de "backport: erc
bugfixes". However, references were left behind to associated assets,
like `erc-command-indicator', etc. The function was later commented
out in 0c599ee2e2c "* lisp/erc/erc.el: Use `run-hook-with-args` for
`erc-pre-send-functions`", and then removed by a63ed6f78a6 "Remove
duplicate ERC prompt on reconnect".
* lisp/erc/erc-match.el (erc-match-toggle-hidden-fools): Use new
non-module-specific name for `erc-match--toggle-hidden'.
(erc-match--toggle-hidden): Move to main library for shared use by
other modules.
* lisp/erc/erc.el (erc-hide-prompt): Leave note explaining updated
role.
(erc-command-indicator): Move option and function of same name to
erc-goodies.
(erc-command-indicator-face): Move to erc-goodies.
(erc-modules): Remove module `noncommands' from standard value and
Custom set. Add `command-indicator' to set.
(erc--toggle-hidden): "New" function, a rebranded version of the
utility `erc-match--toggle-hidden' from erc-match.
(erc--send-input-lines): Accommodate modules wanting alternate
insertion functions.
(erc-load-irc-script-lines): Account for `erc-command-indicator' no
longer being defined in this library.
* test/lisp/erc/erc-scenarios-base-send-message.el
(erc-scenarios-base-send-message--command-indicator): New test.
* test/lisp/erc/erc-tests.el (erc-tests--modules): Remove
deprecated module `noncommands' from manifest. (Bug#67031)
2023-11-10 13:34:31 -08:00
|
|
|
(if (functionp (erc--input-split-insertp lines-obj))
|
|
|
|
(funcall (erc--input-split-insertp lines-obj) line)
|
|
|
|
(erc-display-msg line)))
|
2023-04-30 07:12:56 -07:00
|
|
|
(erc-process-input-line (concat line "\n")
|
|
|
|
(null erc-flood-protect)
|
|
|
|
(not (erc--input-split-cmdp lines-obj))))))
|
|
|
|
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
(defun erc-send-input (input &optional skip-ws-chk)
|
2021-09-14 08:43:18 +02:00
|
|
|
"Treat INPUT as typed in by the user.
|
|
|
|
It is assumed that the input and the prompt is already deleted.
|
|
|
|
Return non-nil only if we actually send anything."
|
2006-01-29 13:08:58 +00:00
|
|
|
;; Handle different kinds of inputs
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
(if (and (not skip-ws-chk)
|
|
|
|
(erc--check-prompt-input-for-multiline-blanks
|
|
|
|
input (split-string input erc--input-line-delim-regexp)))
|
|
|
|
(when erc-warn-about-blank-lines
|
|
|
|
(message "Blank line - ignoring...") ; compat
|
|
|
|
(beep))
|
2019-06-14 14:05:24 +02:00
|
|
|
;; This dynamic variable is used by `erc-send-pre-hook'. It's
|
|
|
|
;; obsolete, and when it's finally removed, this binding should
|
|
|
|
;; also be removed.
|
|
|
|
(with-suppressed-warnings ((lexical str))
|
2019-06-26 10:24:59 -04:00
|
|
|
(defvar str))
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((str input)
|
2019-06-19 17:07:36 +02:00
|
|
|
(erc-insert-this t)
|
|
|
|
(erc-send-this t)
|
|
|
|
state)
|
2019-06-13 02:03:55 +02:00
|
|
|
;; The calling convention of `erc-send-pre-hook' is that it
|
2019-06-14 14:05:24 +02:00
|
|
|
;; should change the dynamic variable `str' or set
|
|
|
|
;; `erc-send-this' to nil. This has now been deprecated:
|
2019-06-14 14:56:04 +02:00
|
|
|
;; Instead `erc-pre-send-functions' is used as a filter to do
|
2019-06-14 14:05:24 +02:00
|
|
|
;; allow both changing and suppressing the string.
|
2006-01-29 13:08:58 +00:00
|
|
|
(run-hook-with-args 'erc-send-pre-hook input)
|
2021-01-04 00:21:02 -05:00
|
|
|
(setq state (make-erc-input :string str ;May be != from `input' now!
|
2019-06-19 17:07:36 +02:00
|
|
|
:insertp erc-insert-this
|
|
|
|
:sendp erc-send-this))
|
2021-01-04 00:21:02 -05:00
|
|
|
(run-hook-with-args 'erc-pre-send-functions state)
|
2019-06-19 17:07:36 +02:00
|
|
|
(when (and (erc-input-sendp state)
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
erc-send-this)
|
2023-04-17 00:01:15 -07:00
|
|
|
(if-let* ((first (split-string (erc-input-string state)
|
|
|
|
erc--input-line-delim-regexp))
|
|
|
|
(split (mapcan #'erc--split-line first))
|
|
|
|
(lines (nreverse (seq-drop-while #'string-empty-p
|
|
|
|
(nreverse split))))
|
|
|
|
((string-match erc-command-regexp (car lines))))
|
|
|
|
(progn
|
|
|
|
;; Asking users what to do here might make more sense.
|
|
|
|
(cl-assert (not (cdr lines)))
|
|
|
|
;; The `force' arg (here t) is ignored for command lines.
|
|
|
|
(erc-process-input-line (concat (car lines) "\n") t nil))
|
|
|
|
(progn ; temporarily preserve indentation
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
(dolist (line lines)
|
2023-04-17 00:01:15 -07:00
|
|
|
(progn ; temporarily preserve indentation
|
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)
2022-03-21 05:40:16 -07:00
|
|
|
(when (erc-input-insertp state)
|
|
|
|
(erc-display-msg line))
|
|
|
|
(erc-process-input-line (concat line "\n")
|
|
|
|
(null erc-flood-protect) t))))
|
|
|
|
t)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-display-msg (line)
|
2023-09-02 13:43:22 -07:00
|
|
|
"Insert LINE into current buffer and run \"send\" hooks.
|
2023-11-08 21:20:54 -08:00
|
|
|
Treat LINE as input submitted interactively at the prompt, such
|
|
|
|
as outgoing chat messages and echoed slash commands."
|
2006-01-29 13:08:58 +00:00
|
|
|
(when erc-insert-this
|
2023-02-19 21:33:36 -08:00
|
|
|
(save-excursion
|
|
|
|
(erc--assert-input-bounds)
|
Don't insert prompt input before markers in ERC
* etc/ERC-NEWS: Update entry in 5.6 section announcing a persistent
prompt.
* lisp/erc/erc-dcc.el (erc-dcc-chat-setup): Use helper
`erc--initialize-markers' to set up prompt.
* lisp/erc/erc.el (erc--initialize-markers): Change
`erc-insert-marker' type to t. Do this to spare modules that want to
remember the current message location from resorting to workarounds,
like leaving a marker one char before the end of a message, which is
not foolproof.
(erc--refresh-prompt): Temporarily change type of `erc-insert-marker'
when inserting prompt.
(erc-display-line-1): Insert incoming message normally instead of
forcing before markers, thus respecting markers left by third parties.
Strictly speaking, this is a breaking change.
(erc-display-msg): Insert normally instead of calling
`insert-before-markers', which was a regression introduced by 05f6fdb9
"Preserve ERC prompt and its bounding markers".
* test/lisp/erc/erc-dcc-tests.el
(erc-dcc-tests--dcc-handle-ctcp-send,
erc-dcc-tests--erc-dcc-do-GET-command): Use helper to initialize
prompt and markers.
* test/lisp/erc/erc-networks-tests.el
(erc-networks--ensure-announced,
erc-networks--rename-server-buffer--existing--reuse,
erc-networks--rename-server-buffer--existing--noreuse,
erc-networks--rename-server-buffer--reconnecting,
erc-networks--rename-server-buffer--id,
erc-networks--rename-server-buffer--existing--live,
erc-networks--rename-server-buffer--local-match,
erc-networks--rename-server-buffer--local-nomatch): Use helper to
initialize prompt and bounding markers.
* test/lisp/erc/erc-stamp-tests.el (erc-stamp-tests--insert-right):
Use `erc--initialize-markers' for setting up prompt.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Adjust assertions
for expected prompt content. (Bug#60936)
2023-06-10 00:17:44 -07:00
|
|
|
(let ((insert-position (marker-position (goto-char erc-insert-marker)))
|
2023-11-08 21:20:54 -08:00
|
|
|
(erc--msg-props (or erc--msg-props
|
2023-09-02 13:43:22 -07:00
|
|
|
(let ((ovs erc--msg-prop-overrides))
|
Double hyphenate internal ERC 5.6 text props
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties. Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936) (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.
2023-12-01 22:30:04 -08:00
|
|
|
(map-into `((erc--msg . msg) ,@(reverse ovs))
|
2023-09-02 13:43:22 -07:00
|
|
|
'hash-table))))
|
2023-02-19 21:33:36 -08:00
|
|
|
beg)
|
Don't insert prompt input before markers in ERC
* etc/ERC-NEWS: Update entry in 5.6 section announcing a persistent
prompt.
* lisp/erc/erc-dcc.el (erc-dcc-chat-setup): Use helper
`erc--initialize-markers' to set up prompt.
* lisp/erc/erc.el (erc--initialize-markers): Change
`erc-insert-marker' type to t. Do this to spare modules that want to
remember the current message location from resorting to workarounds,
like leaving a marker one char before the end of a message, which is
not foolproof.
(erc--refresh-prompt): Temporarily change type of `erc-insert-marker'
when inserting prompt.
(erc-display-line-1): Insert incoming message normally instead of
forcing before markers, thus respecting markers left by third parties.
Strictly speaking, this is a breaking change.
(erc-display-msg): Insert normally instead of calling
`insert-before-markers', which was a regression introduced by 05f6fdb9
"Preserve ERC prompt and its bounding markers".
* test/lisp/erc/erc-dcc-tests.el
(erc-dcc-tests--dcc-handle-ctcp-send,
erc-dcc-tests--erc-dcc-do-GET-command): Use helper to initialize
prompt and markers.
* test/lisp/erc/erc-networks-tests.el
(erc-networks--ensure-announced,
erc-networks--rename-server-buffer--existing--reuse,
erc-networks--rename-server-buffer--existing--noreuse,
erc-networks--rename-server-buffer--reconnecting,
erc-networks--rename-server-buffer--id,
erc-networks--rename-server-buffer--existing--live,
erc-networks--rename-server-buffer--local-match,
erc-networks--rename-server-buffer--local-nomatch): Use helper to
initialize prompt and bounding markers.
* test/lisp/erc/erc-stamp-tests.el (erc-stamp-tests--insert-right):
Use `erc--initialize-markers' for setting up prompt.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Adjust assertions
for expected prompt content. (Bug#60936)
2023-06-10 00:17:44 -07:00
|
|
|
(insert (erc-format-my-nick))
|
2023-02-19 21:33:36 -08:00
|
|
|
(setq beg (point))
|
Don't insert prompt input before markers in ERC
* etc/ERC-NEWS: Update entry in 5.6 section announcing a persistent
prompt.
* lisp/erc/erc-dcc.el (erc-dcc-chat-setup): Use helper
`erc--initialize-markers' to set up prompt.
* lisp/erc/erc.el (erc--initialize-markers): Change
`erc-insert-marker' type to t. Do this to spare modules that want to
remember the current message location from resorting to workarounds,
like leaving a marker one char before the end of a message, which is
not foolproof.
(erc--refresh-prompt): Temporarily change type of `erc-insert-marker'
when inserting prompt.
(erc-display-line-1): Insert incoming message normally instead of
forcing before markers, thus respecting markers left by third parties.
Strictly speaking, this is a breaking change.
(erc-display-msg): Insert normally instead of calling
`insert-before-markers', which was a regression introduced by 05f6fdb9
"Preserve ERC prompt and its bounding markers".
* test/lisp/erc/erc-dcc-tests.el
(erc-dcc-tests--dcc-handle-ctcp-send,
erc-dcc-tests--erc-dcc-do-GET-command): Use helper to initialize
prompt and markers.
* test/lisp/erc/erc-networks-tests.el
(erc-networks--ensure-announced,
erc-networks--rename-server-buffer--existing--reuse,
erc-networks--rename-server-buffer--existing--noreuse,
erc-networks--rename-server-buffer--reconnecting,
erc-networks--rename-server-buffer--id,
erc-networks--rename-server-buffer--existing--live,
erc-networks--rename-server-buffer--local-match,
erc-networks--rename-server-buffer--local-nomatch): Use helper to
initialize prompt and bounding markers.
* test/lisp/erc/erc-stamp-tests.el (erc-stamp-tests--insert-right):
Use `erc--initialize-markers' for setting up prompt.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Adjust assertions
for expected prompt content. (Bug#60936)
2023-06-10 00:17:44 -07:00
|
|
|
(insert line)
|
2023-02-19 21:33:36 -08:00
|
|
|
(erc-put-text-property beg (point) 'font-lock-face 'erc-input-face)
|
Don't insert prompt input before markers in ERC
* etc/ERC-NEWS: Update entry in 5.6 section announcing a persistent
prompt.
* lisp/erc/erc-dcc.el (erc-dcc-chat-setup): Use helper
`erc--initialize-markers' to set up prompt.
* lisp/erc/erc.el (erc--initialize-markers): Change
`erc-insert-marker' type to t. Do this to spare modules that want to
remember the current message location from resorting to workarounds,
like leaving a marker one char before the end of a message, which is
not foolproof.
(erc--refresh-prompt): Temporarily change type of `erc-insert-marker'
when inserting prompt.
(erc-display-line-1): Insert incoming message normally instead of
forcing before markers, thus respecting markers left by third parties.
Strictly speaking, this is a breaking change.
(erc-display-msg): Insert normally instead of calling
`insert-before-markers', which was a regression introduced by 05f6fdb9
"Preserve ERC prompt and its bounding markers".
* test/lisp/erc/erc-dcc-tests.el
(erc-dcc-tests--dcc-handle-ctcp-send,
erc-dcc-tests--erc-dcc-do-GET-command): Use helper to initialize
prompt and markers.
* test/lisp/erc/erc-networks-tests.el
(erc-networks--ensure-announced,
erc-networks--rename-server-buffer--existing--reuse,
erc-networks--rename-server-buffer--existing--noreuse,
erc-networks--rename-server-buffer--reconnecting,
erc-networks--rename-server-buffer--id,
erc-networks--rename-server-buffer--existing--live,
erc-networks--rename-server-buffer--local-match,
erc-networks--rename-server-buffer--local-nomatch): Use helper to
initialize prompt and bounding markers.
* test/lisp/erc/erc-stamp-tests.el (erc-stamp-tests--insert-right):
Use `erc--initialize-markers' for setting up prompt.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Adjust assertions
for expected prompt content. (Bug#60936)
2023-06-10 00:17:44 -07:00
|
|
|
(insert "\n")
|
2014-11-08 20:51:43 -05:00
|
|
|
(save-restriction
|
|
|
|
(narrow-to-region insert-position (point))
|
|
|
|
(run-hooks 'erc-send-modify-hook)
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(run-hooks 'erc-send-post-hook)
|
|
|
|
(cl-assert (> (- (point-max) (point-min)) 1))
|
|
|
|
(add-text-properties (point-min) (1+ (point-min))
|
|
|
|
(erc--order-text-properties-from-hash
|
|
|
|
erc--msg-props)))
|
2023-05-18 23:47:27 -07:00
|
|
|
(erc--refresh-prompt)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-command-symbol (command)
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
"Return the ERC command symbol for COMMAND if it exists and is bound."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((cmd (intern-soft (format "erc-cmd-%s" (upcase command)))))
|
|
|
|
(when (fboundp cmd) cmd)))
|
|
|
|
|
|
|
|
(defun erc-extract-command-from-line (line)
|
|
|
|
"Extract command and args from the input LINE.
|
|
|
|
If no command was given, return nil. If command matches, return a
|
|
|
|
list of the form: (command args) where both elements are strings."
|
2007-01-17 18:17:25 +00:00
|
|
|
(when (string-match erc-command-regexp line)
|
2006-01-29 13:08:58 +00:00
|
|
|
(let* ((cmd (erc-command-symbol (match-string 1 line)))
|
2014-11-08 20:51:43 -05:00
|
|
|
;; note: return is nil, we apply this simply for side effects
|
|
|
|
(_canon-defun (while (and cmd (symbolp (symbol-function cmd)))
|
|
|
|
(setq cmd (symbol-function cmd))))
|
|
|
|
(cmd-fun (or cmd #'erc-cmd-default))
|
|
|
|
(arg (if cmd
|
|
|
|
(if (get cmd-fun 'do-not-parse-args)
|
|
|
|
(format "%s" (match-string 2 line))
|
|
|
|
(delete "" (split-string (erc-trim-string
|
|
|
|
(match-string 2 line)) " ")))
|
|
|
|
line)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(list cmd-fun arg))))
|
|
|
|
|
|
|
|
(defun erc-split-multiline-safe (string)
|
|
|
|
"Split STRING, containing multiple lines and return them in a list.
|
|
|
|
Do it only for STRING as the complete input, do not carry unfinished
|
|
|
|
strings over to the next call."
|
|
|
|
(let ((l ())
|
2014-11-08 20:51:43 -05:00
|
|
|
(i0 0)
|
|
|
|
(doit t))
|
2006-01-29 13:08:58 +00:00
|
|
|
(while doit
|
|
|
|
(let ((i (string-match "\r?\n" string i0))
|
2014-11-08 20:51:43 -05:00
|
|
|
(s (substring string i0)))
|
|
|
|
(cond (i (setq l (cons (substring string i0 i) l))
|
|
|
|
(setq i0 (match-end 0)))
|
|
|
|
((> (length s) 0)
|
|
|
|
(setq l (cons s l))(setq doit nil))
|
|
|
|
(t (setq doit nil)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(nreverse l)))
|
|
|
|
|
|
|
|
;; nick handling
|
|
|
|
|
|
|
|
(defun erc-set-current-nick (nick)
|
|
|
|
"Set the current nickname to NICK."
|
2007-04-01 13:36:38 +00:00
|
|
|
(with-current-buffer (if (buffer-live-p (erc-server-buffer))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-server-buffer)
|
|
|
|
(current-buffer))
|
2022-11-13 01:52:48 -08:00
|
|
|
(unless (equal erc-server-current-nick nick)
|
|
|
|
(setq erc-server-current-nick nick)
|
|
|
|
;; This seems sensible but may well be superfluous. Should
|
|
|
|
;; really prove that it's actually needed via test scenario.
|
|
|
|
(when erc-server-connected
|
|
|
|
(erc-networks--id-reload erc-networks--id)))
|
|
|
|
nick))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-current-nick ()
|
|
|
|
"Return the current nickname."
|
|
|
|
(with-current-buffer (if (buffer-live-p (erc-server-buffer))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-server-buffer)
|
|
|
|
(current-buffer))
|
2006-01-29 13:08:58 +00:00
|
|
|
erc-server-current-nick))
|
|
|
|
|
|
|
|
(defun erc-current-nick-p (nick)
|
|
|
|
"Return non-nil if NICK is the current nickname."
|
|
|
|
(erc-nick-equal-p nick (erc-current-nick)))
|
|
|
|
|
|
|
|
(defun erc-nick-equal-p (nick1 nick2)
|
|
|
|
"Return non-nil if NICK1 and NICK2 are the same.
|
|
|
|
|
|
|
|
This matches strings according to the IRC protocol's case convention.
|
|
|
|
|
|
|
|
See also `erc-downcase'."
|
|
|
|
(string= (erc-downcase nick1)
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-downcase nick2)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; default target handling
|
|
|
|
|
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.
2021-10-20 03:52:18 -07:00
|
|
|
(defun erc--current-buffer-joined-p ()
|
2023-10-15 13:20:07 -07:00
|
|
|
"Return non-nil if the current buffer is a channel and is joined."
|
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.
2021-10-20 03:52:18 -07:00
|
|
|
(cl-assert erc--target)
|
|
|
|
(and (erc--target-channel-p erc--target)
|
2023-10-15 13:20:07 -07:00
|
|
|
(erc--target-channel-joined-p erc--target)
|
|
|
|
t))
|
2022-12-09 06:26:13 -08:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-default-target ()
|
2023-10-15 07:22:31 -07:00
|
|
|
"Return the current channel or query target, if any.
|
|
|
|
For historical reasons, return nil in channel buffers if not
|
|
|
|
currently joined."
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((tgt (car erc-default-recipients)))
|
|
|
|
(cond
|
|
|
|
((not tgt) nil)
|
|
|
|
((listp tgt) (cdr tgt))
|
|
|
|
(t tgt))))
|
|
|
|
|
|
|
|
(defun erc-add-default-channel (channel)
|
|
|
|
"Add CHANNEL to the default channel list."
|
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.
2021-10-20 03:52:18 -07:00
|
|
|
(declare (obsolete "use `erc-cmd-JOIN' or similar instead" "29.1"))
|
2013-08-22 00:06:45 -04:00
|
|
|
(let ((chl (downcase channel)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq erc-default-recipients
|
|
|
|
(cons chl erc-default-recipients))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-delete-default-channel (channel &optional buffer)
|
|
|
|
"Delete CHANNEL from the default channel list."
|
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.
2021-10-20 03:52:18 -07:00
|
|
|
(declare (obsolete "use `erc-cmd-PART' or similar instead" "29.1"))
|
2013-08-22 00:06:45 -04:00
|
|
|
(with-current-buffer (if (and buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(bufferp buffer))
|
|
|
|
buffer
|
|
|
|
(current-buffer))
|
2013-08-22 00:06:45 -04:00
|
|
|
(setq erc-default-recipients (delete (downcase channel)
|
2014-11-08 20:51:43 -05:00
|
|
|
erc-default-recipients))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-add-query (nickname)
|
|
|
|
"Add QUERY'd NICKNAME to the default channel list.
|
|
|
|
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
The previous default target of QUERY type gets removed."
|
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.
2021-10-20 03:52:18 -07:00
|
|
|
(declare (obsolete "use `erc-cmd-QUERY' or similar instead" "29.1"))
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((d1 (car erc-default-recipients))
|
2014-11-08 20:51:43 -05:00
|
|
|
(d2 (cdr erc-default-recipients))
|
|
|
|
(qt (cons 'QUERY (downcase nickname))))
|
2013-08-22 00:06:45 -04:00
|
|
|
(setq erc-default-recipients (cons qt (if (and (listp d1)
|
2014-11-08 20:51:43 -05:00
|
|
|
(eq (car d1) 'QUERY))
|
|
|
|
d2
|
|
|
|
erc-default-recipients)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-delete-query ()
|
|
|
|
"Delete the topmost target if it is a QUERY."
|
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.
2021-10-20 03:52:18 -07:00
|
|
|
(declare (obsolete "use one query buffer per target instead" "29.1"))
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((d1 (car erc-default-recipients))
|
2014-11-08 20:51:43 -05:00
|
|
|
(d2 (cdr erc-default-recipients)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (and (listp d1)
|
2014-11-08 20:51:43 -05:00
|
|
|
(eq (car d1) 'QUERY))
|
|
|
|
(setq erc-default-recipients d2)
|
2006-01-29 13:08:58 +00:00
|
|
|
(error "Current target is not a QUERY"))))
|
|
|
|
|
|
|
|
(defun erc-ignored-user-p (spec)
|
|
|
|
"Return non-nil if SPEC matches something in `erc-ignore-list'.
|
|
|
|
|
|
|
|
Takes a full SPEC of a user in the form \"nick!login@host\", and
|
|
|
|
matches against all the regexp's in `erc-ignore-list'. If any
|
|
|
|
match, returns that regexp."
|
2006-11-20 06:50:29 +00:00
|
|
|
(catch 'found
|
2007-04-01 13:36:38 +00:00
|
|
|
(dolist (ignored (erc-with-server-buffer erc-ignore-list))
|
2006-11-20 06:50:29 +00:00
|
|
|
(if (string-match ignored spec)
|
2014-11-08 20:51:43 -05:00
|
|
|
(throw 'found ignored)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-ignored-reply-p (msg tgt proc)
|
|
|
|
;; FIXME: this docstring needs fixing -- Lawrence 2004-01-08
|
|
|
|
"Return non-nil if MSG matches something in `erc-ignore-reply-list'.
|
|
|
|
|
|
|
|
Takes a message MSG to a channel and returns non-nil if the addressed
|
|
|
|
user matches any regexp in `erc-ignore-reply-list'."
|
|
|
|
(let ((target-nick (erc-message-target msg)))
|
|
|
|
(if (not target-nick)
|
2014-11-08 20:51:43 -05:00
|
|
|
nil
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-with-buffer (tgt proc)
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((user (erc-get-server-user target-nick)))
|
|
|
|
(when user
|
|
|
|
(erc-list-match erc-ignore-reply-list
|
|
|
|
(erc-user-spec user))))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-message-target (msg)
|
|
|
|
"Return the addressed target in MSG.
|
|
|
|
|
|
|
|
The addressed target is the string before the first colon in MSG."
|
2006-04-11 22:09:49 +00:00
|
|
|
(if (string-match "^\\([^: \n]*\\):" msg)
|
2006-01-29 13:08:58 +00:00
|
|
|
(match-string 1 msg)
|
|
|
|
nil))
|
|
|
|
|
|
|
|
(defun erc-user-spec (user)
|
|
|
|
"Create a nick!user@host spec from a user struct."
|
|
|
|
(let ((nick (erc-server-user-nickname user))
|
2014-11-08 20:51:43 -05:00
|
|
|
(host (erc-server-user-host user))
|
|
|
|
(login (erc-server-user-login user)))
|
|
|
|
(concat (or nick "")
|
|
|
|
"!"
|
|
|
|
(or login "")
|
|
|
|
"@"
|
|
|
|
(or host ""))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-list-match (lst str)
|
|
|
|
"Return non-nil if any regexp in LST matches STR."
|
2022-07-06 19:57:11 -07:00
|
|
|
(and lst (string-match (string-join lst "\\|") str)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; other "toggles"
|
|
|
|
|
|
|
|
(defun erc-toggle-ctcp-autoresponse (&optional arg)
|
|
|
|
"Toggle automatic CTCP replies (like VERSION and PING).
|
|
|
|
|
|
|
|
If ARG is positive, turns CTCP replies on.
|
|
|
|
|
|
|
|
If ARG is non-nil and not positive, turns CTCP replies off."
|
|
|
|
(interactive "P")
|
|
|
|
(cond ((and (numberp arg) (> arg 0))
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq erc-disable-ctcp-replies t))
|
|
|
|
(arg (setq erc-disable-ctcp-replies nil))
|
|
|
|
(t (setq erc-disable-ctcp-replies (not erc-disable-ctcp-replies))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(message "ERC CTCP replies are %s" (if erc-disable-ctcp-replies "OFF" "ON")))
|
|
|
|
|
|
|
|
(defun erc-toggle-flood-control (&optional arg)
|
|
|
|
"Toggle use of flood control on sent messages.
|
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
If ARG is positive, use flood control.
|
|
|
|
If ARG is non-nil and not positive, do not use flood control.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
See `erc-server-flood-margin' for an explanation of the available
|
|
|
|
flood control parameters."
|
|
|
|
(interactive "P")
|
2006-07-14 02:29:50 +00:00
|
|
|
(cond ((and (numberp arg) (> arg 0))
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq erc-flood-protect t))
|
|
|
|
(arg (setq erc-flood-protect nil))
|
|
|
|
(t (setq erc-flood-protect (not erc-flood-protect))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(message "ERC flood control is %s"
|
2014-11-08 20:51:43 -05:00
|
|
|
(cond (erc-flood-protect "ON")
|
|
|
|
(t "OFF"))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; Some useful channel and nick commands for fast key bindings
|
|
|
|
|
|
|
|
(defun erc-invite-only-mode (&optional arg)
|
|
|
|
"Turn on the invite only mode (+i) for the current channel.
|
|
|
|
|
|
|
|
If ARG is non-nil, turn this mode off (-i).
|
|
|
|
|
|
|
|
This command is sent even if excess flood is detected."
|
|
|
|
(interactive "P")
|
|
|
|
(erc-set-active-buffer (current-buffer))
|
2013-09-20 17:52:07 -07:00
|
|
|
(let ((tgt (erc-default-target)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(if (or (not tgt) (not (erc-channel-p tgt)))
|
|
|
|
(erc-display-message nil 'error (current-buffer) 'no-target)
|
|
|
|
(erc-load-irc-script-lines
|
|
|
|
(list (concat "/mode " tgt (if arg " -i" " +i")))
|
|
|
|
t))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-get-channel-mode-from-keypress (key)
|
|
|
|
"Read a key sequence and call the corresponding channel mode function.
|
2006-07-14 02:29:50 +00:00
|
|
|
After doing C-c C-o, type in a channel mode letter.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
C-g means quit.
|
2006-07-14 02:29:50 +00:00
|
|
|
RET lets you type more than one mode at a time.
|
2006-01-29 13:08:58 +00:00
|
|
|
If \"l\" is pressed, `erc-set-channel-limit' gets called.
|
|
|
|
If \"k\" is pressed, `erc-set-channel-key' gets called.
|
|
|
|
Anything else will be sent to `erc-toggle-channel-mode'."
|
|
|
|
(interactive "kChannel mode (RET to set more than one): ")
|
|
|
|
(cond ((equal key "\C-g")
|
2014-11-08 20:51:43 -05:00
|
|
|
(keyboard-quit))
|
|
|
|
((equal key "\C-m")
|
|
|
|
(erc-insert-mode-command))
|
|
|
|
((equal key "l")
|
|
|
|
(call-interactively 'erc-set-channel-limit))
|
|
|
|
((equal key "k")
|
|
|
|
(call-interactively 'erc-set-channel-key))
|
|
|
|
(t (erc-toggle-channel-mode key))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-toggle-channel-mode (mode &optional channel)
|
|
|
|
"Toggle channel MODE.
|
|
|
|
|
|
|
|
If CHANNEL is non-nil, toggle MODE for that channel, otherwise use
|
|
|
|
`erc-default-target'."
|
|
|
|
(interactive "P")
|
|
|
|
(erc-set-active-buffer (current-buffer))
|
2013-09-20 17:52:07 -07:00
|
|
|
(let ((tgt (or channel (erc-default-target))))
|
2014-11-08 20:51:43 -05:00
|
|
|
(if (or (null tgt) (null (erc-channel-p tgt)))
|
|
|
|
(erc-display-message nil 'error 'active 'no-target)
|
|
|
|
(let* ((active (member mode erc-channel-modes))
|
|
|
|
(newstate (if active "OFF" "ON")))
|
|
|
|
(erc-log (format "%s: Toggle mode %s %s" tgt mode newstate))
|
|
|
|
(message "Toggle channel mode %s %s" mode newstate)
|
|
|
|
(erc-server-send (format "MODE %s %s%s"
|
|
|
|
tgt (if active "-" "+") mode))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-insert-mode-command ()
|
|
|
|
"Insert the line \"/mode <current target> \" at `point'."
|
|
|
|
(interactive)
|
|
|
|
(let ((tgt (erc-default-target)))
|
|
|
|
(if tgt (insert (concat "/mode " tgt " "))
|
|
|
|
(erc-display-message nil 'error (current-buffer) 'no-target))))
|
|
|
|
|
|
|
|
(defun erc-channel-names ()
|
|
|
|
"Run \"/names #channel\" in the current channel."
|
|
|
|
(interactive)
|
|
|
|
(erc-set-active-buffer (current-buffer))
|
|
|
|
(let ((tgt (erc-default-target)))
|
|
|
|
(if tgt (erc-load-irc-script-lines (list (concat "/names " tgt)))
|
|
|
|
(erc-display-message nil 'error (current-buffer) 'no-target))))
|
|
|
|
|
|
|
|
(defun erc-remove-text-properties-region (start end &optional object)
|
|
|
|
"Clears the region (START,END) in OBJECT from all colors, etc."
|
|
|
|
(interactive "r")
|
|
|
|
(save-excursion
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
(set-text-properties start end nil object))))
|
2008-04-17 05:02:14 +00:00
|
|
|
(put 'erc-remove-text-properties-region 'disabled t)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; script execution and startup
|
|
|
|
|
|
|
|
(defun erc-find-file (file &optional path)
|
|
|
|
"Search for a FILE in the filesystem.
|
|
|
|
First the `default-directory' is searched for FILE, then any directories
|
|
|
|
specified in the list PATH.
|
|
|
|
|
|
|
|
If FILE is found, return the path to it."
|
|
|
|
(let ((filepath file))
|
|
|
|
(if (file-readable-p filepath) filepath
|
2013-08-22 00:06:45 -04:00
|
|
|
(while (and path
|
2014-11-08 20:51:43 -05:00
|
|
|
(progn (setq filepath (expand-file-name file (car path)))
|
|
|
|
(not (file-readable-p filepath))))
|
|
|
|
(setq path (cdr path)))
|
2013-08-22 00:06:45 -04:00
|
|
|
(if path filepath nil))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-select-startup-file ()
|
|
|
|
"Select an ERC startup file.
|
|
|
|
See also `erc-startup-file-list'."
|
2006-08-07 07:43:25 +00:00
|
|
|
(catch 'found
|
|
|
|
(dolist (f erc-startup-file-list)
|
2006-08-07 07:43:37 +00:00
|
|
|
(setq f (convert-standard-filename f))
|
2006-08-07 07:43:25 +00:00
|
|
|
(when (file-readable-p f)
|
2014-11-08 20:51:43 -05:00
|
|
|
(throw 'found f)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-find-script-file (file)
|
|
|
|
"Search for FILE in `default-directory', and any in `erc-script-path'."
|
|
|
|
(erc-find-file file erc-script-path))
|
|
|
|
|
|
|
|
(defun erc-load-script (file)
|
|
|
|
"Load a script from FILE.
|
|
|
|
|
|
|
|
FILE must be the full name, it is not searched in the
|
|
|
|
`erc-script-path'. If the filename ends with `.el', then load it
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
as an Emacs Lisp program. Otherwise, treat it as a regular IRC
|
|
|
|
script."
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-log (concat "erc-load-script: " file))
|
|
|
|
(cond
|
2014-11-08 20:51:43 -05:00
|
|
|
((string-match "\\.el\\'" file)
|
2006-01-29 13:08:58 +00:00
|
|
|
(load file))
|
|
|
|
(t
|
|
|
|
(erc-load-irc-script file))))
|
|
|
|
|
|
|
|
(defun erc-process-script-line (line &optional args)
|
|
|
|
"Process an IRC script LINE.
|
|
|
|
|
|
|
|
Does script-specific substitutions (script arguments, current nick,
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
server, etc.) in LINE and returns it.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
Substitutions are: %C and %c = current target (channel or nick),
|
|
|
|
%S %s = current server, %N %n = my current nick, and %x is x verbatim,
|
|
|
|
where x is any other character;
|
|
|
|
$* = the entire argument string, $1 = the first argument, $2 = the second,
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
and so on."
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (not args) (setq args ""))
|
|
|
|
(let* ((arg-esc-regexp "\\(\\$\\(\\*\\|[1-9][0-9]*\\)\\)\\([^0-9]\\|$\\)")
|
2014-11-08 20:51:43 -05:00
|
|
|
(percent-regexp "\\(%.\\)")
|
|
|
|
(esc-regexp (concat arg-esc-regexp "\\|" percent-regexp))
|
|
|
|
(tgt (erc-default-target))
|
|
|
|
(server (and (boundp 'erc-session-server) erc-session-server))
|
|
|
|
(nick (erc-current-nick))
|
|
|
|
(res "")
|
|
|
|
(tmp nil)
|
|
|
|
(arg-list nil)
|
|
|
|
(arg-num 0))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (not tgt) (setq tgt ""))
|
|
|
|
(if (not server) (setq server ""))
|
|
|
|
(if (not nick) (setq nick ""))
|
|
|
|
;; First, compute the argument list
|
|
|
|
(setq tmp args)
|
|
|
|
(while (string-match "^\\s-*\\(\\S-+\\)\\(\\s-+.*$\\|$\\)" tmp)
|
|
|
|
(setq arg-list (cons (match-string 1 tmp) arg-list))
|
|
|
|
(setq tmp (match-string 2 tmp)))
|
|
|
|
(setq arg-list (nreverse arg-list))
|
|
|
|
(setq arg-num (length arg-list))
|
|
|
|
;; now do the substitution
|
|
|
|
(setq tmp (string-match esc-regexp line))
|
|
|
|
(while tmp
|
|
|
|
;;(message "beginning of while: tmp=%S" tmp)
|
|
|
|
(let* ((hd (substring line 0 tmp))
|
2014-11-08 20:51:43 -05:00
|
|
|
(esc "")
|
|
|
|
(subst "")
|
|
|
|
(tail (substring line tmp)))
|
|
|
|
(cond ((string-match (concat "^" arg-esc-regexp) tail)
|
|
|
|
(setq esc (match-string 1 tail))
|
|
|
|
(setq tail (substring tail (match-end 1))))
|
|
|
|
((string-match (concat "^" percent-regexp) tail)
|
|
|
|
(setq esc (match-string 1 tail))
|
|
|
|
(setq tail (substring tail (match-end 1)))))
|
|
|
|
;;(message "hd=%S, esc=%S, tail=%S, arg-num=%S" hd esc tail arg-num)
|
|
|
|
(setq res (concat res hd))
|
|
|
|
(setq subst
|
|
|
|
(cond ((string= esc "") "")
|
|
|
|
((string-match "^\\$\\*$" esc) args)
|
|
|
|
((string-match "^\\$\\([0-9]+\\)$" esc)
|
|
|
|
(let ((n (string-to-number (match-string 1 esc))))
|
|
|
|
(message "n = %S, integerp(n)=%S" n (integerp n))
|
|
|
|
(if (<= n arg-num) (nth (1- n) arg-list) "")))
|
|
|
|
((string-match "^%[Cc]$" esc) tgt)
|
|
|
|
((string-match "^%[Ss]$" esc) server)
|
|
|
|
((string-match "^%[Nn]$" esc) nick)
|
|
|
|
((string-match "^%\\(.\\)$" esc) (match-string 1 esc))
|
|
|
|
(t (erc-log (format "BUG in erc-process-script-line: bad escape sequence: %S\n" esc))
|
|
|
|
(message "BUG IN ERC: esc=%S" esc)
|
|
|
|
"")))
|
|
|
|
(setq line tail)
|
|
|
|
(setq tmp (string-match esc-regexp line))
|
|
|
|
(setq res (concat res subst))
|
|
|
|
;;(message "end of while: line=%S, res=%S, tmp=%S" line res tmp)
|
|
|
|
))
|
2006-01-29 13:08:58 +00:00
|
|
|
(setq res (concat res line))
|
|
|
|
res))
|
|
|
|
|
|
|
|
(defun erc-load-irc-script (file &optional force)
|
|
|
|
"Load an IRC script from FILE."
|
|
|
|
(erc-log (concat "erc-load-script: " file))
|
|
|
|
(let ((str (with-temp-buffer
|
2014-11-08 20:51:43 -05:00
|
|
|
(insert-file-contents file)
|
|
|
|
(buffer-string))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-load-irc-script-lines (erc-split-multiline-safe str) force)))
|
|
|
|
|
|
|
|
(defun erc-load-irc-script-lines (lines &optional force noexpand)
|
|
|
|
"Load IRC script LINES (a list of strings).
|
|
|
|
|
|
|
|
If optional NOEXPAND is non-nil, do not expand script-specific
|
|
|
|
sequences, process the lines verbatim. Use this for multiline
|
|
|
|
user input."
|
|
|
|
(let* ((cb (current-buffer))
|
2014-11-08 20:51:43 -05:00
|
|
|
(s "")
|
Revive erc-command-indicator as new module
* doc/misc/erc.texi: Add entry for `command-indicator' to Modules
chapter.
* etc/ERC-NEWS: Mention new module `command-indicator'.
* lisp/erc/erc-goodies.el (erc-noncommands-list): Replace the
nonexistent `erc-cmd-SMV' with function `erc-cmd-SAY'.
(erc-noncommands-mode, erc-noncommands-enable,
erc-noncommands-disable): Deprecate this module because it's a no-op.
(erc-command-indicator-face, erc-command-indicator): Migrate from main
library.
(erc-command-indicator-mode, erc-command-indicator-enable,
erc-command-indicator-disable): New module to take the spiritual place
of `noncommands'.
(erc-command-indicator): Move function here from main library, along
with option namesake mentioned above.
(erc-command-indicator-toggle-hidden): New command to toggle echoed
command-line visibility.
(erc--command-indicator-permit-insertion): New function.
(erc--command-indicator-display): New function, a slightly revised
version of the old `erc-display-command' from the main library. Its
only call site was removed back in d1036d288de "backport: erc
bugfixes". However, references were left behind to associated assets,
like `erc-command-indicator', etc. The function was later commented
out in 0c599ee2e2c "* lisp/erc/erc.el: Use `run-hook-with-args` for
`erc-pre-send-functions`", and then removed by a63ed6f78a6 "Remove
duplicate ERC prompt on reconnect".
* lisp/erc/erc-match.el (erc-match-toggle-hidden-fools): Use new
non-module-specific name for `erc-match--toggle-hidden'.
(erc-match--toggle-hidden): Move to main library for shared use by
other modules.
* lisp/erc/erc.el (erc-hide-prompt): Leave note explaining updated
role.
(erc-command-indicator): Move option and function of same name to
erc-goodies.
(erc-command-indicator-face): Move to erc-goodies.
(erc-modules): Remove module `noncommands' from standard value and
Custom set. Add `command-indicator' to set.
(erc--toggle-hidden): "New" function, a rebranded version of the
utility `erc-match--toggle-hidden' from erc-match.
(erc--send-input-lines): Accommodate modules wanting alternate
insertion functions.
(erc-load-irc-script-lines): Account for `erc-command-indicator' no
longer being defined in this library.
* test/lisp/erc/erc-scenarios-base-send-message.el
(erc-scenarios-base-send-message--command-indicator): New test.
* test/lisp/erc/erc-tests.el (erc-tests--modules): Remove
deprecated module `noncommands' from manifest. (Bug#67031)
2023-11-10 13:34:31 -08:00
|
|
|
(sp (or (and (bound-and-true-p erc-command-indicator-mode)
|
|
|
|
(fboundp 'erc-command-indicator)
|
|
|
|
(erc-command-indicator))
|
|
|
|
(erc-prompt)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(args (and (boundp 'erc-script-args) erc-script-args)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (and args (string-match "^ " args))
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq args (substring args 1)))
|
2006-01-29 13:08:58 +00:00
|
|
|
;; prepare the prompt string for echo
|
|
|
|
(erc-put-text-property 0 (length sp)
|
2016-04-07 14:23:18 +02:00
|
|
|
'font-lock-face 'erc-command-indicator-face sp)
|
2006-01-29 13:08:58 +00:00
|
|
|
(while lines
|
|
|
|
(setq s (car lines))
|
|
|
|
(erc-log (concat "erc-load-script: CMD: " s))
|
|
|
|
(unless (string-match "^\\s-*$" s)
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((line (if noexpand s (erc-process-script-line s args))))
|
|
|
|
(if (and (erc-process-input-line line force)
|
|
|
|
erc-script-echo)
|
|
|
|
(progn
|
|
|
|
(erc-put-text-property 0 (length line)
|
2016-04-07 14:23:18 +02:00
|
|
|
'font-lock-face 'erc-input-face line)
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-display-line (concat sp line) cb)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(setq lines (cdr lines)))))
|
|
|
|
|
|
|
|
;; authentication
|
|
|
|
|
2022-11-13 01:52:48 -08:00
|
|
|
(defun erc--unfun (maybe-fn)
|
|
|
|
"Return MAYBE-FN or whatever it returns."
|
|
|
|
(let ((s (if (functionp maybe-fn) (funcall maybe-fn) maybe-fn)))
|
|
|
|
(when (and erc-debug-irc-protocol
|
|
|
|
erc--debug-irc-protocol-mask-secrets
|
|
|
|
(stringp s))
|
|
|
|
(put-text-property 0 (length s) 'erc-secret t s))
|
|
|
|
s))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-login ()
|
|
|
|
"Perform user authentication at the IRC server."
|
|
|
|
(erc-log (format "login: nick: %s, user: %s %s %s :%s"
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-current-nick)
|
|
|
|
(user-login-name)
|
|
|
|
(or erc-system-name (system-name))
|
|
|
|
erc-session-server
|
|
|
|
erc-session-user-full-name))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if erc-session-password
|
2022-11-13 01:52:48 -08:00
|
|
|
(erc-server-send (concat "PASS :" (erc--unfun erc-session-password)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(message "Logging in without password"))
|
|
|
|
(erc-server-send (format "NICK %s" (erc-current-nick)))
|
|
|
|
(erc-server-send
|
|
|
|
(format "USER %s %s %s :%s"
|
2014-11-08 20:51:43 -05:00
|
|
|
;; hacked - S.B.
|
2022-04-03 14:24:24 -07:00
|
|
|
erc-session-username
|
2014-11-08 20:51:43 -05:00
|
|
|
"0" "*"
|
|
|
|
erc-session-user-full-name))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-update-mode-line))
|
|
|
|
|
|
|
|
;; connection properties' heuristics
|
|
|
|
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
(defun erc-determine-parameters (&optional server port nick name user passwd)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Determine the connection and authentication parameters.
|
|
|
|
Sets the buffer local variables:
|
|
|
|
|
2010-01-25 13:49:23 -05:00
|
|
|
- `erc-session-connector'
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
- `erc-session-server'
|
|
|
|
- `erc-session-port'
|
2020-09-23 13:35:55 +02:00
|
|
|
- `erc-session-user-full-name'
|
2022-04-03 14:24:24 -07:00
|
|
|
- `erc-session-username'
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
- `erc-session-password'
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
- `erc-server-current-nick'"
|
2010-01-25 13:49:23 -05:00
|
|
|
(setq erc-session-connector erc-server-connect-function
|
|
|
|
erc-session-server (erc-compute-server server)
|
2014-11-08 20:51:43 -05:00
|
|
|
erc-session-port (or port erc-default-port)
|
2022-04-03 14:24:24 -07:00
|
|
|
erc-session-user-full-name (erc-compute-full-name name)
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
erc-session-username (erc-compute-user user)
|
|
|
|
erc-session-password (erc--compute-server-password passwd nick))
|
2006-01-29 13:08:58 +00:00
|
|
|
(erc-set-current-nick (erc-compute-nick nick)))
|
|
|
|
|
|
|
|
(defun erc-compute-server (&optional server)
|
|
|
|
"Return an IRC server name.
|
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
This tries a number of increasingly more default methods until a
|
|
|
|
non-nil value is found.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2006-11-20 06:50:29 +00:00
|
|
|
- SERVER (the argument passed to this function)
|
2006-07-14 02:29:50 +00:00
|
|
|
- The `erc-server' option
|
2006-01-29 13:08:58 +00:00
|
|
|
- The value of the IRCSERVER environment variable
|
2006-07-14 02:29:50 +00:00
|
|
|
- The `erc-default-server' variable"
|
2006-01-29 13:08:58 +00:00
|
|
|
(or server
|
|
|
|
erc-server
|
|
|
|
(getenv "IRCSERVER")
|
|
|
|
erc-default-server))
|
|
|
|
|
2022-04-03 14:24:24 -07:00
|
|
|
(defun erc-compute-user (&optional user)
|
|
|
|
"Return a suitable value for the session user name."
|
|
|
|
(or user (if erc-anonymous-login erc-email-userid (user-login-name))))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-compute-nick (&optional nick)
|
2006-07-14 02:29:50 +00:00
|
|
|
"Return user's IRC nick.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
This tries a number of increasingly more default methods until a
|
|
|
|
non-nil value is found.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
- NICK (the argument passed to this function)
|
|
|
|
- The `erc-nick' option
|
2006-01-29 13:08:58 +00:00
|
|
|
- The value of the IRCNICK environment variable
|
2006-07-14 02:29:50 +00:00
|
|
|
- The result from the `user-login-name' function"
|
2006-01-29 13:08:58 +00:00
|
|
|
(or nick
|
|
|
|
(if (consp erc-nick) (car erc-nick) erc-nick)
|
|
|
|
(getenv "IRCNICK")
|
|
|
|
(user-login-name)))
|
|
|
|
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
(defun erc--compute-server-password (password nick)
|
|
|
|
"Maybe provide a PASSWORD argument for the IRC \"PASS\" command.
|
|
|
|
When `erc-auth-source-server-function' is non-nil, call it with NICK for
|
|
|
|
the user field and use whatever it returns as the server password."
|
|
|
|
(or password (and erc-auth-source-server-function
|
2022-12-02 23:11:24 -08:00
|
|
|
(not erc--server-reconnecting)
|
|
|
|
(not erc--target)
|
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)
2021-08-16 04:38:18 -07:00
|
|
|
(funcall erc-auth-source-server-function :user nick))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-compute-full-name (&optional full-name)
|
2006-07-14 02:29:50 +00:00
|
|
|
"Return user's full name.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
This tries a number of increasingly more default methods until a
|
|
|
|
non-nil value is found.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
- FULL-NAME (the argument passed to this function)
|
|
|
|
- The `erc-user-full-name' option
|
2006-01-29 13:08:58 +00:00
|
|
|
- The value of the IRCNAME environment variable
|
2006-07-14 02:29:50 +00:00
|
|
|
- The result from the `user-full-name' function"
|
2006-01-29 13:08:58 +00:00
|
|
|
(or full-name
|
|
|
|
erc-user-full-name
|
|
|
|
(getenv "IRCNAME")
|
|
|
|
(if erc-anonymous-login "unknown" nil)
|
|
|
|
(user-full-name)))
|
|
|
|
|
|
|
|
(defun erc-compute-port (&optional port)
|
|
|
|
"Return a port for an IRC server.
|
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
This tries a number of increasingly more default methods until a
|
|
|
|
non-nil value is found.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
- PORT (the argument passed to this function)
|
|
|
|
- The `erc-port' option
|
|
|
|
- The `erc-default-port' variable"
|
2022-07-11 05:14:57 -07:00
|
|
|
(erc-normalize-port (or port erc-port erc-default-port)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; time routines
|
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(define-obsolete-function-alias 'erc-string-to-emacs-time #'string-to-number
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-22 18:32:31 -08:00
|
|
|
"27.1")
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2021-03-18 23:14:33 -04:00
|
|
|
(defalias 'erc-emacs-time-to-erc-time #'float-time)
|
|
|
|
(defalias 'erc-current-time #'float-time)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-time-diff (t1 t2)
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-22 18:32:31 -08:00
|
|
|
"Return the absolute value of the difference in seconds between T1 and T2."
|
|
|
|
(abs (float-time (time-subtract t1 t2))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-time-gt (t1 t2)
|
|
|
|
"Check whether T1 > T2."
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-22 18:32:31 -08:00
|
|
|
(declare (obsolete time-less-p "27.1"))
|
|
|
|
(time-less-p t2 t1))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-sec-to-time (ns)
|
|
|
|
"Convert NS to a time string HH:MM.SS."
|
|
|
|
(setq ns (truncate ns))
|
|
|
|
(format "%02d:%02d.%02d"
|
2014-11-08 20:51:43 -05:00
|
|
|
(/ ns 3600)
|
|
|
|
(/ (% ns 3600) 60)
|
|
|
|
(% ns 60)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-seconds-to-string (seconds)
|
|
|
|
"Convert a number of SECONDS into an English phrase."
|
|
|
|
(let (days hours minutes format-args output)
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq days (/ seconds 86400)
|
|
|
|
seconds (% seconds 86400)
|
|
|
|
hours (/ seconds 3600)
|
|
|
|
seconds (% seconds 3600)
|
|
|
|
minutes (/ seconds 60)
|
|
|
|
seconds (% seconds 60)
|
|
|
|
format-args (if (> days 0)
|
|
|
|
`("%d days, %d hours, %d minutes, %d seconds"
|
|
|
|
,days ,hours ,minutes ,seconds)
|
|
|
|
(if (> hours 0)
|
|
|
|
`("%d hours, %d minutes, %d seconds"
|
|
|
|
,hours ,minutes ,seconds)
|
|
|
|
(if (> minutes 0)
|
|
|
|
`("%d minutes, %d seconds" ,minutes ,seconds)
|
|
|
|
`("%d seconds" ,seconds))))
|
2015-03-16 14:49:01 -04:00
|
|
|
output (apply #'format format-args))
|
2006-01-29 13:08:58 +00:00
|
|
|
;; Change all "1 units" to "1 unit".
|
|
|
|
(while (string-match "\\([^0-9]\\|^\\)1 \\S-+\\(s\\)" output)
|
2020-08-12 19:32:52 +02:00
|
|
|
(setq output (replace-match "" nil nil output 2)))
|
2006-01-29 13:08:58 +00:00
|
|
|
output))
|
|
|
|
|
|
|
|
|
|
|
|
;; info
|
|
|
|
|
|
|
|
(defconst erc-clientinfo-alist
|
|
|
|
'(("ACTION" . "is used to inform about one's current activity")
|
|
|
|
("CLIENTINFO" . "gives help on CTCP commands supported by client")
|
|
|
|
("ECHO" . "echoes its arguments back")
|
|
|
|
("FINGER" . "shows user's name, location, and idle time")
|
|
|
|
("PING" . "measures delay between peers")
|
|
|
|
("TIME" . "shows client-side time")
|
|
|
|
("USERINFO" . "shows information provided by a user")
|
|
|
|
("VERSION" . "shows client type and version"))
|
|
|
|
"Alist of CTCP CLIENTINFO for ERC commands.")
|
|
|
|
|
|
|
|
(defun erc-client-info (s)
|
|
|
|
"Return CTCP CLIENTINFO on command S.
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
If S is nil or an empty string then return general CLIENTINFO."
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (or (not s) (string= s ""))
|
|
|
|
(concat
|
|
|
|
(apply #'concat
|
2014-11-08 20:51:43 -05:00
|
|
|
(mapcar (lambda (e)
|
|
|
|
(concat (car e) " "))
|
|
|
|
erc-clientinfo-alist))
|
2006-01-29 13:08:58 +00:00
|
|
|
": use CLIENTINFO <COMMAND> to get more specific information")
|
|
|
|
(let ((h (assoc (upcase s) erc-clientinfo-alist)))
|
|
|
|
(if h
|
2014-11-08 20:51:43 -05:00
|
|
|
(concat s " " (cdr h))
|
|
|
|
(concat s ": unknown command")))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; Hook functions
|
|
|
|
|
|
|
|
(defun erc-directory-writable-p (dir)
|
|
|
|
"Determine whether DIR is a writable directory.
|
|
|
|
If it doesn't exist, create it."
|
|
|
|
(unless (file-attributes dir) (make-directory dir))
|
|
|
|
(or (file-accessible-directory-p dir) (error "Cannot access %s" dir)))
|
|
|
|
|
2023-10-15 07:22:31 -07:00
|
|
|
;; FIXME make function obsolete or alias to something less confusing.
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-kill-query-buffers (process)
|
2023-10-15 07:22:31 -07:00
|
|
|
"Kill all target buffers of PROCESS, including channel buffers.
|
|
|
|
Do nothing if PROCESS is not a process object."
|
2006-01-29 13:08:58 +00:00
|
|
|
;; here, we only want to match the channel buffers, to avoid
|
|
|
|
;; "selecting killed buffers" b0rkage.
|
2016-02-04 16:55:01 +11:00
|
|
|
(when (processp process)
|
2023-10-15 07:22:31 -07:00
|
|
|
(erc-with-all-buffers-of-server process (lambda () erc--target)
|
2016-02-04 16:55:01 +11:00
|
|
|
(kill-buffer (current-buffer)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-nick-at-point ()
|
|
|
|
"Give information about the nickname at `point'.
|
|
|
|
|
|
|
|
If called interactively, give a human readable message in the
|
2011-11-19 18:29:42 -08:00
|
|
|
minibuffer. If called programmatically, return the corresponding
|
2006-01-29 13:08:58 +00:00
|
|
|
entry of `channel-members'."
|
|
|
|
(interactive)
|
|
|
|
(require 'thingatpt)
|
|
|
|
(let* ((word (word-at-point))
|
2014-11-08 20:51:43 -05:00
|
|
|
(channel-data (erc-get-channel-user word))
|
|
|
|
(cuser (cdr channel-data))
|
|
|
|
(user (if channel-data
|
|
|
|
(car channel-data)
|
|
|
|
(erc-get-server-user word)))
|
|
|
|
host login full-name nick voice halfop op admin owner)
|
2006-01-29 13:08:58 +00:00
|
|
|
(when user
|
|
|
|
(setq nick (erc-server-user-nickname user)
|
2014-11-08 20:51:43 -05:00
|
|
|
host (erc-server-user-host user)
|
|
|
|
login (erc-server-user-login user)
|
|
|
|
full-name (erc-server-user-full-name user))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if cuser
|
2014-11-08 20:51:43 -05:00
|
|
|
(setq voice (erc-channel-user-voice cuser)
|
|
|
|
halfop (erc-channel-user-halfop cuser)
|
|
|
|
op (erc-channel-user-op cuser)
|
|
|
|
admin (erc-channel-user-admin cuser)
|
|
|
|
owner (erc-channel-user-owner cuser))))
|
|
|
|
(if (called-interactively-p 'interactive)
|
|
|
|
(message "%s is %s@%s%s%s"
|
|
|
|
nick login host
|
|
|
|
(if full-name (format " (%s)" full-name) "")
|
|
|
|
(if (or voice halfop op admin owner)
|
|
|
|
(format " and is +%s%s%s%s%s on %s"
|
|
|
|
(if voice "v" "")
|
|
|
|
(if halfop "h" "")
|
|
|
|
(if op "o" "")
|
|
|
|
(if admin "a" "")
|
|
|
|
(if owner "q" "")
|
|
|
|
(erc-default-target))
|
|
|
|
""))
|
|
|
|
user)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2007-04-01 13:36:38 +00:00
|
|
|
(defun erc-away-time ()
|
|
|
|
"Return non-nil if the current ERC process is set away.
|
|
|
|
|
|
|
|
In particular, the time that we were set away is returned.
|
|
|
|
See `current-time' for details on the time format."
|
|
|
|
(erc-with-server-buffer erc-away))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; Mode line handling
|
|
|
|
|
2008-01-25 03:28:10 +00:00
|
|
|
(defcustom erc-mode-line-format "%S %a"
|
2006-01-29 13:08:58 +00:00
|
|
|
"A string to be formatted and shown in the mode-line in `erc-mode'.
|
|
|
|
|
|
|
|
The string is formatted using `format-spec' and the result is set as the value
|
|
|
|
of `mode-line-buffer-identification'.
|
|
|
|
|
|
|
|
The following characters are replaced:
|
|
|
|
%a: String indicating away status or \"\" if you are not away
|
2007-01-17 18:17:25 +00:00
|
|
|
%l: The estimated lag time to the server
|
2006-01-29 13:08:58 +00:00
|
|
|
%m: The modes of the channel
|
|
|
|
%n: The current nick name
|
2008-01-25 03:28:10 +00:00
|
|
|
%N: The name of the network
|
2006-01-29 13:08:58 +00:00
|
|
|
%o: The topic of the channel
|
|
|
|
%p: The session port
|
|
|
|
%t: The name of the target (channel, nickname, or servername:port)
|
|
|
|
%s: In the server-buffer, this gets filled with the value of
|
|
|
|
`erc-server-announced-name', in a channel, the value of
|
2008-01-25 03:28:10 +00:00
|
|
|
(erc-default-target) also get concatenated.
|
|
|
|
%S: In the server-buffer, this gets filled with the value of
|
|
|
|
`erc-network', in a channel, the value of (erc-default-target)
|
|
|
|
also get concatenated."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-mode-line-and-header
|
|
|
|
:type 'string)
|
|
|
|
|
2007-01-17 18:17:25 +00:00
|
|
|
(defcustom erc-header-line-format "%n on %t (%m,%l) %o"
|
2006-01-29 13:08:58 +00:00
|
|
|
"A string to be formatted and shown in the header-line in `erc-mode'.
|
|
|
|
|
2007-04-01 13:36:38 +00:00
|
|
|
Set this to nil if you do not want the header line to be
|
|
|
|
displayed.
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
See `erc-mode-line-format' for which characters are can be used."
|
|
|
|
:group 'erc-mode-line-and-header
|
2007-04-01 13:36:38 +00:00
|
|
|
:set (lambda (sym val)
|
2014-11-08 20:51:43 -05:00
|
|
|
(set sym val)
|
|
|
|
(when (fboundp 'erc-update-mode-line)
|
|
|
|
(erc-update-mode-line nil)))
|
2007-04-01 13:36:38 +00:00
|
|
|
:type '(choice (const :tag "Disabled" nil)
|
2014-11-08 20:51:43 -05:00
|
|
|
string))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Sequester some special-variable declarations in ERC
* lisp/erc/erc-backend.el (erc-log-p): Remove declaration entirely.
(erc-server-reconnect): Move declaration for `erc-reuse-buffers' here.
(erc-process-sentinel-1): Move `erc-kill-server-buffer-on-quit'
declaration here.
(erc--conceal-prompt): Move `erc-prompt-hidden' declaration here.
(erc-server-INVITE): Move `erc-invitation' declaration here.
(erc-server-PART): Move `erc-kill-buffer-on-part' declaration here.
(erc-server-PRIVMSG): Move declarations for `erc-minibuffer-ignored',
`erc-receive-query-display', `erc-receive-query-display-defer',
`erc--cmem-from-nick-function', `erc-format-nick-function', and
`erc-format-query-as-channel-p' here.
(erc-server-401): Move `erc-whowas-on-nosuchnick' declaration here.
(erc-server-475): Move `erc--called-as-input-p' and
`erc-prompt-for-channel-key' declarations here.
* lisp/erc/erc-common.el (erc-log-p): Remove declaration for
`erc-log-p' and replace with actual definition.
(erc-log-aux): Move `erc-dbuf' declaration from top level into
function body.
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Note in
the doc string that this function produces side effects.
* lisp/erc/erc-networks.el (erc-determine-network,
erc-networks--copy-server-buffer-functions): Move some variable
declarations to function body.
(erc-settings, erc-get): Deprecate for now and explain why in doc
strings. We could deprecate them unconditionally, but they never
provided usable code, and their names are short and valuable.
* lisp/erc/erc.el (tabbar--local-hlf, motif-version-string,
gtk-version-string): Prefer moving these single-serving declarations
to function bodies, if only to make closures from this library less
cluttered when debugging. This should also help avoid stray
declarations.
(erc-hooks, erc-timer-hook): Revise doc strings.
(erc-log-p): Move definition to erc-common.el.
(erc-cmd-SV): Mimic `emacs-version' and stick with `featurep', here in
combination with special-variable declarations, instead of `boundp' or
similar.
(erc-header-line-uses-tabbar-p): Explain that this has nothing to do
with `tab-bar'.
(erc-update-mode-line-buffer): Only assign when bound. This has been
verified to work with version 2.0 on EmacsWiki.
* test/lisp/erc/erc-scenarios-base-reconnect.el: Timeouts.
* test/lisp/erc/erc-scenarios-base-renick.el: Timeouts.
* test/lisp/erc/resources/join/network-id/foonet-again.eld: Timeouts.
2023-11-26 18:24:48 -08:00
|
|
|
;; This should optionally support the built-in `tab-bar'.
|
2009-01-18 21:01:14 +00:00
|
|
|
(defcustom erc-header-line-uses-tabbar-p nil
|
Sequester some special-variable declarations in ERC
* lisp/erc/erc-backend.el (erc-log-p): Remove declaration entirely.
(erc-server-reconnect): Move declaration for `erc-reuse-buffers' here.
(erc-process-sentinel-1): Move `erc-kill-server-buffer-on-quit'
declaration here.
(erc--conceal-prompt): Move `erc-prompt-hidden' declaration here.
(erc-server-INVITE): Move `erc-invitation' declaration here.
(erc-server-PART): Move `erc-kill-buffer-on-part' declaration here.
(erc-server-PRIVMSG): Move declarations for `erc-minibuffer-ignored',
`erc-receive-query-display', `erc-receive-query-display-defer',
`erc--cmem-from-nick-function', `erc-format-nick-function', and
`erc-format-query-as-channel-p' here.
(erc-server-401): Move `erc-whowas-on-nosuchnick' declaration here.
(erc-server-475): Move `erc--called-as-input-p' and
`erc-prompt-for-channel-key' declarations here.
* lisp/erc/erc-common.el (erc-log-p): Remove declaration for
`erc-log-p' and replace with actual definition.
(erc-log-aux): Move `erc-dbuf' declaration from top level into
function body.
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Note in
the doc string that this function produces side effects.
* lisp/erc/erc-networks.el (erc-determine-network,
erc-networks--copy-server-buffer-functions): Move some variable
declarations to function body.
(erc-settings, erc-get): Deprecate for now and explain why in doc
strings. We could deprecate them unconditionally, but they never
provided usable code, and their names are short and valuable.
* lisp/erc/erc.el (tabbar--local-hlf, motif-version-string,
gtk-version-string): Prefer moving these single-serving declarations
to function bodies, if only to make closures from this library less
cluttered when debugging. This should also help avoid stray
declarations.
(erc-hooks, erc-timer-hook): Revise doc strings.
(erc-log-p): Move definition to erc-common.el.
(erc-cmd-SV): Mimic `emacs-version' and stick with `featurep', here in
combination with special-variable declarations, instead of `boundp' or
similar.
(erc-header-line-uses-tabbar-p): Explain that this has nothing to do
with `tab-bar'.
(erc-update-mode-line-buffer): Only assign when bound. This has been
verified to work with version 2.0 on EmacsWiki.
* test/lisp/erc/erc-scenarios-base-reconnect.el: Timeouts.
* test/lisp/erc/erc-scenarios-base-renick.el: Timeouts.
* test/lisp/erc/resources/join/network-id/foonet-again.eld: Timeouts.
2023-11-26 18:24:48 -08:00
|
|
|
"Use `tabbar-mode' integration instead of the header line.
|
|
|
|
This concerns a historical integration with the external library
|
|
|
|
`tabbar' <https://www.emacswiki.org/emacs/tabbar.el>, which
|
|
|
|
shouldn't be confused with the built-in `tab-bar' described in
|
|
|
|
Info node `(emacs) Tab Bars'."
|
2008-12-23 06:58:19 +00:00
|
|
|
:group 'erc-mode-line-and-header
|
|
|
|
:type 'boolean)
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defcustom erc-header-line-uses-help-echo-p t
|
2021-09-19 12:59:01 +02:00
|
|
|
"Show header line in echo area or as a tooltip
|
|
|
|
when point moves to the header line."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-mode-line-and-header
|
|
|
|
:type 'boolean)
|
|
|
|
|
2006-03-27 11:27:46 +00:00
|
|
|
(defcustom erc-header-line-face-method nil
|
|
|
|
"Determine what method to use when colorizing the header line text.
|
|
|
|
|
|
|
|
If nil, don't colorize the header text.
|
|
|
|
If given a function, call it and use the resulting face name.
|
|
|
|
Otherwise, use the `erc-header-line' face."
|
|
|
|
:group 'erc-mode-line-and-header
|
|
|
|
:type '(choice (const :tag "Don't colorize" nil)
|
2014-11-08 20:51:43 -05:00
|
|
|
(const :tag "Use the erc-header-line face" t)
|
|
|
|
(function :tag "Call a function")))
|
2006-03-27 11:27:46 +00:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defcustom erc-show-channel-key-p t
|
2007-06-06 22:10:42 +00:00
|
|
|
"Show the channel key in the header line."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-paranoia
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
(defcustom erc-mode-line-away-status-format
|
|
|
|
"(AWAY since %a %b %d %H:%M) "
|
|
|
|
"When you're away on a server, this is shown in the mode line.
|
|
|
|
This should be a string with substitution variables recognized by
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
`format-time-string'."
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-mode-line-and-header
|
|
|
|
:type 'string)
|
|
|
|
|
2017-12-20 16:29:40 -05:00
|
|
|
(defun erc-shorten-server-name (server)
|
|
|
|
"Shorten SERVER name according to `erc-common-server-suffixes'."
|
|
|
|
(if (stringp server)
|
2006-01-29 13:08:58 +00:00
|
|
|
(with-temp-buffer
|
2017-12-20 16:29:40 -05:00
|
|
|
(insert server)
|
2014-11-08 20:51:43 -05:00
|
|
|
(let ((alist erc-common-server-suffixes))
|
|
|
|
(while alist
|
|
|
|
(goto-char (point-min))
|
|
|
|
(if (re-search-forward (caar alist) nil t)
|
|
|
|
(replace-match (cdar alist)))
|
|
|
|
(setq alist (cdr alist))))
|
|
|
|
(buffer-string))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-format-target ()
|
|
|
|
"Return the name of the target (channel or nickname or servername:port)."
|
|
|
|
(let ((target (erc-default-target)))
|
|
|
|
(or target
|
2014-11-08 20:51:43 -05:00
|
|
|
(concat (erc-shorten-server-name
|
|
|
|
(or erc-server-announced-name
|
|
|
|
erc-session-server))
|
|
|
|
":" (erc-port-to-string erc-session-port)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-format-target-and/or-server ()
|
|
|
|
"Return the server name or the current target and server name combined."
|
|
|
|
(let ((server-name (erc-shorten-server-name
|
2014-11-08 20:51:43 -05:00
|
|
|
(or erc-server-announced-name
|
|
|
|
erc-session-server))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(cond ((erc-default-target)
|
2014-11-08 20:51:43 -05:00
|
|
|
(concat (erc-string-no-properties (erc-default-target))
|
|
|
|
"@" server-name))
|
|
|
|
(server-name server-name)
|
|
|
|
(t (buffer-name (current-buffer))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2008-01-25 03:28:10 +00:00
|
|
|
(defun erc-format-network ()
|
|
|
|
"Return the name of the network we are currently on."
|
2021-08-17 01:50:29 -07:00
|
|
|
(erc-network-name))
|
2008-01-25 03:28:10 +00:00
|
|
|
|
|
|
|
(defun erc-format-target-and/or-network ()
|
|
|
|
"Return the network or the current target and network combined.
|
|
|
|
If the name of the network is not available, then use the
|
|
|
|
shortened server name instead."
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(if-let ((erc--target)
|
2022-12-25 21:36:53 -08:00
|
|
|
(name (if-let ((erc-networks--id)
|
|
|
|
(esid (erc-networks--id-symbol erc-networks--id)))
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(symbol-name esid)
|
|
|
|
(erc-shorten-server-name (or erc-server-announced-name
|
|
|
|
erc-session-server)))))
|
|
|
|
(concat (erc--target-string erc--target) "@" name)
|
|
|
|
(buffer-name)))
|
2008-01-25 03:28:10 +00:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-format-away-status ()
|
2021-09-19 12:59:01 +02:00
|
|
|
"Return a formatted `erc-mode-line-away-status-format' if `erc-away' is non-nil."
|
2007-04-01 13:36:38 +00:00
|
|
|
(let ((a (erc-away-time)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if a
|
2014-11-08 20:51:43 -05:00
|
|
|
(format-time-string erc-mode-line-away-status-format a)
|
2006-01-29 13:08:58 +00:00
|
|
|
"")))
|
|
|
|
|
2021-10-07 14:26:36 +02:00
|
|
|
(defvar-local erc--away-indicator nil
|
|
|
|
"Cons containing an away indicator for the connection.")
|
|
|
|
|
|
|
|
(defvar erc-away-status-indicator "A"
|
|
|
|
"String shown by various formatting facilities to indicate away status.
|
|
|
|
Currently only used by the option `erc-prompt-format'.")
|
|
|
|
|
|
|
|
(defun erc--format-away-indicator ()
|
|
|
|
"Return char with `display' property of `erc--away-indicator'."
|
|
|
|
(and-let* ((indicator (erc-with-server-buffer
|
|
|
|
(or erc--away-indicator
|
|
|
|
(setq erc--away-indicator (list "")))))
|
|
|
|
(newcar (if (erc-away-time) erc-away-status-indicator "")))
|
|
|
|
;; Inform other buffers of the change when necessary.
|
|
|
|
(let ((dispp (not erc--inhibit-prompt-display-property-p)))
|
|
|
|
(unless (eq newcar (car indicator))
|
|
|
|
(erc--refresh-prompt-continue (and dispp 'hooks-only-p))
|
|
|
|
(setcar indicator newcar))
|
|
|
|
(if dispp
|
|
|
|
(propertize "(away?)" 'display indicator)
|
|
|
|
newcar))))
|
|
|
|
|
|
|
|
(defvar-local erc--user-modes-indicator nil
|
|
|
|
"Cons containing connection-wide indicator for user modes.")
|
|
|
|
|
|
|
|
;; If adding more of these functions, should factor out commonalities.
|
|
|
|
;; As of ERC 5.6, this is identical to the away variant aside from
|
|
|
|
;; the var names and `eq', which isn't important.
|
|
|
|
(defun erc--format-user-modes ()
|
|
|
|
"Return server's user modes as a string"
|
|
|
|
(and-let* ((indicator (erc-with-server-buffer
|
|
|
|
(or erc--user-modes-indicator
|
|
|
|
(setq erc--user-modes-indicator (list "")))))
|
|
|
|
(newcar (erc--user-modes 'string)))
|
|
|
|
(let ((dispp (not erc--inhibit-prompt-display-property-p)))
|
|
|
|
(unless (string= newcar (car indicator))
|
|
|
|
(erc--refresh-prompt-continue (and dispp 'hooks-only-p))
|
|
|
|
(setcar indicator newcar))
|
|
|
|
(if dispp
|
|
|
|
(propertize "(user-modes?)" 'display indicator)
|
|
|
|
newcar))))
|
|
|
|
|
|
|
|
(defun erc--format-channel-status-prefix ()
|
|
|
|
"Return the current channel membership prefix."
|
|
|
|
(and (erc--target-channel-p erc--target)
|
|
|
|
(erc-get-user-mode-prefix (erc-current-nick))))
|
|
|
|
|
|
|
|
(defun erc--format-modes (&optional no-query-p)
|
|
|
|
"Return a string of channel modes in channels and user modes elsewhere.
|
|
|
|
With NO-QUERY-P, return nil instead of user modes in query
|
|
|
|
buffers. Also return nil when mode information is unavailable."
|
|
|
|
(cond ((erc--target-channel-p erc--target)
|
|
|
|
(erc--channel-modes 'string))
|
|
|
|
((not (and erc--target no-query-p))
|
|
|
|
(erc--format-user-modes))))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-format-channel-modes ()
|
2007-01-17 18:17:25 +00:00
|
|
|
"Return the current channel's modes."
|
2015-03-16 14:49:01 -04:00
|
|
|
(concat (apply #'concat
|
2014-11-08 20:51:43 -05:00
|
|
|
"+" erc-channel-modes)
|
|
|
|
(cond ((and erc-channel-user-limit erc-channel-key)
|
|
|
|
(if erc-show-channel-key-p
|
|
|
|
(format "lk %.0f %s" erc-channel-user-limit
|
|
|
|
erc-channel-key)
|
|
|
|
(format "kl %.0f" erc-channel-user-limit)))
|
|
|
|
(erc-channel-user-limit
|
|
|
|
;; Emacs has no bignums
|
|
|
|
(format "l %.0f" erc-channel-user-limit))
|
|
|
|
(erc-channel-key
|
|
|
|
(if erc-show-channel-key-p
|
|
|
|
(format "k %s" erc-channel-key)
|
|
|
|
"k"))
|
|
|
|
(t nil))))
|
2007-01-17 18:17:25 +00:00
|
|
|
|
|
|
|
(defun erc-format-lag-time ()
|
|
|
|
"Return the estimated lag time to server, `erc-server-lag'."
|
2007-04-01 13:36:38 +00:00
|
|
|
(let ((lag (erc-with-server-buffer erc-server-lag)))
|
2007-01-17 18:17:25 +00:00
|
|
|
(cond (lag (format "lag:%.0f" lag))
|
2014-11-08 20:51:43 -05:00
|
|
|
(t ""))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
;; TODO when ERC drops Emacs 28, replace the expressions in the format
|
|
|
|
;; spec below with functions.
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-update-mode-line-buffer (buffer)
|
|
|
|
"Update the mode line in a single ERC buffer BUFFER."
|
|
|
|
(with-current-buffer buffer
|
Fix and extend format-spec (bug#41758)
* lisp/format-spec.el: Use lexical-binding. Remove dependence on
subr-x.el.
(format-spec-make): Clarify docstring.
(format-spec--parse-modifiers): Rename to...
(format-spec--parse-flags): ...this and simplify. In particular,
don't bother parsing :space-pad which is redundant and unused.
(format-spec--pad): Remove, replacing with...
(format-spec--do-flags): ...this new helper function which performs
more of format-spec's supported text manipulation.
(format-spec): Autoload. Allow optional argument to take on special
values 'ignore' and 'delete' for more control over what happens when
a replacement for a format specification isn't provided. Bring back
proper support for a precision modifier similar to that of 'format'.
* lisp/battery.el (battery-format): Rewrite in terms of format-spec.
(battery-echo-area-format, battery-mode-line-format): Mention
support of format-spec syntax in docstrings.
* doc/lispref/strings.texi (Custom Format Strings):
* etc/NEWS: Document and announce these changes.
* lisp/dired-aux.el (dired-do-compress-to):
* lisp/erc/erc-match.el (erc-log-matches):
* lisp/erc/erc.el (erc-update-mode-line-buffer):
* lisp/gnus/gnus-sieve.el (gnus-sieve-update):
* lisp/gnus/gssapi.el (open-gssapi-stream):
* lisp/gnus/mail-source.el (mail-source-fetch-file)
(mail-source-fetch-directory, mail-source-fetch-pop)
(mail-source-fetch-imap):
* lisp/gnus/message.el (message-insert-formatted-citation-line):
* lisp/image-dired.el:
* lisp/net/eww.el:
* lisp/net/imap.el (imap-kerberos4-open, imap-gssapi-open)
(imap-shell-open):
* lisp/net/network-stream.el (network-stream-open-shell):
* lisp/obsolete/tls.el (open-tls-stream):
* lisp/textmodes/tex-mode.el:
Remove extraneous loads and autoloads of format-spec now that it is
autoloaded and simplify its uses where possible.
* test/lisp/battery-tests.el (battery-format): Test new format-spec
support.
* test/lisp/format-spec-tests.el (test-format-spec): Rename to...
(format-spec) ...this, extending test cases.
(test-format-unknown): Rename to...
(format-spec-unknown): ...this, extending test cases.
(test-format-modifiers): Rename to...
(format-spec-flags): ...this.
(format-spec-make, format-spec-parse-flags, format-spec-do-flags)
(format-spec-do-flags-truncate, format-spec-do-flags-pad)
(format-spec-do-flags-chop, format-spec-do-flags-case): New tests.
2020-05-29 19:56:14 +01:00
|
|
|
(let ((spec `((?a . ,(erc-format-away-status))
|
|
|
|
(?l . ,(erc-format-lag-time))
|
2023-11-20 19:45:30 -08:00
|
|
|
(?m . ,(or erc--mode-line-mode-string ""))
|
Fix and extend format-spec (bug#41758)
* lisp/format-spec.el: Use lexical-binding. Remove dependence on
subr-x.el.
(format-spec-make): Clarify docstring.
(format-spec--parse-modifiers): Rename to...
(format-spec--parse-flags): ...this and simplify. In particular,
don't bother parsing :space-pad which is redundant and unused.
(format-spec--pad): Remove, replacing with...
(format-spec--do-flags): ...this new helper function which performs
more of format-spec's supported text manipulation.
(format-spec): Autoload. Allow optional argument to take on special
values 'ignore' and 'delete' for more control over what happens when
a replacement for a format specification isn't provided. Bring back
proper support for a precision modifier similar to that of 'format'.
* lisp/battery.el (battery-format): Rewrite in terms of format-spec.
(battery-echo-area-format, battery-mode-line-format): Mention
support of format-spec syntax in docstrings.
* doc/lispref/strings.texi (Custom Format Strings):
* etc/NEWS: Document and announce these changes.
* lisp/dired-aux.el (dired-do-compress-to):
* lisp/erc/erc-match.el (erc-log-matches):
* lisp/erc/erc.el (erc-update-mode-line-buffer):
* lisp/gnus/gnus-sieve.el (gnus-sieve-update):
* lisp/gnus/gssapi.el (open-gssapi-stream):
* lisp/gnus/mail-source.el (mail-source-fetch-file)
(mail-source-fetch-directory, mail-source-fetch-pop)
(mail-source-fetch-imap):
* lisp/gnus/message.el (message-insert-formatted-citation-line):
* lisp/image-dired.el:
* lisp/net/eww.el:
* lisp/net/imap.el (imap-kerberos4-open, imap-gssapi-open)
(imap-shell-open):
* lisp/net/network-stream.el (network-stream-open-shell):
* lisp/obsolete/tls.el (open-tls-stream):
* lisp/textmodes/tex-mode.el:
Remove extraneous loads and autoloads of format-spec now that it is
autoloaded and simplify its uses where possible.
* test/lisp/battery-tests.el (battery-format): Test new format-spec
support.
* test/lisp/format-spec-tests.el (test-format-spec): Rename to...
(format-spec) ...this, extending test cases.
(test-format-unknown): Rename to...
(format-spec-unknown): ...this, extending test cases.
(test-format-modifiers): Rename to...
(format-spec-flags): ...this.
(format-spec-make, format-spec-parse-flags, format-spec-do-flags)
(format-spec-do-flags-truncate, format-spec-do-flags-pad)
(format-spec-do-flags-chop, format-spec-do-flags-case): New tests.
2020-05-29 19:56:14 +01:00
|
|
|
(?n . ,(or (erc-current-nick) ""))
|
|
|
|
(?N . ,(erc-format-network))
|
|
|
|
(?o . ,(or (erc-controls-strip erc-channel-topic) ""))
|
|
|
|
(?p . ,(erc-port-to-string erc-session-port))
|
|
|
|
(?s . ,(erc-format-target-and/or-server))
|
|
|
|
(?S . ,(erc-format-target-and/or-network))
|
|
|
|
(?t . ,(erc-format-target))))
|
2022-10-27 00:21:10 -07:00
|
|
|
(process-status (cond ((erc-server-process-alive buffer)
|
|
|
|
(unless erc-server-connected
|
|
|
|
": connecting"))
|
|
|
|
((erc-with-server-buffer
|
|
|
|
erc--server-reconnect-timer)
|
|
|
|
erc--mode-line-process-reconnecting)
|
2014-11-08 20:51:43 -05:00
|
|
|
(t
|
|
|
|
": CLOSED")))
|
|
|
|
(face (cond ((eq erc-header-line-face-method nil)
|
|
|
|
nil)
|
|
|
|
((functionp erc-header-line-face-method)
|
|
|
|
(funcall erc-header-line-face-method))
|
|
|
|
(t
|
|
|
|
'erc-header-line))))
|
2019-06-20 01:44:19 +02:00
|
|
|
(setq mode-line-buffer-identification
|
|
|
|
(list (format-spec erc-mode-line-format spec)))
|
2022-10-27 00:21:10 -07:00
|
|
|
(setq mode-line-process process-status)
|
2021-02-05 01:33:25 +01:00
|
|
|
(let ((header (if erc-header-line-format
|
|
|
|
(format-spec erc-header-line-format spec)
|
|
|
|
nil)))
|
|
|
|
(cond (erc-header-line-uses-tabbar-p
|
Sequester some special-variable declarations in ERC
* lisp/erc/erc-backend.el (erc-log-p): Remove declaration entirely.
(erc-server-reconnect): Move declaration for `erc-reuse-buffers' here.
(erc-process-sentinel-1): Move `erc-kill-server-buffer-on-quit'
declaration here.
(erc--conceal-prompt): Move `erc-prompt-hidden' declaration here.
(erc-server-INVITE): Move `erc-invitation' declaration here.
(erc-server-PART): Move `erc-kill-buffer-on-part' declaration here.
(erc-server-PRIVMSG): Move declarations for `erc-minibuffer-ignored',
`erc-receive-query-display', `erc-receive-query-display-defer',
`erc--cmem-from-nick-function', `erc-format-nick-function', and
`erc-format-query-as-channel-p' here.
(erc-server-401): Move `erc-whowas-on-nosuchnick' declaration here.
(erc-server-475): Move `erc--called-as-input-p' and
`erc-prompt-for-channel-key' declarations here.
* lisp/erc/erc-common.el (erc-log-p): Remove declaration for
`erc-log-p' and replace with actual definition.
(erc-log-aux): Move `erc-dbuf' declaration from top level into
function body.
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Note in
the doc string that this function produces side effects.
* lisp/erc/erc-networks.el (erc-determine-network,
erc-networks--copy-server-buffer-functions): Move some variable
declarations to function body.
(erc-settings, erc-get): Deprecate for now and explain why in doc
strings. We could deprecate them unconditionally, but they never
provided usable code, and their names are short and valuable.
* lisp/erc/erc.el (tabbar--local-hlf, motif-version-string,
gtk-version-string): Prefer moving these single-serving declarations
to function bodies, if only to make closures from this library less
cluttered when debugging. This should also help avoid stray
declarations.
(erc-hooks, erc-timer-hook): Revise doc strings.
(erc-log-p): Move definition to erc-common.el.
(erc-cmd-SV): Mimic `emacs-version' and stick with `featurep', here in
combination with special-variable declarations, instead of `boundp' or
similar.
(erc-header-line-uses-tabbar-p): Explain that this has nothing to do
with `tab-bar'.
(erc-update-mode-line-buffer): Only assign when bound. This has been
verified to work with version 2.0 on EmacsWiki.
* test/lisp/erc/erc-scenarios-base-reconnect.el: Timeouts.
* test/lisp/erc/erc-scenarios-base-renick.el: Timeouts.
* test/lisp/erc/resources/join/network-id/foonet-again.eld: Timeouts.
2023-11-26 18:24:48 -08:00
|
|
|
(when (boundp 'tabbar--local-hlf)
|
|
|
|
(setq-local tabbar--local-hlf header-line-format))
|
2021-02-05 01:33:25 +01:00
|
|
|
(kill-local-variable 'header-line-format))
|
|
|
|
((null header)
|
|
|
|
(setq header-line-format nil))
|
|
|
|
(erc-header-line-uses-help-echo-p
|
|
|
|
(let ((help-echo (with-temp-buffer
|
|
|
|
(insert header)
|
|
|
|
(fill-region (point-min) (point-max))
|
|
|
|
(buffer-string))))
|
|
|
|
(setq header-line-format
|
2022-07-08 04:58:26 -07:00
|
|
|
(string-replace
|
|
|
|
"%"
|
|
|
|
"%%"
|
|
|
|
(if face
|
|
|
|
(propertize header 'help-echo help-echo 'face face)
|
|
|
|
(propertize header 'help-echo help-echo))))))
|
2021-02-05 01:33:25 +01:00
|
|
|
(t (setq header-line-format
|
|
|
|
(if face
|
|
|
|
(propertize header 'face face)
|
|
|
|
header))))))
|
2019-06-20 01:44:19 +02:00
|
|
|
(force-mode-line-update)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-update-mode-line (&optional buffer)
|
|
|
|
"Update the mode line in BUFFER.
|
|
|
|
|
|
|
|
If BUFFER is nil, update the mode line in all ERC buffers."
|
|
|
|
(if (and buffer (bufferp buffer))
|
|
|
|
(erc-update-mode-line-buffer buffer)
|
|
|
|
(dolist (buf (erc-buffer-list))
|
|
|
|
(when (buffer-live-p buf)
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-update-mode-line-buffer buf)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;; Miscellaneous
|
|
|
|
|
2021-10-06 22:49:59 -04:00
|
|
|
(defun erc-bug (subject)
|
|
|
|
"Send a bug report to the Emacs bug tracker and ERC mailing list."
|
|
|
|
(interactive "sBug Subject: ")
|
|
|
|
(report-emacs-bug
|
|
|
|
(format "ERC %s: %s" erc-version subject))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(insert "X-Debbugs-CC: emacs-erc@gnu.org\n")))
|
|
|
|
|
2023-05-22 21:43:29 -07:00
|
|
|
(defconst erc--news-url
|
|
|
|
"https://git.savannah.gnu.org/cgit/emacs.git/plain/etc/ERC-NEWS")
|
|
|
|
|
|
|
|
(defvar erc--news-temp-file nil)
|
|
|
|
|
|
|
|
(defun erc-news (arg)
|
|
|
|
"Show ERC news in a manner similar to `view-emacs-news'.
|
|
|
|
With ARG, download and display the latest revision, which may
|
|
|
|
contain more up-to-date information, even for older versions."
|
|
|
|
(interactive "P")
|
|
|
|
(find-file
|
2023-06-01 23:18:56 -07:00
|
|
|
(or (and erc--news-temp-file
|
2023-05-22 21:43:29 -07:00
|
|
|
(time-less-p (current-time) (car erc--news-temp-file))
|
2023-06-01 23:18:56 -07:00
|
|
|
(not (and arg (y-or-n-p (format "Re-fetch? "))))
|
2023-05-22 21:43:29 -07:00
|
|
|
(cdr erc--news-temp-file))
|
|
|
|
(and arg
|
|
|
|
(with-current-buffer (url-retrieve-synchronously erc--news-url)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(search-forward "200 OK" (pos-eol))
|
|
|
|
(search-forward "\n\n")
|
|
|
|
(delete-region (point-min) (point))
|
2023-06-01 23:18:56 -07:00
|
|
|
;; May warn about file having changed on disk (unless
|
|
|
|
;; `query-about-changed-file' is nil on 28+).
|
|
|
|
(let ((tempfile (or (cdr erc--news-temp-file)
|
|
|
|
(make-temp-file "erc-news."))))
|
2023-05-22 21:43:29 -07:00
|
|
|
(write-region (point-min) (point-max) tempfile)
|
|
|
|
(kill-buffer)
|
|
|
|
(cdr (setq erc--news-temp-file
|
|
|
|
(cons (time-add (current-time) (* 60 60 12))
|
|
|
|
tempfile))))))
|
|
|
|
(and-let* ((file (or (eval-when-compile (macroexp-file-name))
|
|
|
|
(locate-library "erc")))
|
|
|
|
(dir (file-name-directory file))
|
|
|
|
(adjacent (expand-file-name "ERC-NEWS" dir))
|
|
|
|
((file-exists-p adjacent)))
|
|
|
|
adjacent)
|
|
|
|
(expand-file-name "ERC-NEWS" data-directory)))
|
|
|
|
(when (fboundp 'emacs-news-view-mode)
|
|
|
|
(emacs-news-view-mode))
|
2023-06-01 23:18:56 -07:00
|
|
|
(goto-char (point-min))
|
2023-05-22 21:43:29 -07:00
|
|
|
(let ((v (mapcar #'number-to-string
|
|
|
|
(seq-take-while #'natnump (version-to-list erc-version)))))
|
2023-06-01 23:18:56 -07:00
|
|
|
(while (and v (not (search-forward (concat "\014\n* Changes in ERC "
|
|
|
|
(string-join v "."))
|
|
|
|
nil t)))
|
2023-05-22 21:43:29 -07:00
|
|
|
(setq v (butlast v))))
|
|
|
|
(beginning-of-line))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-port-to-string (p)
|
|
|
|
"Convert port P to a string.
|
|
|
|
P may be an integer or a service name."
|
|
|
|
(if (integerp p)
|
|
|
|
(int-to-string p)
|
|
|
|
p))
|
|
|
|
|
|
|
|
(defun erc-string-to-port (s)
|
|
|
|
"Convert string S to either an integer port number or a service name."
|
2006-11-20 06:50:29 +00:00
|
|
|
(if (numberp s)
|
|
|
|
s
|
|
|
|
(let ((n (string-to-number s)))
|
|
|
|
(if (= n 0)
|
2014-11-08 20:51:43 -05:00
|
|
|
s
|
|
|
|
n))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2021-10-06 21:50:56 -04:00
|
|
|
(defun erc-version (&optional here bold-erc)
|
2006-01-29 13:08:58 +00:00
|
|
|
"Show the version number of ERC in the minibuffer.
|
2021-10-06 21:50:56 -04:00
|
|
|
If optional argument HERE is non-nil, insert version number at point.
|
|
|
|
If optional argument BOLD-ERC is non-nil, display \"ERC\" as bold."
|
2006-01-29 13:08:58 +00:00
|
|
|
(interactive "P")
|
|
|
|
(let ((version-string
|
2021-10-06 21:50:56 -04:00
|
|
|
(format "%s %s (IRC client for GNU Emacs %s)"
|
|
|
|
(if bold-erc
|
|
|
|
"\C-bERC\C-b"
|
|
|
|
"ERC")
|
|
|
|
erc-version
|
|
|
|
emacs-version)))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if here
|
2014-11-08 20:51:43 -05:00
|
|
|
(insert version-string)
|
Use cl-lib instead of cl, and interactive-p => called-interactively-p.
* lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
called-interactively-p instead of cl.
* lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
* lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
* lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
* lisp/erc/erc-capab.el: Don't require cl since we don't use it.
* lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
(erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
* lisp/json.el: Don't require cl since we don't use it.
* lisp/color.el: Don't require cl.
(color-complement): `caddr' -> `nth 2'.
* test/automated/ert-x-tests.el: Use cl-lib.
* test/automated/ert-tests.el: Use lexical-binding and cl-lib.
2012-11-19 12:24:12 -05:00
|
|
|
(if (called-interactively-p 'interactive)
|
2014-11-08 20:51:43 -05:00
|
|
|
(message "%s" version-string)
|
|
|
|
version-string))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-modes (&optional here)
|
|
|
|
"Show the active ERC modes in the minibuffer.
|
|
|
|
If optional argument HERE is non-nil, insert version number at point."
|
|
|
|
(interactive "P")
|
|
|
|
(let ((string
|
2021-01-04 00:21:02 -05:00
|
|
|
(mapconcat #'identity
|
2014-11-08 20:51:43 -05:00
|
|
|
(let (modes (case-fold-search nil))
|
|
|
|
(dolist (var (apropos-internal "^erc-.*mode$"))
|
|
|
|
(when (and (boundp var)
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(get var 'erc-module)
|
2014-11-08 20:51:43 -05:00
|
|
|
(symbol-value var))
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(setq modes (cons (concat "`" (symbol-name var) "'")
|
2014-11-08 20:51:43 -05:00
|
|
|
modes))))
|
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
2023-06-09 21:00:03 -07:00
|
|
|
(sort modes #'string<))
|
2014-11-08 20:51:43 -05:00
|
|
|
", ")))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if here
|
2014-11-08 20:51:43 -05:00
|
|
|
(insert string)
|
Use cl-lib instead of cl, and interactive-p => called-interactively-p.
* lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
called-interactively-p instead of cl.
* lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
* lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
* lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
* lisp/erc/erc-capab.el: Don't require cl since we don't use it.
* lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
(erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
* lisp/json.el: Don't require cl since we don't use it.
* lisp/color.el: Don't require cl.
(color-complement): `caddr' -> `nth 2'.
* test/automated/ert-x-tests.el: Use cl-lib.
* test/automated/ert-tests.el: Use lexical-binding and cl-lib.
2012-11-19 12:24:12 -05:00
|
|
|
(if (called-interactively-p 'interactive)
|
2014-11-08 20:51:43 -05:00
|
|
|
(message "%s" string)
|
|
|
|
string))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-trim-string (s)
|
|
|
|
"Trim leading and trailing spaces off S."
|
|
|
|
(cond
|
|
|
|
((not (stringp s)) nil)
|
|
|
|
((string-match "^\\s-*$" s)
|
|
|
|
"")
|
|
|
|
((string-match "^\\s-*\\(.*\\S-\\)\\s-*$" s)
|
|
|
|
(match-string 1 s))
|
|
|
|
(t
|
|
|
|
s)))
|
|
|
|
|
|
|
|
(defun erc-arrange-session-in-multiple-windows ()
|
|
|
|
"Open a window for every non-server buffer related to `erc-session-server'.
|
|
|
|
|
|
|
|
All windows are opened in the current frame."
|
|
|
|
(interactive)
|
2006-11-20 06:50:29 +00:00
|
|
|
(unless erc-server-process
|
|
|
|
(error "No erc-server-process found in current buffer"))
|
2006-01-29 13:08:58 +00:00
|
|
|
(let ((bufs (erc-buffer-list nil erc-server-process)))
|
|
|
|
(when bufs
|
|
|
|
(delete-other-windows)
|
|
|
|
(switch-to-buffer (car bufs))
|
|
|
|
(setq bufs (cdr bufs))
|
|
|
|
(while bufs
|
2014-11-08 20:51:43 -05:00
|
|
|
(split-window)
|
|
|
|
(other-window 1)
|
|
|
|
(switch-to-buffer (car bufs))
|
|
|
|
(setq bufs (cdr bufs))
|
|
|
|
(balance-windows)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-popup-input-buffer ()
|
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Simplify.
(erc-prompt-for-channel-key, erc-ignore-reply-list, erc-send-post-hook,
erc-active-buffer, erc-join-buffer, erc-frame-alist, erc-with-buffer,
erc-modules, erc-display-message-highlight, erc-process-input-line,
erc-cmd-HELP, erc-server-hooks, erc-echo-notice-in-user-buffers,
erc-format-my-nick, erc-echo-notice-in-user-and-target-buffers,
erc-echo-notice-in-first-user-buffer, erc-connection-established,
erc-update-user-nick, erc-update-channel-member, erc-highlight-notice,
erc-command-symbol, erc-add-query, erc-process-script-line,
erc-determine-parameters, erc-client-info, erc-popup-input-buffer,
erc-script-echo): Fix typos in docstrings.
(erc-channel-user-op-p, erc-channel-user-voice-p, erc-startup-file-list,
define-erc-module, erc-once-with-server-event,
erc-once-with-server-event-global, erc-debug-irc-protocol, erc-log-irc-protocol,
erc-cmd-LOAD, erc-update-user, erc-update-current-channel-member,
erc-load-script, erc-mode-line-away-status-format): Doc fixes.
2006-11-28 01:39:08 +00:00
|
|
|
"Provide an input buffer."
|
2014-11-08 20:51:43 -05:00
|
|
|
(interactive)
|
|
|
|
(let ((buffer-name (generate-new-buffer-name "*ERC input*"))
|
|
|
|
(mode (intern
|
|
|
|
(completing-read
|
|
|
|
"Mode: "
|
|
|
|
(mapcar (lambda (e)
|
|
|
|
(list (symbol-name e)))
|
2015-03-16 14:49:01 -04:00
|
|
|
(apropos-internal "-mode\\'" 'commandp))
|
2014-11-08 20:51:43 -05:00
|
|
|
nil t))))
|
|
|
|
(pop-to-buffer (make-indirect-buffer (current-buffer) buffer-name))
|
|
|
|
(funcall mode)
|
|
|
|
(narrow-to-region (point) (point))
|
|
|
|
(shrink-window-if-larger-than-buffer)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;;; Message catalog
|
|
|
|
|
Define ERC message-formatting templates with defvar
* etc/ERC-NEWS: Mention convenience macro being preferred means of
defining message templates. Mention renaming of `notify' formatting
templates.
* lisp/erc/erc-common.el (erc--define-catalog,
erc-define-message-format-catalog): New macro and internal variant to
replace `erc-define-catalog-entry'. The internal variant allows us to
defer reindenting existing definitions until meaningfully edited.
* lisp/erc/erc-dcc.el (erc-message-english-dcc-chat-discarded,
erc-message-english-dcc-chat-ended,
erc-message-english-dcc-chat-no-request,
erc-message-english-dcc-chat-offered,
erc-message-english-dcc-chat-offer,
erc-message-english-dcc-chat-accept,
erc-message-english-dcc-chat-privmsg, erc-message-english-dcc-closed,
erc-message-english-dcc-command-undefined,
erc-message-english-dcc-ctcp-errmsg,
erc-message-english-dcc-ctcp-unknown,
erc-message-english-dcc-get-bytes-received,
erc-message-english-dcc-get-complete,
erc-message-english-dcc-get-failed,
erc-message-english-dcc-get-cmd-aborted,
erc-message-english-dcc-get-file-too-long,
erc-message-english-dcc-get-notfound,
erc-message-english-dcc-list-head, erc-message-english-dcc-list-line,
erc-message-english-dcc-list-item, erc-message-english-dcc-list-end,
erc-message-english-dcc-malformed,
erc-message-english-dcc-privileged-port,
erc-message-english-dcc-request-bogus,
erc-message-english-dcc-send-finished,
erc-message-english-dcc-send-offered,
erc-message-english-dcc-send-offer): Define at top level using
`defvar'.
* lisp/erc/erc-netsplit.el (erc-netsplit-mode, erc-netsplit-enable):
Don't call `erc-netsplit-install-message-catalogs'.
(erc-netsplit-install-message-catalogs): Deprecate function.
(erc-message-english-netsplit, erc-message-english-netjoin,
erc-message-english-netjoin-done, erc-message-english-netsplit-none,
erc-message-english-netsplit-wholeft): Define at top level using
`defvar'.
* lisp/erc/erc-notify.el (erc-notify-install-message-catalogs):
Deprecate, and rename all format templates with hyphens instead of
underscores.
(erc-notify-timer, erc-notify-JOIN, erc-notify-NICK, erc-notify-QUIT):
Use hyphenated template names.
(erc-cmd-NOTIFY): Use hyphenated template names. Load the module when
necessary and emit a warning. Otherwise, people who discover this
autoloaded command without being aware of the module's existence may
think it's "broken".
(pcomplete/erc-mode/NOTIFY): Replace top-level autoload with `require'
in function body. Include `erc-notify-list' in list of completions,
which makes removal easier if you don't share any channels with a
person, and they're not in `erc-server-users'. A better long-term
solution might be to WHOIS folks we're unsure about when they're
listed in a 303.
(erc-message-english-notify_current, erc-message-english-notify_list,
erc-message-english-notify_on, erc-message-english-notify_off): Define
at top level using `defvar'. Replace nonstandard underscores with
hyphens. Alias obsolete names.
* lisp/erc/erc-page.el (erc-message-english-CTCP-PAGE): Define at top
level using `defvar'.
* lisp/erc/erc-sasl.el (erc-message-english-s902,
erc-message-english-s904, erc-message-english-s905,
erc-message-english-s906, erc-message-english-s907,
erc-message-english-s908): Define at top level using `defvar'.
* lisp/erc/erc-sound.el (erc-message-english-CTCP-SOUND): Define using
`defvar'.
* lisp/erc/erc.el (erc--make-message-variable-name): New function to
replace `erc-make-message-variable-name' internally, where most uses
previously checked whether the returned variable was bound. This
helper now does that conditionally, when asked.
(erc-make-message-variable-name): Defer to internal variant,
`erc--make-message-variable-name'.
(erc-define-catalog-entry, erc-define-catalog): Deprecate.
(erc-retrieve-catalog-entry): Refactor to favor
`default-toplevel-value' of `erc-current-message-catalog' before
falling back to `english'. Not doing this was arguably a bug.
(erc-message-english-bad-ping-response,
erc-message-english-bad-syntax, erc-message-english-incorrect-args,
erc-message-english-cannot-find-file,
erc-message-english-cannot-read-file, erc-message-english-connect,
erc-message-english-country, erc-message-english-country-unknown,
erc-message-english-ctcp-empty, erc-message-english-ctcp-request,
erc-message-english-ctcp-request-to,
erc-message-english-ctcp-too-many, erc-message-english-flood-ctcp-off,
erc-message-english-flood-strict-mode,
erc-message-english-disconnected,
erc-message-english-disconnected-noreconnect,
erc-message-english-reconnecting,
erc-message-english-reconnect-canceled, erc-message-english-finished,
erc-message-english-terminated, erc-message-english-login,
erc-message-english-nick-in-use, erc-message-english-nick-too-long,
erc-message-english-no-default-channel,
erc-message-english-no-invitation, erc-message-english-no-target,
erc-message-english-ops, erc-message-english-ops-none,
erc-message-english-undefined-ctcp,
erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop,
erc-message-english-variable-not-bound, erc-message-english-ACTION,
erc-message-english-CTCP-CLIENTINFO, erc-message-english-CTCP-ECHO,
erc-message-english-CTCP-FINGER, erc-message-english-CTCP-PING,
erc-message-english-CTCP-TIME, erc-message-english-CTCP-UNKNOWN,
erc-message-english-CTCP-VERSION, erc-message-english-ERROR,
erc-message-english-INVITE, erc-message-english-JOIN,
erc-message-english-JOIN-you, erc-message-english-KICK,
erc-message-english-KICK-you, erc-message-english-KICK-by-you,
erc-message-english-MODE, erc-message-english-MODE-nick,
erc-message-english-NICK, erc-message-english-NICK-you,
erc-message-english-PART, erc-message-english-PING,
erc-message-english-PONG, erc-message-english-QUIT,
erc-message-english-TOPIC, erc-message-english-WALLOPS,
erc-message-english-s004, erc-message-english-s221,
erc-message-english-s252, erc-message-english-s253,
erc-message-english-s254, erc-message-english-s275,
erc-message-english-s301, erc-message-english-s303,
erc-message-english-s305, erc-message-english-s306,
erc-message-english-s307, erc-message-english-s311,
erc-message-english-s312, erc-message-english-s313,
erc-message-english-s314, erc-message-english-s317,
erc-message-english-s317-on-since, erc-message-english-s319,
erc-message-english-s320, erc-message-english-s321,
erc-message-english-s322, erc-message-english-s324,
erc-message-english-s328, erc-message-english-s329,
erc-message-english-s330, erc-message-english-s331,
erc-message-english-s332, erc-message-english-s333,
erc-message-english-s341, erc-message-english-s352,
erc-message-english-s353, erc-message-english-s367,
erc-message-english-s367-set-by, erc-message-english-s368,
erc-message-english-s379, erc-message-english-s391,
erc-message-english-s396, erc-message-english-s401,
erc-message-english-s402, erc-message-english-s403,
erc-message-english-s404, erc-message-english-s405,
erc-message-english-s406, erc-message-english-s412,
erc-message-english-s421, erc-message-english-s431,
erc-message-english-s432, erc-message-english-s442,
erc-message-english-s445, erc-message-english-s446,
erc-message-english-s451, erc-message-english-s461,
erc-message-english-s462, erc-message-english-s463,
erc-message-english-s464, erc-message-english-s465,
erc-message-english-s471, erc-message-english-s473,
erc-message-english-s474, erc-message-english-s475,
erc-message-english-s481, erc-message-english-s482,
erc-message-english-s483, erc-message-english-s484,
erc-message-english-s485, erc-message-english-s491,
erc-message-english-s501, erc-message-english-s502,
erc-message-english-s671): Define at top level using `defvar'.
* test/lisp/erc/erc-tests.el (erc-tests--string-to-propertized-parts,
erc-tests-pp-propertized-parts, erc--make-message-variable-name,
erc-retrieve-catalog-entry): New tests along with utility functions
and a convenience command for manipulating catalogs. (Bug#67677)
2023-11-28 16:51:36 -08:00
|
|
|
(define-inline erc--make-message-variable-name (catalog key softp)
|
|
|
|
"Return variable name conforming to ERC's message-catalog interface.
|
|
|
|
Given a CATALOG symbol `mycat' and format-string KEY `mykey',
|
|
|
|
also a symbol, return the symbol `erc-message-mycat-mykey'. With
|
|
|
|
SOFTP, only do so when defined as a variable."
|
|
|
|
(inline-quote
|
|
|
|
(let* ((catname (symbol-name ,catalog))
|
|
|
|
(prefix (if (eq ?- (aref catname 0)) "erc--message" "erc-message-"))
|
|
|
|
(name (concat prefix catname "-" (symbol-name ,key))))
|
|
|
|
(if ,softp
|
|
|
|
(and-let* ((s (intern-soft name)) ((boundp s))) s)
|
|
|
|
(intern name)))))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-make-message-variable-name (catalog entry)
|
|
|
|
"Create a variable name corresponding to CATALOG's ENTRY."
|
Define ERC message-formatting templates with defvar
* etc/ERC-NEWS: Mention convenience macro being preferred means of
defining message templates. Mention renaming of `notify' formatting
templates.
* lisp/erc/erc-common.el (erc--define-catalog,
erc-define-message-format-catalog): New macro and internal variant to
replace `erc-define-catalog-entry'. The internal variant allows us to
defer reindenting existing definitions until meaningfully edited.
* lisp/erc/erc-dcc.el (erc-message-english-dcc-chat-discarded,
erc-message-english-dcc-chat-ended,
erc-message-english-dcc-chat-no-request,
erc-message-english-dcc-chat-offered,
erc-message-english-dcc-chat-offer,
erc-message-english-dcc-chat-accept,
erc-message-english-dcc-chat-privmsg, erc-message-english-dcc-closed,
erc-message-english-dcc-command-undefined,
erc-message-english-dcc-ctcp-errmsg,
erc-message-english-dcc-ctcp-unknown,
erc-message-english-dcc-get-bytes-received,
erc-message-english-dcc-get-complete,
erc-message-english-dcc-get-failed,
erc-message-english-dcc-get-cmd-aborted,
erc-message-english-dcc-get-file-too-long,
erc-message-english-dcc-get-notfound,
erc-message-english-dcc-list-head, erc-message-english-dcc-list-line,
erc-message-english-dcc-list-item, erc-message-english-dcc-list-end,
erc-message-english-dcc-malformed,
erc-message-english-dcc-privileged-port,
erc-message-english-dcc-request-bogus,
erc-message-english-dcc-send-finished,
erc-message-english-dcc-send-offered,
erc-message-english-dcc-send-offer): Define at top level using
`defvar'.
* lisp/erc/erc-netsplit.el (erc-netsplit-mode, erc-netsplit-enable):
Don't call `erc-netsplit-install-message-catalogs'.
(erc-netsplit-install-message-catalogs): Deprecate function.
(erc-message-english-netsplit, erc-message-english-netjoin,
erc-message-english-netjoin-done, erc-message-english-netsplit-none,
erc-message-english-netsplit-wholeft): Define at top level using
`defvar'.
* lisp/erc/erc-notify.el (erc-notify-install-message-catalogs):
Deprecate, and rename all format templates with hyphens instead of
underscores.
(erc-notify-timer, erc-notify-JOIN, erc-notify-NICK, erc-notify-QUIT):
Use hyphenated template names.
(erc-cmd-NOTIFY): Use hyphenated template names. Load the module when
necessary and emit a warning. Otherwise, people who discover this
autoloaded command without being aware of the module's existence may
think it's "broken".
(pcomplete/erc-mode/NOTIFY): Replace top-level autoload with `require'
in function body. Include `erc-notify-list' in list of completions,
which makes removal easier if you don't share any channels with a
person, and they're not in `erc-server-users'. A better long-term
solution might be to WHOIS folks we're unsure about when they're
listed in a 303.
(erc-message-english-notify_current, erc-message-english-notify_list,
erc-message-english-notify_on, erc-message-english-notify_off): Define
at top level using `defvar'. Replace nonstandard underscores with
hyphens. Alias obsolete names.
* lisp/erc/erc-page.el (erc-message-english-CTCP-PAGE): Define at top
level using `defvar'.
* lisp/erc/erc-sasl.el (erc-message-english-s902,
erc-message-english-s904, erc-message-english-s905,
erc-message-english-s906, erc-message-english-s907,
erc-message-english-s908): Define at top level using `defvar'.
* lisp/erc/erc-sound.el (erc-message-english-CTCP-SOUND): Define using
`defvar'.
* lisp/erc/erc.el (erc--make-message-variable-name): New function to
replace `erc-make-message-variable-name' internally, where most uses
previously checked whether the returned variable was bound. This
helper now does that conditionally, when asked.
(erc-make-message-variable-name): Defer to internal variant,
`erc--make-message-variable-name'.
(erc-define-catalog-entry, erc-define-catalog): Deprecate.
(erc-retrieve-catalog-entry): Refactor to favor
`default-toplevel-value' of `erc-current-message-catalog' before
falling back to `english'. Not doing this was arguably a bug.
(erc-message-english-bad-ping-response,
erc-message-english-bad-syntax, erc-message-english-incorrect-args,
erc-message-english-cannot-find-file,
erc-message-english-cannot-read-file, erc-message-english-connect,
erc-message-english-country, erc-message-english-country-unknown,
erc-message-english-ctcp-empty, erc-message-english-ctcp-request,
erc-message-english-ctcp-request-to,
erc-message-english-ctcp-too-many, erc-message-english-flood-ctcp-off,
erc-message-english-flood-strict-mode,
erc-message-english-disconnected,
erc-message-english-disconnected-noreconnect,
erc-message-english-reconnecting,
erc-message-english-reconnect-canceled, erc-message-english-finished,
erc-message-english-terminated, erc-message-english-login,
erc-message-english-nick-in-use, erc-message-english-nick-too-long,
erc-message-english-no-default-channel,
erc-message-english-no-invitation, erc-message-english-no-target,
erc-message-english-ops, erc-message-english-ops-none,
erc-message-english-undefined-ctcp,
erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop,
erc-message-english-variable-not-bound, erc-message-english-ACTION,
erc-message-english-CTCP-CLIENTINFO, erc-message-english-CTCP-ECHO,
erc-message-english-CTCP-FINGER, erc-message-english-CTCP-PING,
erc-message-english-CTCP-TIME, erc-message-english-CTCP-UNKNOWN,
erc-message-english-CTCP-VERSION, erc-message-english-ERROR,
erc-message-english-INVITE, erc-message-english-JOIN,
erc-message-english-JOIN-you, erc-message-english-KICK,
erc-message-english-KICK-you, erc-message-english-KICK-by-you,
erc-message-english-MODE, erc-message-english-MODE-nick,
erc-message-english-NICK, erc-message-english-NICK-you,
erc-message-english-PART, erc-message-english-PING,
erc-message-english-PONG, erc-message-english-QUIT,
erc-message-english-TOPIC, erc-message-english-WALLOPS,
erc-message-english-s004, erc-message-english-s221,
erc-message-english-s252, erc-message-english-s253,
erc-message-english-s254, erc-message-english-s275,
erc-message-english-s301, erc-message-english-s303,
erc-message-english-s305, erc-message-english-s306,
erc-message-english-s307, erc-message-english-s311,
erc-message-english-s312, erc-message-english-s313,
erc-message-english-s314, erc-message-english-s317,
erc-message-english-s317-on-since, erc-message-english-s319,
erc-message-english-s320, erc-message-english-s321,
erc-message-english-s322, erc-message-english-s324,
erc-message-english-s328, erc-message-english-s329,
erc-message-english-s330, erc-message-english-s331,
erc-message-english-s332, erc-message-english-s333,
erc-message-english-s341, erc-message-english-s352,
erc-message-english-s353, erc-message-english-s367,
erc-message-english-s367-set-by, erc-message-english-s368,
erc-message-english-s379, erc-message-english-s391,
erc-message-english-s396, erc-message-english-s401,
erc-message-english-s402, erc-message-english-s403,
erc-message-english-s404, erc-message-english-s405,
erc-message-english-s406, erc-message-english-s412,
erc-message-english-s421, erc-message-english-s431,
erc-message-english-s432, erc-message-english-s442,
erc-message-english-s445, erc-message-english-s446,
erc-message-english-s451, erc-message-english-s461,
erc-message-english-s462, erc-message-english-s463,
erc-message-english-s464, erc-message-english-s465,
erc-message-english-s471, erc-message-english-s473,
erc-message-english-s474, erc-message-english-s475,
erc-message-english-s481, erc-message-english-s482,
erc-message-english-s483, erc-message-english-s484,
erc-message-english-s485, erc-message-english-s491,
erc-message-english-s501, erc-message-english-s502,
erc-message-english-s671): Define at top level using `defvar'.
* test/lisp/erc/erc-tests.el (erc-tests--string-to-propertized-parts,
erc-tests-pp-propertized-parts, erc--make-message-variable-name,
erc-retrieve-catalog-entry): New tests along with utility functions
and a convenience command for manipulating catalogs. (Bug#67677)
2023-11-28 16:51:36 -08:00
|
|
|
(erc--make-message-variable-name catalog entry nil))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-define-catalog-entry (catalog entry format-spec)
|
|
|
|
"Set CATALOG's ENTRY to FORMAT-SPEC."
|
Define ERC message-formatting templates with defvar
* etc/ERC-NEWS: Mention convenience macro being preferred means of
defining message templates. Mention renaming of `notify' formatting
templates.
* lisp/erc/erc-common.el (erc--define-catalog,
erc-define-message-format-catalog): New macro and internal variant to
replace `erc-define-catalog-entry'. The internal variant allows us to
defer reindenting existing definitions until meaningfully edited.
* lisp/erc/erc-dcc.el (erc-message-english-dcc-chat-discarded,
erc-message-english-dcc-chat-ended,
erc-message-english-dcc-chat-no-request,
erc-message-english-dcc-chat-offered,
erc-message-english-dcc-chat-offer,
erc-message-english-dcc-chat-accept,
erc-message-english-dcc-chat-privmsg, erc-message-english-dcc-closed,
erc-message-english-dcc-command-undefined,
erc-message-english-dcc-ctcp-errmsg,
erc-message-english-dcc-ctcp-unknown,
erc-message-english-dcc-get-bytes-received,
erc-message-english-dcc-get-complete,
erc-message-english-dcc-get-failed,
erc-message-english-dcc-get-cmd-aborted,
erc-message-english-dcc-get-file-too-long,
erc-message-english-dcc-get-notfound,
erc-message-english-dcc-list-head, erc-message-english-dcc-list-line,
erc-message-english-dcc-list-item, erc-message-english-dcc-list-end,
erc-message-english-dcc-malformed,
erc-message-english-dcc-privileged-port,
erc-message-english-dcc-request-bogus,
erc-message-english-dcc-send-finished,
erc-message-english-dcc-send-offered,
erc-message-english-dcc-send-offer): Define at top level using
`defvar'.
* lisp/erc/erc-netsplit.el (erc-netsplit-mode, erc-netsplit-enable):
Don't call `erc-netsplit-install-message-catalogs'.
(erc-netsplit-install-message-catalogs): Deprecate function.
(erc-message-english-netsplit, erc-message-english-netjoin,
erc-message-english-netjoin-done, erc-message-english-netsplit-none,
erc-message-english-netsplit-wholeft): Define at top level using
`defvar'.
* lisp/erc/erc-notify.el (erc-notify-install-message-catalogs):
Deprecate, and rename all format templates with hyphens instead of
underscores.
(erc-notify-timer, erc-notify-JOIN, erc-notify-NICK, erc-notify-QUIT):
Use hyphenated template names.
(erc-cmd-NOTIFY): Use hyphenated template names. Load the module when
necessary and emit a warning. Otherwise, people who discover this
autoloaded command without being aware of the module's existence may
think it's "broken".
(pcomplete/erc-mode/NOTIFY): Replace top-level autoload with `require'
in function body. Include `erc-notify-list' in list of completions,
which makes removal easier if you don't share any channels with a
person, and they're not in `erc-server-users'. A better long-term
solution might be to WHOIS folks we're unsure about when they're
listed in a 303.
(erc-message-english-notify_current, erc-message-english-notify_list,
erc-message-english-notify_on, erc-message-english-notify_off): Define
at top level using `defvar'. Replace nonstandard underscores with
hyphens. Alias obsolete names.
* lisp/erc/erc-page.el (erc-message-english-CTCP-PAGE): Define at top
level using `defvar'.
* lisp/erc/erc-sasl.el (erc-message-english-s902,
erc-message-english-s904, erc-message-english-s905,
erc-message-english-s906, erc-message-english-s907,
erc-message-english-s908): Define at top level using `defvar'.
* lisp/erc/erc-sound.el (erc-message-english-CTCP-SOUND): Define using
`defvar'.
* lisp/erc/erc.el (erc--make-message-variable-name): New function to
replace `erc-make-message-variable-name' internally, where most uses
previously checked whether the returned variable was bound. This
helper now does that conditionally, when asked.
(erc-make-message-variable-name): Defer to internal variant,
`erc--make-message-variable-name'.
(erc-define-catalog-entry, erc-define-catalog): Deprecate.
(erc-retrieve-catalog-entry): Refactor to favor
`default-toplevel-value' of `erc-current-message-catalog' before
falling back to `english'. Not doing this was arguably a bug.
(erc-message-english-bad-ping-response,
erc-message-english-bad-syntax, erc-message-english-incorrect-args,
erc-message-english-cannot-find-file,
erc-message-english-cannot-read-file, erc-message-english-connect,
erc-message-english-country, erc-message-english-country-unknown,
erc-message-english-ctcp-empty, erc-message-english-ctcp-request,
erc-message-english-ctcp-request-to,
erc-message-english-ctcp-too-many, erc-message-english-flood-ctcp-off,
erc-message-english-flood-strict-mode,
erc-message-english-disconnected,
erc-message-english-disconnected-noreconnect,
erc-message-english-reconnecting,
erc-message-english-reconnect-canceled, erc-message-english-finished,
erc-message-english-terminated, erc-message-english-login,
erc-message-english-nick-in-use, erc-message-english-nick-too-long,
erc-message-english-no-default-channel,
erc-message-english-no-invitation, erc-message-english-no-target,
erc-message-english-ops, erc-message-english-ops-none,
erc-message-english-undefined-ctcp,
erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop,
erc-message-english-variable-not-bound, erc-message-english-ACTION,
erc-message-english-CTCP-CLIENTINFO, erc-message-english-CTCP-ECHO,
erc-message-english-CTCP-FINGER, erc-message-english-CTCP-PING,
erc-message-english-CTCP-TIME, erc-message-english-CTCP-UNKNOWN,
erc-message-english-CTCP-VERSION, erc-message-english-ERROR,
erc-message-english-INVITE, erc-message-english-JOIN,
erc-message-english-JOIN-you, erc-message-english-KICK,
erc-message-english-KICK-you, erc-message-english-KICK-by-you,
erc-message-english-MODE, erc-message-english-MODE-nick,
erc-message-english-NICK, erc-message-english-NICK-you,
erc-message-english-PART, erc-message-english-PING,
erc-message-english-PONG, erc-message-english-QUIT,
erc-message-english-TOPIC, erc-message-english-WALLOPS,
erc-message-english-s004, erc-message-english-s221,
erc-message-english-s252, erc-message-english-s253,
erc-message-english-s254, erc-message-english-s275,
erc-message-english-s301, erc-message-english-s303,
erc-message-english-s305, erc-message-english-s306,
erc-message-english-s307, erc-message-english-s311,
erc-message-english-s312, erc-message-english-s313,
erc-message-english-s314, erc-message-english-s317,
erc-message-english-s317-on-since, erc-message-english-s319,
erc-message-english-s320, erc-message-english-s321,
erc-message-english-s322, erc-message-english-s324,
erc-message-english-s328, erc-message-english-s329,
erc-message-english-s330, erc-message-english-s331,
erc-message-english-s332, erc-message-english-s333,
erc-message-english-s341, erc-message-english-s352,
erc-message-english-s353, erc-message-english-s367,
erc-message-english-s367-set-by, erc-message-english-s368,
erc-message-english-s379, erc-message-english-s391,
erc-message-english-s396, erc-message-english-s401,
erc-message-english-s402, erc-message-english-s403,
erc-message-english-s404, erc-message-english-s405,
erc-message-english-s406, erc-message-english-s412,
erc-message-english-s421, erc-message-english-s431,
erc-message-english-s432, erc-message-english-s442,
erc-message-english-s445, erc-message-english-s446,
erc-message-english-s451, erc-message-english-s461,
erc-message-english-s462, erc-message-english-s463,
erc-message-english-s464, erc-message-english-s465,
erc-message-english-s471, erc-message-english-s473,
erc-message-english-s474, erc-message-english-s475,
erc-message-english-s481, erc-message-english-s482,
erc-message-english-s483, erc-message-english-s484,
erc-message-english-s485, erc-message-english-s491,
erc-message-english-s501, erc-message-english-s502,
erc-message-english-s671): Define at top level using `defvar'.
* test/lisp/erc/erc-tests.el (erc-tests--string-to-propertized-parts,
erc-tests-pp-propertized-parts, erc--make-message-variable-name,
erc-retrieve-catalog-entry): New tests along with utility functions
and a convenience command for manipulating catalogs. (Bug#67677)
2023-11-28 16:51:36 -08:00
|
|
|
(declare (obsolete "define manually using `defvar' instead" "30.1"))
|
2006-01-29 13:08:58 +00:00
|
|
|
(set (erc-make-message-variable-name catalog entry)
|
|
|
|
format-spec))
|
|
|
|
|
|
|
|
(defun erc-define-catalog (catalog entries)
|
|
|
|
"Define a CATALOG according to ENTRIES."
|
Define ERC message-formatting templates with defvar
* etc/ERC-NEWS: Mention convenience macro being preferred means of
defining message templates. Mention renaming of `notify' formatting
templates.
* lisp/erc/erc-common.el (erc--define-catalog,
erc-define-message-format-catalog): New macro and internal variant to
replace `erc-define-catalog-entry'. The internal variant allows us to
defer reindenting existing definitions until meaningfully edited.
* lisp/erc/erc-dcc.el (erc-message-english-dcc-chat-discarded,
erc-message-english-dcc-chat-ended,
erc-message-english-dcc-chat-no-request,
erc-message-english-dcc-chat-offered,
erc-message-english-dcc-chat-offer,
erc-message-english-dcc-chat-accept,
erc-message-english-dcc-chat-privmsg, erc-message-english-dcc-closed,
erc-message-english-dcc-command-undefined,
erc-message-english-dcc-ctcp-errmsg,
erc-message-english-dcc-ctcp-unknown,
erc-message-english-dcc-get-bytes-received,
erc-message-english-dcc-get-complete,
erc-message-english-dcc-get-failed,
erc-message-english-dcc-get-cmd-aborted,
erc-message-english-dcc-get-file-too-long,
erc-message-english-dcc-get-notfound,
erc-message-english-dcc-list-head, erc-message-english-dcc-list-line,
erc-message-english-dcc-list-item, erc-message-english-dcc-list-end,
erc-message-english-dcc-malformed,
erc-message-english-dcc-privileged-port,
erc-message-english-dcc-request-bogus,
erc-message-english-dcc-send-finished,
erc-message-english-dcc-send-offered,
erc-message-english-dcc-send-offer): Define at top level using
`defvar'.
* lisp/erc/erc-netsplit.el (erc-netsplit-mode, erc-netsplit-enable):
Don't call `erc-netsplit-install-message-catalogs'.
(erc-netsplit-install-message-catalogs): Deprecate function.
(erc-message-english-netsplit, erc-message-english-netjoin,
erc-message-english-netjoin-done, erc-message-english-netsplit-none,
erc-message-english-netsplit-wholeft): Define at top level using
`defvar'.
* lisp/erc/erc-notify.el (erc-notify-install-message-catalogs):
Deprecate, and rename all format templates with hyphens instead of
underscores.
(erc-notify-timer, erc-notify-JOIN, erc-notify-NICK, erc-notify-QUIT):
Use hyphenated template names.
(erc-cmd-NOTIFY): Use hyphenated template names. Load the module when
necessary and emit a warning. Otherwise, people who discover this
autoloaded command without being aware of the module's existence may
think it's "broken".
(pcomplete/erc-mode/NOTIFY): Replace top-level autoload with `require'
in function body. Include `erc-notify-list' in list of completions,
which makes removal easier if you don't share any channels with a
person, and they're not in `erc-server-users'. A better long-term
solution might be to WHOIS folks we're unsure about when they're
listed in a 303.
(erc-message-english-notify_current, erc-message-english-notify_list,
erc-message-english-notify_on, erc-message-english-notify_off): Define
at top level using `defvar'. Replace nonstandard underscores with
hyphens. Alias obsolete names.
* lisp/erc/erc-page.el (erc-message-english-CTCP-PAGE): Define at top
level using `defvar'.
* lisp/erc/erc-sasl.el (erc-message-english-s902,
erc-message-english-s904, erc-message-english-s905,
erc-message-english-s906, erc-message-english-s907,
erc-message-english-s908): Define at top level using `defvar'.
* lisp/erc/erc-sound.el (erc-message-english-CTCP-SOUND): Define using
`defvar'.
* lisp/erc/erc.el (erc--make-message-variable-name): New function to
replace `erc-make-message-variable-name' internally, where most uses
previously checked whether the returned variable was bound. This
helper now does that conditionally, when asked.
(erc-make-message-variable-name): Defer to internal variant,
`erc--make-message-variable-name'.
(erc-define-catalog-entry, erc-define-catalog): Deprecate.
(erc-retrieve-catalog-entry): Refactor to favor
`default-toplevel-value' of `erc-current-message-catalog' before
falling back to `english'. Not doing this was arguably a bug.
(erc-message-english-bad-ping-response,
erc-message-english-bad-syntax, erc-message-english-incorrect-args,
erc-message-english-cannot-find-file,
erc-message-english-cannot-read-file, erc-message-english-connect,
erc-message-english-country, erc-message-english-country-unknown,
erc-message-english-ctcp-empty, erc-message-english-ctcp-request,
erc-message-english-ctcp-request-to,
erc-message-english-ctcp-too-many, erc-message-english-flood-ctcp-off,
erc-message-english-flood-strict-mode,
erc-message-english-disconnected,
erc-message-english-disconnected-noreconnect,
erc-message-english-reconnecting,
erc-message-english-reconnect-canceled, erc-message-english-finished,
erc-message-english-terminated, erc-message-english-login,
erc-message-english-nick-in-use, erc-message-english-nick-too-long,
erc-message-english-no-default-channel,
erc-message-english-no-invitation, erc-message-english-no-target,
erc-message-english-ops, erc-message-english-ops-none,
erc-message-english-undefined-ctcp,
erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop,
erc-message-english-variable-not-bound, erc-message-english-ACTION,
erc-message-english-CTCP-CLIENTINFO, erc-message-english-CTCP-ECHO,
erc-message-english-CTCP-FINGER, erc-message-english-CTCP-PING,
erc-message-english-CTCP-TIME, erc-message-english-CTCP-UNKNOWN,
erc-message-english-CTCP-VERSION, erc-message-english-ERROR,
erc-message-english-INVITE, erc-message-english-JOIN,
erc-message-english-JOIN-you, erc-message-english-KICK,
erc-message-english-KICK-you, erc-message-english-KICK-by-you,
erc-message-english-MODE, erc-message-english-MODE-nick,
erc-message-english-NICK, erc-message-english-NICK-you,
erc-message-english-PART, erc-message-english-PING,
erc-message-english-PONG, erc-message-english-QUIT,
erc-message-english-TOPIC, erc-message-english-WALLOPS,
erc-message-english-s004, erc-message-english-s221,
erc-message-english-s252, erc-message-english-s253,
erc-message-english-s254, erc-message-english-s275,
erc-message-english-s301, erc-message-english-s303,
erc-message-english-s305, erc-message-english-s306,
erc-message-english-s307, erc-message-english-s311,
erc-message-english-s312, erc-message-english-s313,
erc-message-english-s314, erc-message-english-s317,
erc-message-english-s317-on-since, erc-message-english-s319,
erc-message-english-s320, erc-message-english-s321,
erc-message-english-s322, erc-message-english-s324,
erc-message-english-s328, erc-message-english-s329,
erc-message-english-s330, erc-message-english-s331,
erc-message-english-s332, erc-message-english-s333,
erc-message-english-s341, erc-message-english-s352,
erc-message-english-s353, erc-message-english-s367,
erc-message-english-s367-set-by, erc-message-english-s368,
erc-message-english-s379, erc-message-english-s391,
erc-message-english-s396, erc-message-english-s401,
erc-message-english-s402, erc-message-english-s403,
erc-message-english-s404, erc-message-english-s405,
erc-message-english-s406, erc-message-english-s412,
erc-message-english-s421, erc-message-english-s431,
erc-message-english-s432, erc-message-english-s442,
erc-message-english-s445, erc-message-english-s446,
erc-message-english-s451, erc-message-english-s461,
erc-message-english-s462, erc-message-english-s463,
erc-message-english-s464, erc-message-english-s465,
erc-message-english-s471, erc-message-english-s473,
erc-message-english-s474, erc-message-english-s475,
erc-message-english-s481, erc-message-english-s482,
erc-message-english-s483, erc-message-english-s484,
erc-message-english-s485, erc-message-english-s491,
erc-message-english-s501, erc-message-english-s502,
erc-message-english-s671): Define at top level using `defvar'.
* test/lisp/erc/erc-tests.el (erc-tests--string-to-propertized-parts,
erc-tests-pp-propertized-parts, erc--make-message-variable-name,
erc-retrieve-catalog-entry): New tests along with utility functions
and a convenience command for manipulating catalogs. (Bug#67677)
2023-11-28 16:51:36 -08:00
|
|
|
(declare (obsolete erc-define-message-format-catalog "30.1"))
|
|
|
|
(with-suppressed-warnings ((obsolete erc-define-catalog-entry))
|
|
|
|
(dolist (entry entries)
|
|
|
|
(erc-define-catalog-entry catalog (car entry) (cdr entry)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Define ERC message-formatting templates with defvar
* etc/ERC-NEWS: Mention convenience macro being preferred means of
defining message templates. Mention renaming of `notify' formatting
templates.
* lisp/erc/erc-common.el (erc--define-catalog,
erc-define-message-format-catalog): New macro and internal variant to
replace `erc-define-catalog-entry'. The internal variant allows us to
defer reindenting existing definitions until meaningfully edited.
* lisp/erc/erc-dcc.el (erc-message-english-dcc-chat-discarded,
erc-message-english-dcc-chat-ended,
erc-message-english-dcc-chat-no-request,
erc-message-english-dcc-chat-offered,
erc-message-english-dcc-chat-offer,
erc-message-english-dcc-chat-accept,
erc-message-english-dcc-chat-privmsg, erc-message-english-dcc-closed,
erc-message-english-dcc-command-undefined,
erc-message-english-dcc-ctcp-errmsg,
erc-message-english-dcc-ctcp-unknown,
erc-message-english-dcc-get-bytes-received,
erc-message-english-dcc-get-complete,
erc-message-english-dcc-get-failed,
erc-message-english-dcc-get-cmd-aborted,
erc-message-english-dcc-get-file-too-long,
erc-message-english-dcc-get-notfound,
erc-message-english-dcc-list-head, erc-message-english-dcc-list-line,
erc-message-english-dcc-list-item, erc-message-english-dcc-list-end,
erc-message-english-dcc-malformed,
erc-message-english-dcc-privileged-port,
erc-message-english-dcc-request-bogus,
erc-message-english-dcc-send-finished,
erc-message-english-dcc-send-offered,
erc-message-english-dcc-send-offer): Define at top level using
`defvar'.
* lisp/erc/erc-netsplit.el (erc-netsplit-mode, erc-netsplit-enable):
Don't call `erc-netsplit-install-message-catalogs'.
(erc-netsplit-install-message-catalogs): Deprecate function.
(erc-message-english-netsplit, erc-message-english-netjoin,
erc-message-english-netjoin-done, erc-message-english-netsplit-none,
erc-message-english-netsplit-wholeft): Define at top level using
`defvar'.
* lisp/erc/erc-notify.el (erc-notify-install-message-catalogs):
Deprecate, and rename all format templates with hyphens instead of
underscores.
(erc-notify-timer, erc-notify-JOIN, erc-notify-NICK, erc-notify-QUIT):
Use hyphenated template names.
(erc-cmd-NOTIFY): Use hyphenated template names. Load the module when
necessary and emit a warning. Otherwise, people who discover this
autoloaded command without being aware of the module's existence may
think it's "broken".
(pcomplete/erc-mode/NOTIFY): Replace top-level autoload with `require'
in function body. Include `erc-notify-list' in list of completions,
which makes removal easier if you don't share any channels with a
person, and they're not in `erc-server-users'. A better long-term
solution might be to WHOIS folks we're unsure about when they're
listed in a 303.
(erc-message-english-notify_current, erc-message-english-notify_list,
erc-message-english-notify_on, erc-message-english-notify_off): Define
at top level using `defvar'. Replace nonstandard underscores with
hyphens. Alias obsolete names.
* lisp/erc/erc-page.el (erc-message-english-CTCP-PAGE): Define at top
level using `defvar'.
* lisp/erc/erc-sasl.el (erc-message-english-s902,
erc-message-english-s904, erc-message-english-s905,
erc-message-english-s906, erc-message-english-s907,
erc-message-english-s908): Define at top level using `defvar'.
* lisp/erc/erc-sound.el (erc-message-english-CTCP-SOUND): Define using
`defvar'.
* lisp/erc/erc.el (erc--make-message-variable-name): New function to
replace `erc-make-message-variable-name' internally, where most uses
previously checked whether the returned variable was bound. This
helper now does that conditionally, when asked.
(erc-make-message-variable-name): Defer to internal variant,
`erc--make-message-variable-name'.
(erc-define-catalog-entry, erc-define-catalog): Deprecate.
(erc-retrieve-catalog-entry): Refactor to favor
`default-toplevel-value' of `erc-current-message-catalog' before
falling back to `english'. Not doing this was arguably a bug.
(erc-message-english-bad-ping-response,
erc-message-english-bad-syntax, erc-message-english-incorrect-args,
erc-message-english-cannot-find-file,
erc-message-english-cannot-read-file, erc-message-english-connect,
erc-message-english-country, erc-message-english-country-unknown,
erc-message-english-ctcp-empty, erc-message-english-ctcp-request,
erc-message-english-ctcp-request-to,
erc-message-english-ctcp-too-many, erc-message-english-flood-ctcp-off,
erc-message-english-flood-strict-mode,
erc-message-english-disconnected,
erc-message-english-disconnected-noreconnect,
erc-message-english-reconnecting,
erc-message-english-reconnect-canceled, erc-message-english-finished,
erc-message-english-terminated, erc-message-english-login,
erc-message-english-nick-in-use, erc-message-english-nick-too-long,
erc-message-english-no-default-channel,
erc-message-english-no-invitation, erc-message-english-no-target,
erc-message-english-ops, erc-message-english-ops-none,
erc-message-english-undefined-ctcp,
erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop,
erc-message-english-variable-not-bound, erc-message-english-ACTION,
erc-message-english-CTCP-CLIENTINFO, erc-message-english-CTCP-ECHO,
erc-message-english-CTCP-FINGER, erc-message-english-CTCP-PING,
erc-message-english-CTCP-TIME, erc-message-english-CTCP-UNKNOWN,
erc-message-english-CTCP-VERSION, erc-message-english-ERROR,
erc-message-english-INVITE, erc-message-english-JOIN,
erc-message-english-JOIN-you, erc-message-english-KICK,
erc-message-english-KICK-you, erc-message-english-KICK-by-you,
erc-message-english-MODE, erc-message-english-MODE-nick,
erc-message-english-NICK, erc-message-english-NICK-you,
erc-message-english-PART, erc-message-english-PING,
erc-message-english-PONG, erc-message-english-QUIT,
erc-message-english-TOPIC, erc-message-english-WALLOPS,
erc-message-english-s004, erc-message-english-s221,
erc-message-english-s252, erc-message-english-s253,
erc-message-english-s254, erc-message-english-s275,
erc-message-english-s301, erc-message-english-s303,
erc-message-english-s305, erc-message-english-s306,
erc-message-english-s307, erc-message-english-s311,
erc-message-english-s312, erc-message-english-s313,
erc-message-english-s314, erc-message-english-s317,
erc-message-english-s317-on-since, erc-message-english-s319,
erc-message-english-s320, erc-message-english-s321,
erc-message-english-s322, erc-message-english-s324,
erc-message-english-s328, erc-message-english-s329,
erc-message-english-s330, erc-message-english-s331,
erc-message-english-s332, erc-message-english-s333,
erc-message-english-s341, erc-message-english-s352,
erc-message-english-s353, erc-message-english-s367,
erc-message-english-s367-set-by, erc-message-english-s368,
erc-message-english-s379, erc-message-english-s391,
erc-message-english-s396, erc-message-english-s401,
erc-message-english-s402, erc-message-english-s403,
erc-message-english-s404, erc-message-english-s405,
erc-message-english-s406, erc-message-english-s412,
erc-message-english-s421, erc-message-english-s431,
erc-message-english-s432, erc-message-english-s442,
erc-message-english-s445, erc-message-english-s446,
erc-message-english-s451, erc-message-english-s461,
erc-message-english-s462, erc-message-english-s463,
erc-message-english-s464, erc-message-english-s465,
erc-message-english-s471, erc-message-english-s473,
erc-message-english-s474, erc-message-english-s475,
erc-message-english-s481, erc-message-english-s482,
erc-message-english-s483, erc-message-english-s484,
erc-message-english-s485, erc-message-english-s491,
erc-message-english-s501, erc-message-english-s502,
erc-message-english-s671): Define at top level using `defvar'.
* test/lisp/erc/erc-tests.el (erc-tests--string-to-propertized-parts,
erc-tests-pp-propertized-parts, erc--make-message-variable-name,
erc-retrieve-catalog-entry): New tests along with utility functions
and a convenience command for manipulating catalogs. (Bug#67677)
2023-11-28 16:51:36 -08:00
|
|
|
(erc--define-catalog english
|
|
|
|
((bad-ping-response . "Unexpected PING response from %n (time %t)")
|
2006-01-29 13:08:58 +00:00
|
|
|
(bad-syntax . "Error occurred - incorrect usage?\n%c %u\n%d")
|
|
|
|
(incorrect-args . "Incorrect arguments. Usage:\n%c %u\n%d")
|
|
|
|
(cannot-find-file . "Cannot find file %f")
|
|
|
|
(cannot-read-file . "Cannot read file %f")
|
|
|
|
(connect . "Connecting to %S:%p... ")
|
|
|
|
(country . "%c")
|
|
|
|
(country-unknown . "%d: No such domain")
|
|
|
|
(ctcp-empty . "Illegal empty CTCP query received from %n. Ignoring.")
|
|
|
|
(ctcp-request . "==> CTCP request from %n (%u@%h): %r")
|
|
|
|
(ctcp-request-to . "==> CTCP request from %n (%u@%h) to %t: %r")
|
|
|
|
(ctcp-too-many . "Too many CTCP queries in single message. Ignoring")
|
|
|
|
(flood-ctcp-off . "FLOOD PROTECTION: Automatic CTCP responses turned off.")
|
2006-08-07 07:43:48 +00:00
|
|
|
(flood-strict-mode
|
|
|
|
. "FLOOD PROTECTION: Switched to Strict Flood Control mode.")
|
2023-11-08 19:14:55 -08:00
|
|
|
(disconnected
|
|
|
|
. "\n\n*** Connection failed! Re-establishing connection...\n")
|
2006-08-07 07:43:48 +00:00
|
|
|
(disconnected-noreconnect
|
2023-11-08 19:14:55 -08:00
|
|
|
. "\n\n*** Connection failed! Not re-establishing connection.\n")
|
2022-10-27 00:21:10 -07:00
|
|
|
(reconnecting . "Reconnecting in %ms: attempt %i/%n ...")
|
|
|
|
(reconnect-canceled . "Canceled %u reconnect timer with %cs to go...")
|
2006-08-07 07:43:48 +00:00
|
|
|
(finished . "\n\n*** ERC finished ***\n")
|
|
|
|
(terminated . "\n\n*** ERC terminated: %e\n")
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
(login . "Logging in as `%n'...")
|
2006-01-29 13:08:58 +00:00
|
|
|
(nick-in-use . "%n is in use. Choose new nickname: ")
|
2006-08-07 07:43:48 +00:00
|
|
|
(nick-too-long
|
|
|
|
. "WARNING: Nick length (%i) exceeds max NICKLEN(%l) defined by server")
|
2006-01-29 13:08:58 +00:00
|
|
|
(no-default-channel . "No default channel")
|
|
|
|
(no-invitation . "You've got no invitation")
|
|
|
|
(no-target . "No target")
|
|
|
|
(ops . "%i operator%s: %o")
|
|
|
|
(ops-none . "No operators in this channel.")
|
|
|
|
(undefined-ctcp . "Undefined CTCP query received. Silently ignored")
|
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
2023-11-14 21:10:39 -08:00
|
|
|
(user-mode-redundant-add
|
|
|
|
. "Already have user mode(s): %m. Requesting again anyway.")
|
|
|
|
(user-mode-redundant-drop
|
|
|
|
. "Already without user mode(s): %m. Requesting removal anyway.")
|
2006-01-29 13:08:58 +00:00
|
|
|
(variable-not-bound . "Variable not bound!")
|
|
|
|
(ACTION . "* %n %a")
|
|
|
|
(CTCP-CLIENTINFO . "Client info for %n: %m")
|
|
|
|
(CTCP-ECHO . "Echo %n: %m")
|
|
|
|
(CTCP-FINGER . "Finger info for %n: %m")
|
|
|
|
(CTCP-PING . "Ping time to %n is %t")
|
|
|
|
(CTCP-TIME . "Time by %n is %m")
|
|
|
|
(CTCP-UNKNOWN . "Unknown CTCP message from %n (%u@%h): %m")
|
|
|
|
(CTCP-VERSION . "Version for %n is %m")
|
|
|
|
(ERROR . "==> ERROR from %s: %c\n")
|
|
|
|
(INVITE . "%n (%u@%h) invites you to channel %c")
|
|
|
|
(JOIN . "%n (%u@%h) has joined channel %c")
|
|
|
|
(JOIN-you . "You have joined channel %c")
|
|
|
|
(KICK . "%n (%u@%h) has kicked %k off channel %c: %r")
|
|
|
|
(KICK-you . "You have been kicked off channel %c by %n (%u@%h): %r")
|
|
|
|
(KICK-by-you . "You have kicked %k off channel %c: %r")
|
|
|
|
(MODE . "%n (%u@%h) has changed mode for %t to %m")
|
|
|
|
(MODE-nick . "%n has changed mode for %t to %m")
|
|
|
|
(NICK . "%n (%u@%h) is now known as %N")
|
|
|
|
(NICK-you . "Your new nickname is %N")
|
Define ERC message-formatting templates with defvar
* etc/ERC-NEWS: Mention convenience macro being preferred means of
defining message templates. Mention renaming of `notify' formatting
templates.
* lisp/erc/erc-common.el (erc--define-catalog,
erc-define-message-format-catalog): New macro and internal variant to
replace `erc-define-catalog-entry'. The internal variant allows us to
defer reindenting existing definitions until meaningfully edited.
* lisp/erc/erc-dcc.el (erc-message-english-dcc-chat-discarded,
erc-message-english-dcc-chat-ended,
erc-message-english-dcc-chat-no-request,
erc-message-english-dcc-chat-offered,
erc-message-english-dcc-chat-offer,
erc-message-english-dcc-chat-accept,
erc-message-english-dcc-chat-privmsg, erc-message-english-dcc-closed,
erc-message-english-dcc-command-undefined,
erc-message-english-dcc-ctcp-errmsg,
erc-message-english-dcc-ctcp-unknown,
erc-message-english-dcc-get-bytes-received,
erc-message-english-dcc-get-complete,
erc-message-english-dcc-get-failed,
erc-message-english-dcc-get-cmd-aborted,
erc-message-english-dcc-get-file-too-long,
erc-message-english-dcc-get-notfound,
erc-message-english-dcc-list-head, erc-message-english-dcc-list-line,
erc-message-english-dcc-list-item, erc-message-english-dcc-list-end,
erc-message-english-dcc-malformed,
erc-message-english-dcc-privileged-port,
erc-message-english-dcc-request-bogus,
erc-message-english-dcc-send-finished,
erc-message-english-dcc-send-offered,
erc-message-english-dcc-send-offer): Define at top level using
`defvar'.
* lisp/erc/erc-netsplit.el (erc-netsplit-mode, erc-netsplit-enable):
Don't call `erc-netsplit-install-message-catalogs'.
(erc-netsplit-install-message-catalogs): Deprecate function.
(erc-message-english-netsplit, erc-message-english-netjoin,
erc-message-english-netjoin-done, erc-message-english-netsplit-none,
erc-message-english-netsplit-wholeft): Define at top level using
`defvar'.
* lisp/erc/erc-notify.el (erc-notify-install-message-catalogs):
Deprecate, and rename all format templates with hyphens instead of
underscores.
(erc-notify-timer, erc-notify-JOIN, erc-notify-NICK, erc-notify-QUIT):
Use hyphenated template names.
(erc-cmd-NOTIFY): Use hyphenated template names. Load the module when
necessary and emit a warning. Otherwise, people who discover this
autoloaded command without being aware of the module's existence may
think it's "broken".
(pcomplete/erc-mode/NOTIFY): Replace top-level autoload with `require'
in function body. Include `erc-notify-list' in list of completions,
which makes removal easier if you don't share any channels with a
person, and they're not in `erc-server-users'. A better long-term
solution might be to WHOIS folks we're unsure about when they're
listed in a 303.
(erc-message-english-notify_current, erc-message-english-notify_list,
erc-message-english-notify_on, erc-message-english-notify_off): Define
at top level using `defvar'. Replace nonstandard underscores with
hyphens. Alias obsolete names.
* lisp/erc/erc-page.el (erc-message-english-CTCP-PAGE): Define at top
level using `defvar'.
* lisp/erc/erc-sasl.el (erc-message-english-s902,
erc-message-english-s904, erc-message-english-s905,
erc-message-english-s906, erc-message-english-s907,
erc-message-english-s908): Define at top level using `defvar'.
* lisp/erc/erc-sound.el (erc-message-english-CTCP-SOUND): Define using
`defvar'.
* lisp/erc/erc.el (erc--make-message-variable-name): New function to
replace `erc-make-message-variable-name' internally, where most uses
previously checked whether the returned variable was bound. This
helper now does that conditionally, when asked.
(erc-make-message-variable-name): Defer to internal variant,
`erc--make-message-variable-name'.
(erc-define-catalog-entry, erc-define-catalog): Deprecate.
(erc-retrieve-catalog-entry): Refactor to favor
`default-toplevel-value' of `erc-current-message-catalog' before
falling back to `english'. Not doing this was arguably a bug.
(erc-message-english-bad-ping-response,
erc-message-english-bad-syntax, erc-message-english-incorrect-args,
erc-message-english-cannot-find-file,
erc-message-english-cannot-read-file, erc-message-english-connect,
erc-message-english-country, erc-message-english-country-unknown,
erc-message-english-ctcp-empty, erc-message-english-ctcp-request,
erc-message-english-ctcp-request-to,
erc-message-english-ctcp-too-many, erc-message-english-flood-ctcp-off,
erc-message-english-flood-strict-mode,
erc-message-english-disconnected,
erc-message-english-disconnected-noreconnect,
erc-message-english-reconnecting,
erc-message-english-reconnect-canceled, erc-message-english-finished,
erc-message-english-terminated, erc-message-english-login,
erc-message-english-nick-in-use, erc-message-english-nick-too-long,
erc-message-english-no-default-channel,
erc-message-english-no-invitation, erc-message-english-no-target,
erc-message-english-ops, erc-message-english-ops-none,
erc-message-english-undefined-ctcp,
erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop,
erc-message-english-variable-not-bound, erc-message-english-ACTION,
erc-message-english-CTCP-CLIENTINFO, erc-message-english-CTCP-ECHO,
erc-message-english-CTCP-FINGER, erc-message-english-CTCP-PING,
erc-message-english-CTCP-TIME, erc-message-english-CTCP-UNKNOWN,
erc-message-english-CTCP-VERSION, erc-message-english-ERROR,
erc-message-english-INVITE, erc-message-english-JOIN,
erc-message-english-JOIN-you, erc-message-english-KICK,
erc-message-english-KICK-you, erc-message-english-KICK-by-you,
erc-message-english-MODE, erc-message-english-MODE-nick,
erc-message-english-NICK, erc-message-english-NICK-you,
erc-message-english-PART, erc-message-english-PING,
erc-message-english-PONG, erc-message-english-QUIT,
erc-message-english-TOPIC, erc-message-english-WALLOPS,
erc-message-english-s004, erc-message-english-s221,
erc-message-english-s252, erc-message-english-s253,
erc-message-english-s254, erc-message-english-s275,
erc-message-english-s301, erc-message-english-s303,
erc-message-english-s305, erc-message-english-s306,
erc-message-english-s307, erc-message-english-s311,
erc-message-english-s312, erc-message-english-s313,
erc-message-english-s314, erc-message-english-s317,
erc-message-english-s317-on-since, erc-message-english-s319,
erc-message-english-s320, erc-message-english-s321,
erc-message-english-s322, erc-message-english-s324,
erc-message-english-s328, erc-message-english-s329,
erc-message-english-s330, erc-message-english-s331,
erc-message-english-s332, erc-message-english-s333,
erc-message-english-s341, erc-message-english-s352,
erc-message-english-s353, erc-message-english-s367,
erc-message-english-s367-set-by, erc-message-english-s368,
erc-message-english-s379, erc-message-english-s391,
erc-message-english-s396, erc-message-english-s401,
erc-message-english-s402, erc-message-english-s403,
erc-message-english-s404, erc-message-english-s405,
erc-message-english-s406, erc-message-english-s412,
erc-message-english-s421, erc-message-english-s431,
erc-message-english-s432, erc-message-english-s442,
erc-message-english-s445, erc-message-english-s446,
erc-message-english-s451, erc-message-english-s461,
erc-message-english-s462, erc-message-english-s463,
erc-message-english-s464, erc-message-english-s465,
erc-message-english-s471, erc-message-english-s473,
erc-message-english-s474, erc-message-english-s475,
erc-message-english-s481, erc-message-english-s482,
erc-message-english-s483, erc-message-english-s484,
erc-message-english-s485, erc-message-english-s491,
erc-message-english-s501, erc-message-english-s502,
erc-message-english-s671): Define at top level using `defvar'.
* test/lisp/erc/erc-tests.el (erc-tests--string-to-propertized-parts,
erc-tests-pp-propertized-parts, erc--make-message-variable-name,
erc-retrieve-catalog-entry): New tests along with utility functions
and a convenience command for manipulating catalogs. (Bug#67677)
2023-11-28 16:51:36 -08:00
|
|
|
(PART . #'erc-message-english-PART)
|
2006-01-29 13:08:58 +00:00
|
|
|
(PING . "PING from server (last: %s sec. ago)")
|
|
|
|
(PONG . "PONG from %h (%i second%s)")
|
|
|
|
(QUIT . "%n (%u@%h) has quit: %r")
|
|
|
|
(TOPIC . "%n (%u@%h) has set the topic for %c: \"%T\"")
|
|
|
|
(WALLOPS . "Wallops from %n: %m")
|
|
|
|
(s004 . "%s %v %U %C")
|
|
|
|
(s221 . "User modes for %n: %m")
|
|
|
|
(s252 . "%i operator(s) online")
|
|
|
|
(s253 . "%i unknown connection(s)")
|
|
|
|
(s254 . "%i channels formed")
|
2007-12-09 06:40:47 +00:00
|
|
|
(s275 . "%n %m")
|
2006-01-29 13:08:58 +00:00
|
|
|
(s301 . "%n is AWAY: %r")
|
|
|
|
(s303 . "Is online: %n")
|
|
|
|
(s305 . "%m")
|
|
|
|
(s306 . "%m")
|
2007-11-29 22:36:38 +00:00
|
|
|
(s307 . "%n %m")
|
2006-01-29 13:08:58 +00:00
|
|
|
(s311 . "%n is %f (%u@%h)")
|
|
|
|
(s312 . "%n is/was on server %s (%c)")
|
|
|
|
(s313 . "%n is an IRC operator")
|
|
|
|
(s314 . "%n was %f (%u@%h)")
|
|
|
|
(s317 . "%n has been idle for %i")
|
|
|
|
(s317-on-since . "%n has been idle for %i, on since %t")
|
|
|
|
(s319 . "%n is on channel(s): %c")
|
|
|
|
(s320 . "%n is an identified user")
|
|
|
|
(s321 . "Channel Users Topic")
|
|
|
|
(s322 . "%c [%u] %t")
|
|
|
|
(s324 . "%c modes: %m")
|
2008-06-19 04:59:11 +00:00
|
|
|
(s328 . "%c URL: %u")
|
2006-01-29 13:08:58 +00:00
|
|
|
(s329 . "%c was created on %t")
|
|
|
|
(s330 . "%n %a %i")
|
|
|
|
(s331 . "No topic is set for %c")
|
|
|
|
(s332 . "Topic for %c: %T")
|
|
|
|
(s333 . "%c: topic set by %n, %t")
|
|
|
|
(s341 . "Inviting %n to channel %c")
|
|
|
|
(s352 . "%-11c %-10n %-4a %u@%h (%f)")
|
|
|
|
(s353 . "Users on %c: %u")
|
2006-11-20 06:50:29 +00:00
|
|
|
(s367 . "Ban for %b on %c")
|
|
|
|
(s367-set-by . "Ban for %b on %c set by %s on %t")
|
2006-01-29 13:08:58 +00:00
|
|
|
(s368 . "Banlist of %c ends.")
|
|
|
|
(s379 . "%c: Forwarded to %f")
|
|
|
|
(s391 . "The time at %s is %t")
|
2023-08-18 18:04:22 -07:00
|
|
|
(s396 . "Your visible host has changed to %s")
|
2006-01-29 13:08:58 +00:00
|
|
|
(s401 . "%n: No such nick/channel")
|
2023-03-11 09:25:24 -08:00
|
|
|
(s402 . "%c: No such server")
|
2006-01-29 13:08:58 +00:00
|
|
|
(s403 . "%c: No such channel")
|
|
|
|
(s404 . "%c: Cannot send to channel")
|
|
|
|
(s405 . "%c: You have joined too many channels")
|
|
|
|
(s406 . "%n: There was no such nickname")
|
|
|
|
(s412 . "No text to send")
|
|
|
|
(s421 . "%c: Unknown command")
|
|
|
|
(s431 . "No nickname given")
|
|
|
|
(s432 . "%n is an erroneous nickname")
|
|
|
|
(s442 . "%c: You're not on that channel")
|
|
|
|
(s445 . "SUMMON has been disabled")
|
|
|
|
(s446 . "USERS has been disabled")
|
|
|
|
(s451 . "You have not registered")
|
|
|
|
(s461 . "%c: not enough parameters")
|
|
|
|
(s462 . "Unauthorized command (already registered)")
|
|
|
|
(s463 . "Your host isn't among the privileged")
|
|
|
|
(s464 . "Password incorrect")
|
|
|
|
(s465 . "You are banned from this server")
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(s471 . "Max occupancy for channel %c exceeded: %s")
|
|
|
|
(s473 . "Channel %c is invitation only")
|
2006-01-29 13:08:58 +00:00
|
|
|
(s474 . "You can't join %c because you're banned (+b)")
|
|
|
|
(s475 . "You must specify the correct channel key (+k) to join %c")
|
|
|
|
(s481 . "Permission Denied - You're not an IRC operator")
|
|
|
|
(s482 . "You need to be a channel operator of %c to do that")
|
|
|
|
(s483 . "You can't kill a server!")
|
|
|
|
(s484 . "Your connection is restricted!")
|
|
|
|
(s485 . "You're not the original channel operator")
|
|
|
|
(s491 . "No O-lines for your host")
|
|
|
|
(s501 . "Unknown MODE flag")
|
2011-05-03 10:37:51 +02:00
|
|
|
(s502 . "You can't change modes for other users")
|
|
|
|
(s671 . "%n %a")))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-message-english-PART (&rest args)
|
|
|
|
"Format a proper PART message.
|
|
|
|
|
|
|
|
This function is an example on what could be done with formatting
|
|
|
|
functions."
|
|
|
|
(let ((nick (cadr (memq ?n args)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(user (cadr (memq ?u args)))
|
|
|
|
(host (cadr (memq ?h args)))
|
|
|
|
(channel (cadr (memq ?c args)))
|
|
|
|
(reason (cadr (memq ?r args))))
|
2006-01-29 13:08:58 +00:00
|
|
|
(if (string= nick (erc-current-nick))
|
2014-11-08 20:51:43 -05:00
|
|
|
(format "You have left channel %s" channel)
|
2006-01-29 13:08:58 +00:00
|
|
|
(format "%s (%s@%s) has left channel %s%s"
|
2014-11-08 20:51:43 -05:00
|
|
|
nick user host channel
|
|
|
|
(if (not (string= reason ""))
|
|
|
|
(format ": %s"
|
2022-07-08 04:58:26 -07:00
|
|
|
(string-replace "%" "%%" reason))
|
2014-11-08 20:51:43 -05:00
|
|
|
"")))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
|
Prefer defvar-local in erc
* lisp/erc/erc-backend.el (erc-server-current-nick)
(erc-server-process, erc-session-server, erc-session-connector)
(erc-session-port, erc-server-announced-name)
(erc-server-version, erc-server-parameters)
(erc-server-connected, erc-server-reconnect-count)
(erc-server-quitting, erc-server-reconnecting)
(erc-server-timed-out, erc-server-banned)
(erc-server-error-occurred, erc-server-lines-sent)
(erc-server-last-peers, erc-server-last-sent-time)
(erc-server-last-ping-time, erc-server-last-received-time)
(erc-server-lag, erc-server-filter-data, erc-server-duplicates)
(erc-server-processing-p, erc-server-flood-last-message)
(erc-server-flood-queue, erc-server-flood-timer)
(erc-server-ping-handler):
* lisp/erc/erc-capab.el (erc-capab-identify-activated)
(erc-capab-identify-sent):
* lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data)
(erc-dcc-file-name):
* lisp/erc/erc-ezbounce.el (erc-ezb-session-list):
* lisp/erc/erc-join.el (erc--autojoin-timer):
* lisp/erc/erc-netsplit.el (erc-netsplit-list):
* lisp/erc/erc-networks.el (erc-network):
* lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time):
* lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index):
* lisp/erc/erc-stamp.el (erc-timestamp-last-inserted)
(erc-timestamp-last-inserted-left)
(erc-timestamp-last-inserted-right):
* lisp/erc/erc.el (erc-session-password, erc-channel-users)
(erc-server-users, erc-channel-topic, erc-channel-modes)
(erc-insert-marker, erc-input-marker, erc-last-saved-position)
(erc-dbuf, erc-active-buffer, erc-default-recipients)
(erc-session-user-full-name, erc-channel-user-limit)
(erc-channel-key, erc-invitation, erc-channel-list)
(erc-bad-nick, erc-logged-in, erc-default-nicks)
(erc-nick-change-attempt-count, erc-send-input-line-function)
(erc-channel-new-member-names, erc-channel-banlist)
(erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
|
|
|
(defvar-local erc-current-message-catalog 'english)
|
2006-01-29 13:08:58 +00:00
|
|
|
|
Define ERC message-formatting templates with defvar
* etc/ERC-NEWS: Mention convenience macro being preferred means of
defining message templates. Mention renaming of `notify' formatting
templates.
* lisp/erc/erc-common.el (erc--define-catalog,
erc-define-message-format-catalog): New macro and internal variant to
replace `erc-define-catalog-entry'. The internal variant allows us to
defer reindenting existing definitions until meaningfully edited.
* lisp/erc/erc-dcc.el (erc-message-english-dcc-chat-discarded,
erc-message-english-dcc-chat-ended,
erc-message-english-dcc-chat-no-request,
erc-message-english-dcc-chat-offered,
erc-message-english-dcc-chat-offer,
erc-message-english-dcc-chat-accept,
erc-message-english-dcc-chat-privmsg, erc-message-english-dcc-closed,
erc-message-english-dcc-command-undefined,
erc-message-english-dcc-ctcp-errmsg,
erc-message-english-dcc-ctcp-unknown,
erc-message-english-dcc-get-bytes-received,
erc-message-english-dcc-get-complete,
erc-message-english-dcc-get-failed,
erc-message-english-dcc-get-cmd-aborted,
erc-message-english-dcc-get-file-too-long,
erc-message-english-dcc-get-notfound,
erc-message-english-dcc-list-head, erc-message-english-dcc-list-line,
erc-message-english-dcc-list-item, erc-message-english-dcc-list-end,
erc-message-english-dcc-malformed,
erc-message-english-dcc-privileged-port,
erc-message-english-dcc-request-bogus,
erc-message-english-dcc-send-finished,
erc-message-english-dcc-send-offered,
erc-message-english-dcc-send-offer): Define at top level using
`defvar'.
* lisp/erc/erc-netsplit.el (erc-netsplit-mode, erc-netsplit-enable):
Don't call `erc-netsplit-install-message-catalogs'.
(erc-netsplit-install-message-catalogs): Deprecate function.
(erc-message-english-netsplit, erc-message-english-netjoin,
erc-message-english-netjoin-done, erc-message-english-netsplit-none,
erc-message-english-netsplit-wholeft): Define at top level using
`defvar'.
* lisp/erc/erc-notify.el (erc-notify-install-message-catalogs):
Deprecate, and rename all format templates with hyphens instead of
underscores.
(erc-notify-timer, erc-notify-JOIN, erc-notify-NICK, erc-notify-QUIT):
Use hyphenated template names.
(erc-cmd-NOTIFY): Use hyphenated template names. Load the module when
necessary and emit a warning. Otherwise, people who discover this
autoloaded command without being aware of the module's existence may
think it's "broken".
(pcomplete/erc-mode/NOTIFY): Replace top-level autoload with `require'
in function body. Include `erc-notify-list' in list of completions,
which makes removal easier if you don't share any channels with a
person, and they're not in `erc-server-users'. A better long-term
solution might be to WHOIS folks we're unsure about when they're
listed in a 303.
(erc-message-english-notify_current, erc-message-english-notify_list,
erc-message-english-notify_on, erc-message-english-notify_off): Define
at top level using `defvar'. Replace nonstandard underscores with
hyphens. Alias obsolete names.
* lisp/erc/erc-page.el (erc-message-english-CTCP-PAGE): Define at top
level using `defvar'.
* lisp/erc/erc-sasl.el (erc-message-english-s902,
erc-message-english-s904, erc-message-english-s905,
erc-message-english-s906, erc-message-english-s907,
erc-message-english-s908): Define at top level using `defvar'.
* lisp/erc/erc-sound.el (erc-message-english-CTCP-SOUND): Define using
`defvar'.
* lisp/erc/erc.el (erc--make-message-variable-name): New function to
replace `erc-make-message-variable-name' internally, where most uses
previously checked whether the returned variable was bound. This
helper now does that conditionally, when asked.
(erc-make-message-variable-name): Defer to internal variant,
`erc--make-message-variable-name'.
(erc-define-catalog-entry, erc-define-catalog): Deprecate.
(erc-retrieve-catalog-entry): Refactor to favor
`default-toplevel-value' of `erc-current-message-catalog' before
falling back to `english'. Not doing this was arguably a bug.
(erc-message-english-bad-ping-response,
erc-message-english-bad-syntax, erc-message-english-incorrect-args,
erc-message-english-cannot-find-file,
erc-message-english-cannot-read-file, erc-message-english-connect,
erc-message-english-country, erc-message-english-country-unknown,
erc-message-english-ctcp-empty, erc-message-english-ctcp-request,
erc-message-english-ctcp-request-to,
erc-message-english-ctcp-too-many, erc-message-english-flood-ctcp-off,
erc-message-english-flood-strict-mode,
erc-message-english-disconnected,
erc-message-english-disconnected-noreconnect,
erc-message-english-reconnecting,
erc-message-english-reconnect-canceled, erc-message-english-finished,
erc-message-english-terminated, erc-message-english-login,
erc-message-english-nick-in-use, erc-message-english-nick-too-long,
erc-message-english-no-default-channel,
erc-message-english-no-invitation, erc-message-english-no-target,
erc-message-english-ops, erc-message-english-ops-none,
erc-message-english-undefined-ctcp,
erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop,
erc-message-english-variable-not-bound, erc-message-english-ACTION,
erc-message-english-CTCP-CLIENTINFO, erc-message-english-CTCP-ECHO,
erc-message-english-CTCP-FINGER, erc-message-english-CTCP-PING,
erc-message-english-CTCP-TIME, erc-message-english-CTCP-UNKNOWN,
erc-message-english-CTCP-VERSION, erc-message-english-ERROR,
erc-message-english-INVITE, erc-message-english-JOIN,
erc-message-english-JOIN-you, erc-message-english-KICK,
erc-message-english-KICK-you, erc-message-english-KICK-by-you,
erc-message-english-MODE, erc-message-english-MODE-nick,
erc-message-english-NICK, erc-message-english-NICK-you,
erc-message-english-PART, erc-message-english-PING,
erc-message-english-PONG, erc-message-english-QUIT,
erc-message-english-TOPIC, erc-message-english-WALLOPS,
erc-message-english-s004, erc-message-english-s221,
erc-message-english-s252, erc-message-english-s253,
erc-message-english-s254, erc-message-english-s275,
erc-message-english-s301, erc-message-english-s303,
erc-message-english-s305, erc-message-english-s306,
erc-message-english-s307, erc-message-english-s311,
erc-message-english-s312, erc-message-english-s313,
erc-message-english-s314, erc-message-english-s317,
erc-message-english-s317-on-since, erc-message-english-s319,
erc-message-english-s320, erc-message-english-s321,
erc-message-english-s322, erc-message-english-s324,
erc-message-english-s328, erc-message-english-s329,
erc-message-english-s330, erc-message-english-s331,
erc-message-english-s332, erc-message-english-s333,
erc-message-english-s341, erc-message-english-s352,
erc-message-english-s353, erc-message-english-s367,
erc-message-english-s367-set-by, erc-message-english-s368,
erc-message-english-s379, erc-message-english-s391,
erc-message-english-s396, erc-message-english-s401,
erc-message-english-s402, erc-message-english-s403,
erc-message-english-s404, erc-message-english-s405,
erc-message-english-s406, erc-message-english-s412,
erc-message-english-s421, erc-message-english-s431,
erc-message-english-s432, erc-message-english-s442,
erc-message-english-s445, erc-message-english-s446,
erc-message-english-s451, erc-message-english-s461,
erc-message-english-s462, erc-message-english-s463,
erc-message-english-s464, erc-message-english-s465,
erc-message-english-s471, erc-message-english-s473,
erc-message-english-s474, erc-message-english-s475,
erc-message-english-s481, erc-message-english-s482,
erc-message-english-s483, erc-message-english-s484,
erc-message-english-s485, erc-message-english-s491,
erc-message-english-s501, erc-message-english-s502,
erc-message-english-s671): Define at top level using `defvar'.
* test/lisp/erc/erc-tests.el (erc-tests--string-to-propertized-parts,
erc-tests-pp-propertized-parts, erc--make-message-variable-name,
erc-retrieve-catalog-entry): New tests along with utility functions
and a convenience command for manipulating catalogs. (Bug#67677)
2023-11-28 16:51:36 -08:00
|
|
|
(defun erc-retrieve-catalog-entry (key &optional catalog)
|
|
|
|
"Retrieve `format-spec' entry for symbol KEY in CATALOG.
|
|
|
|
Without symbol CATALOG, use `erc-current-message-catalog'. If
|
|
|
|
lookup fails, try the latter's `default-toplevel-value' if it's
|
|
|
|
not the same as CATALOG. Failing that, try the `english' catalog
|
|
|
|
if yet untried."
|
2006-01-29 13:08:58 +00:00
|
|
|
(unless catalog (setq catalog erc-current-message-catalog))
|
Define ERC message-formatting templates with defvar
* etc/ERC-NEWS: Mention convenience macro being preferred means of
defining message templates. Mention renaming of `notify' formatting
templates.
* lisp/erc/erc-common.el (erc--define-catalog,
erc-define-message-format-catalog): New macro and internal variant to
replace `erc-define-catalog-entry'. The internal variant allows us to
defer reindenting existing definitions until meaningfully edited.
* lisp/erc/erc-dcc.el (erc-message-english-dcc-chat-discarded,
erc-message-english-dcc-chat-ended,
erc-message-english-dcc-chat-no-request,
erc-message-english-dcc-chat-offered,
erc-message-english-dcc-chat-offer,
erc-message-english-dcc-chat-accept,
erc-message-english-dcc-chat-privmsg, erc-message-english-dcc-closed,
erc-message-english-dcc-command-undefined,
erc-message-english-dcc-ctcp-errmsg,
erc-message-english-dcc-ctcp-unknown,
erc-message-english-dcc-get-bytes-received,
erc-message-english-dcc-get-complete,
erc-message-english-dcc-get-failed,
erc-message-english-dcc-get-cmd-aborted,
erc-message-english-dcc-get-file-too-long,
erc-message-english-dcc-get-notfound,
erc-message-english-dcc-list-head, erc-message-english-dcc-list-line,
erc-message-english-dcc-list-item, erc-message-english-dcc-list-end,
erc-message-english-dcc-malformed,
erc-message-english-dcc-privileged-port,
erc-message-english-dcc-request-bogus,
erc-message-english-dcc-send-finished,
erc-message-english-dcc-send-offered,
erc-message-english-dcc-send-offer): Define at top level using
`defvar'.
* lisp/erc/erc-netsplit.el (erc-netsplit-mode, erc-netsplit-enable):
Don't call `erc-netsplit-install-message-catalogs'.
(erc-netsplit-install-message-catalogs): Deprecate function.
(erc-message-english-netsplit, erc-message-english-netjoin,
erc-message-english-netjoin-done, erc-message-english-netsplit-none,
erc-message-english-netsplit-wholeft): Define at top level using
`defvar'.
* lisp/erc/erc-notify.el (erc-notify-install-message-catalogs):
Deprecate, and rename all format templates with hyphens instead of
underscores.
(erc-notify-timer, erc-notify-JOIN, erc-notify-NICK, erc-notify-QUIT):
Use hyphenated template names.
(erc-cmd-NOTIFY): Use hyphenated template names. Load the module when
necessary and emit a warning. Otherwise, people who discover this
autoloaded command without being aware of the module's existence may
think it's "broken".
(pcomplete/erc-mode/NOTIFY): Replace top-level autoload with `require'
in function body. Include `erc-notify-list' in list of completions,
which makes removal easier if you don't share any channels with a
person, and they're not in `erc-server-users'. A better long-term
solution might be to WHOIS folks we're unsure about when they're
listed in a 303.
(erc-message-english-notify_current, erc-message-english-notify_list,
erc-message-english-notify_on, erc-message-english-notify_off): Define
at top level using `defvar'. Replace nonstandard underscores with
hyphens. Alias obsolete names.
* lisp/erc/erc-page.el (erc-message-english-CTCP-PAGE): Define at top
level using `defvar'.
* lisp/erc/erc-sasl.el (erc-message-english-s902,
erc-message-english-s904, erc-message-english-s905,
erc-message-english-s906, erc-message-english-s907,
erc-message-english-s908): Define at top level using `defvar'.
* lisp/erc/erc-sound.el (erc-message-english-CTCP-SOUND): Define using
`defvar'.
* lisp/erc/erc.el (erc--make-message-variable-name): New function to
replace `erc-make-message-variable-name' internally, where most uses
previously checked whether the returned variable was bound. This
helper now does that conditionally, when asked.
(erc-make-message-variable-name): Defer to internal variant,
`erc--make-message-variable-name'.
(erc-define-catalog-entry, erc-define-catalog): Deprecate.
(erc-retrieve-catalog-entry): Refactor to favor
`default-toplevel-value' of `erc-current-message-catalog' before
falling back to `english'. Not doing this was arguably a bug.
(erc-message-english-bad-ping-response,
erc-message-english-bad-syntax, erc-message-english-incorrect-args,
erc-message-english-cannot-find-file,
erc-message-english-cannot-read-file, erc-message-english-connect,
erc-message-english-country, erc-message-english-country-unknown,
erc-message-english-ctcp-empty, erc-message-english-ctcp-request,
erc-message-english-ctcp-request-to,
erc-message-english-ctcp-too-many, erc-message-english-flood-ctcp-off,
erc-message-english-flood-strict-mode,
erc-message-english-disconnected,
erc-message-english-disconnected-noreconnect,
erc-message-english-reconnecting,
erc-message-english-reconnect-canceled, erc-message-english-finished,
erc-message-english-terminated, erc-message-english-login,
erc-message-english-nick-in-use, erc-message-english-nick-too-long,
erc-message-english-no-default-channel,
erc-message-english-no-invitation, erc-message-english-no-target,
erc-message-english-ops, erc-message-english-ops-none,
erc-message-english-undefined-ctcp,
erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop,
erc-message-english-variable-not-bound, erc-message-english-ACTION,
erc-message-english-CTCP-CLIENTINFO, erc-message-english-CTCP-ECHO,
erc-message-english-CTCP-FINGER, erc-message-english-CTCP-PING,
erc-message-english-CTCP-TIME, erc-message-english-CTCP-UNKNOWN,
erc-message-english-CTCP-VERSION, erc-message-english-ERROR,
erc-message-english-INVITE, erc-message-english-JOIN,
erc-message-english-JOIN-you, erc-message-english-KICK,
erc-message-english-KICK-you, erc-message-english-KICK-by-you,
erc-message-english-MODE, erc-message-english-MODE-nick,
erc-message-english-NICK, erc-message-english-NICK-you,
erc-message-english-PART, erc-message-english-PING,
erc-message-english-PONG, erc-message-english-QUIT,
erc-message-english-TOPIC, erc-message-english-WALLOPS,
erc-message-english-s004, erc-message-english-s221,
erc-message-english-s252, erc-message-english-s253,
erc-message-english-s254, erc-message-english-s275,
erc-message-english-s301, erc-message-english-s303,
erc-message-english-s305, erc-message-english-s306,
erc-message-english-s307, erc-message-english-s311,
erc-message-english-s312, erc-message-english-s313,
erc-message-english-s314, erc-message-english-s317,
erc-message-english-s317-on-since, erc-message-english-s319,
erc-message-english-s320, erc-message-english-s321,
erc-message-english-s322, erc-message-english-s324,
erc-message-english-s328, erc-message-english-s329,
erc-message-english-s330, erc-message-english-s331,
erc-message-english-s332, erc-message-english-s333,
erc-message-english-s341, erc-message-english-s352,
erc-message-english-s353, erc-message-english-s367,
erc-message-english-s367-set-by, erc-message-english-s368,
erc-message-english-s379, erc-message-english-s391,
erc-message-english-s396, erc-message-english-s401,
erc-message-english-s402, erc-message-english-s403,
erc-message-english-s404, erc-message-english-s405,
erc-message-english-s406, erc-message-english-s412,
erc-message-english-s421, erc-message-english-s431,
erc-message-english-s432, erc-message-english-s442,
erc-message-english-s445, erc-message-english-s446,
erc-message-english-s451, erc-message-english-s461,
erc-message-english-s462, erc-message-english-s463,
erc-message-english-s464, erc-message-english-s465,
erc-message-english-s471, erc-message-english-s473,
erc-message-english-s474, erc-message-english-s475,
erc-message-english-s481, erc-message-english-s482,
erc-message-english-s483, erc-message-english-s484,
erc-message-english-s485, erc-message-english-s491,
erc-message-english-s501, erc-message-english-s502,
erc-message-english-s671): Define at top level using `defvar'.
* test/lisp/erc/erc-tests.el (erc-tests--string-to-propertized-parts,
erc-tests-pp-propertized-parts, erc--make-message-variable-name,
erc-retrieve-catalog-entry): New tests along with utility functions
and a convenience command for manipulating catalogs. (Bug#67677)
2023-11-28 16:51:36 -08:00
|
|
|
(symbol-value
|
|
|
|
(or (erc--make-message-variable-name catalog key 'softp)
|
|
|
|
(let ((default (default-toplevel-value 'erc-current-message-catalog)))
|
|
|
|
(or (and (not (eq default catalog))
|
|
|
|
(erc--make-message-variable-name default key 'softp))
|
|
|
|
(and (not (memq 'english (list default catalog)))
|
|
|
|
(erc--make-message-variable-name 'english key 'softp)))))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
(defun erc-format-message (msg &rest args)
|
|
|
|
"Format MSG according to ARGS.
|
|
|
|
|
|
|
|
See also `format-spec'."
|
2014-11-08 20:51:43 -05:00
|
|
|
(when (eq (logand (length args) 1) 1) ; oddp
|
2006-01-29 13:08:58 +00:00
|
|
|
(error "Obscure usage of this function appeared"))
|
|
|
|
(let ((entry (erc-retrieve-catalog-entry msg)))
|
|
|
|
(when (not entry)
|
|
|
|
(error "No format spec for message %s" msg))
|
|
|
|
(when (functionp entry)
|
|
|
|
(setq entry (apply entry args)))
|
2022-10-07 21:55:30 -07:00
|
|
|
(format-spec entry (apply #'format-spec-make args) 'ignore)))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
;;; Various hook functions
|
|
|
|
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(defcustom erc-kill-server-hook '(erc-kill-server
|
|
|
|
erc-networks-shrink-ids-and-buffer-names)
|
|
|
|
"Invoked whenever a live server buffer is killed via `kill-buffer'."
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:package-version '(ERC . "5.5")
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(defcustom erc-kill-channel-hook
|
|
|
|
'(erc-kill-channel
|
|
|
|
erc-networks-shrink-ids-and-buffer-names
|
|
|
|
erc-networks-rename-surviving-target-buffer)
|
2012-04-09 21:05:48 +08:00
|
|
|
"Invoked whenever a channel-buffer is killed via `kill-buffer'."
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:package-version '(ERC . "5.5")
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
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.
2021-05-03 05:54:56 -07:00
|
|
|
(defcustom erc-kill-buffer-hook
|
|
|
|
'(erc-networks-shrink-ids-and-buffer-names
|
|
|
|
erc-networks-rename-surviving-target-buffer)
|
|
|
|
"Hook run whenever a query buffer is killed.
|
2006-01-29 13:08:58 +00:00
|
|
|
|
|
|
|
See also `kill-buffer'."
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:package-version '(ERC . "5.5")
|
2006-01-29 13:08:58 +00:00
|
|
|
:group 'erc-hooks
|
|
|
|
:type 'hook)
|
|
|
|
|
2023-10-15 13:20:07 -07:00
|
|
|
;; FIXME alias and deprecate current *-function suffixed name.
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-kill-buffer-function ()
|
|
|
|
"Function to call when an ERC buffer is killed.
|
|
|
|
This function should be on `kill-buffer-hook'.
|
|
|
|
When the current buffer is in `erc-mode', this function will run
|
|
|
|
one of the following hooks:
|
|
|
|
`erc-kill-server-hook' if the server buffer was killed,
|
|
|
|
`erc-kill-channel-hook' if a channel buffer was killed,
|
|
|
|
or `erc-kill-buffer-hook' if any other buffer."
|
|
|
|
(when (eq major-mode 'erc-mode)
|
|
|
|
(erc-remove-channel-users)
|
|
|
|
(cond
|
|
|
|
((eq (erc-server-buffer) (current-buffer))
|
|
|
|
(run-hooks 'erc-kill-server-hook))
|
2023-10-15 13:20:07 -07:00
|
|
|
((erc--target-channel-p erc--target)
|
2006-01-29 13:08:58 +00:00
|
|
|
(run-hooks 'erc-kill-channel-hook))
|
|
|
|
(t
|
|
|
|
(run-hooks 'erc-kill-buffer-hook)))))
|
|
|
|
|
2023-09-11 09:32:44 +08:00
|
|
|
(declare-function set-text-conversion-style "textconv.c")
|
|
|
|
|
|
|
|
(defun erc-check-text-conversion ()
|
|
|
|
"Check if point is within the ERC prompt and toggle text conversion.
|
|
|
|
If `text-conversion-style' is not `action' if point is within the
|
|
|
|
prompt or `nil' otherwise, set it to such a value, so as to
|
|
|
|
guarantee that the input method functions properly for the
|
|
|
|
purpose of typing within the ERC prompt."
|
|
|
|
(when (and (eq major-mode 'erc-mode)
|
2023-09-10 20:44:49 -07:00
|
|
|
(fboundp 'set-text-conversion-style))
|
2023-09-11 09:32:44 +08:00
|
|
|
(if (>= (point) (erc-beg-of-input-line))
|
|
|
|
(unless (eq text-conversion-style 'action)
|
|
|
|
(set-text-conversion-style 'action))
|
|
|
|
(unless (not text-conversion-style)
|
|
|
|
(set-text-conversion-style nil)))))
|
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(defun erc-kill-server ()
|
|
|
|
"Sends a QUIT command to the server when the server buffer is killed.
|
|
|
|
This function should be on `erc-kill-server-hook'."
|
|
|
|
(when (erc-server-process-alive)
|
|
|
|
(setq erc-server-quitting t)
|
|
|
|
(erc-server-send (format "QUIT :%s" (funcall erc-quit-reason nil)))))
|
|
|
|
|
|
|
|
(defun erc-kill-channel ()
|
|
|
|
"Sends a PART command to the server when the channel buffer is killed.
|
|
|
|
This function should be on `erc-kill-channel-hook'."
|
|
|
|
(when (erc-server-process-alive)
|
|
|
|
(let ((tgt (erc-default-target)))
|
2017-04-17 20:30:40 -04:00
|
|
|
(if tgt
|
|
|
|
(erc-server-send (format "PART %s :%s" tgt
|
|
|
|
(funcall erc-part-reason nil))
|
|
|
|
nil tgt)))))
|
2006-01-29 13:08:58 +00:00
|
|
|
|
2006-02-12 12:02:53 +00:00
|
|
|
;;; Dealing with `erc-parsed'
|
|
|
|
|
2007-01-17 18:17:25 +00:00
|
|
|
(defun erc-find-parsed-property ()
|
|
|
|
"Find the next occurrence of the `erc-parsed' text property."
|
|
|
|
(text-property-not-all (point-min) (point-max) 'erc-parsed nil))
|
|
|
|
|
2007-04-01 13:36:38 +00:00
|
|
|
(defun erc-restore-text-properties ()
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
"Ensure the `erc-parsed' and `tags' props cover the entire message."
|
|
|
|
(when-let ((parsed-posn (erc-find-parsed-property))
|
2022-06-16 01:20:49 -07:00
|
|
|
(found (erc-get-parsed-vector parsed-posn)))
|
|
|
|
(put-text-property (point-min) (point-max) 'erc-parsed found)
|
|
|
|
(when-let ((tags (get-text-property parsed-posn 'tags)))
|
|
|
|
(put-text-property (point-min) (point-max) 'tags tags))))
|
2007-04-01 13:36:38 +00:00
|
|
|
|
2006-02-12 12:02:53 +00:00
|
|
|
(defun erc-get-parsed-vector (point)
|
|
|
|
"Return the whole parsed vector on POINT."
|
|
|
|
(get-text-property point 'erc-parsed))
|
|
|
|
|
|
|
|
(defun erc-get-parsed-vector-nick (vect)
|
|
|
|
"Return nickname in the parsed vector VECT."
|
|
|
|
(let* ((untreated-nick (and vect (erc-response.sender vect)))
|
2014-11-08 20:51:43 -05:00
|
|
|
(maybe-nick (when untreated-nick
|
|
|
|
(car (split-string untreated-nick "!")))))
|
2006-02-12 12:02:53 +00:00
|
|
|
(when (and (not (null maybe-nick))
|
2014-11-08 20:51:43 -05:00
|
|
|
(erc-is-valid-nick-p maybe-nick))
|
2006-02-12 12:02:53 +00:00
|
|
|
untreated-nick)))
|
|
|
|
|
|
|
|
(defun erc-get-parsed-vector-type (vect)
|
|
|
|
"Return message type in the parsed vector VECT."
|
|
|
|
(and vect
|
|
|
|
(erc-response.command vect)))
|
|
|
|
|
2022-06-16 01:20:49 -07:00
|
|
|
(defun erc--get-eq-comparable-cmd (command)
|
|
|
|
"Return a symbol or a fixnum representing a message's COMMAND.
|
|
|
|
See also `erc-message-type'."
|
|
|
|
;; IRC numerics are three-digit numbers, possibly with leading 0s.
|
|
|
|
;; To invert: (if (numberp o) (format "%03d" o) (symbol-name o))
|
Manage some text props for ERC insertion-hook members
* etc/ERC-NEWS: Mention that ERC only adds the text property
`cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also
mention that date stamps are now inserted as separate messages.
* lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd'
instead of `erc-command' and use helper utility to do so.
(erc-fill-static): Skip date stamps because this fill style leaves
them flush left.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Don't hook on the soon-to-be-removed function interface
`erc-stamp--insert-date-function' because date stamps are now separate
messages.
(erc-fill--wrap-continued-message-p): Restore accidentally discarded
doc string. Derive context about current message from text props at
`point-min', and use updated property names and utility functions.
Abort when previous message is now hidden.
(erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function,
originally meant to be new in ERC 5.6, and move logic for date-stamp
measuring portion directly to `erc-fill-wrap' itself.
(erc-fill--wrap-measure): New helper function.
(erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate
date-stamp detection and width measuring from removed helper. Don't
dedent first word for messages of unknown origin, such as those
inserted by `erc-display-line' alone without prior preparation from
`erc-display-message'.
* lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable):
Set hook depth explicitly to 70.
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a
trailing newline is implicit if not provided and that users who don't
want date stamps should use `erc-timestamp-format-right' instead.
(erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead
of `erc-munge-invisibility-spec', and bump hook depth for
`erc-add-timestamp' to 70.
(erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp'
text property in doc string.
(erc-stamp--skip): New internal variable.
(erc-stamp--allow-unmanaged): New variable for legacy code to force
`erc-add-timestamps' to run when `erc--msg-props' is nil.
(erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is
non-nil unless `erc-stamp--skip' is as well because the latter takes
precedence. Don't add `erc-ts' text prop directly unless
`erc-stamp--allow-unmanaged is non-nil. Instead, use the new
`erc--msg-props' facility to defer until after modification hooks.
Likewise, don't add `cursor-senor-functions' directly either unless
the same compatibility flag is enabled. Instead, expect the latter to
be handled by a post-modify hook conditioned on the option
`erc-echo-timestamps'.
(erc-timestamp-last-inserted-left): Mention that the final trailing
newline specified in the format string no longer appears in the
recorded value.
(erc-stamp-prefix-log-filter): Use updated name for timestamp
property as well as helper utility for accessing it.
(erc-stamp--inherited-props): Add doc string.
(erc-insert-timestamp-right): Fix bug involving object cycle where
the time-stamp string would appear in its own `display' property.
(erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove
unused internal function-valued interface variable and replace with
the latter, a normal hook.
(erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp):
New function and auxiliary variable to apply date stamp properties at
the post-modify stage. Add text property `erc-stamp-type' to inserted
date stamps to help folks distinguish between them and other
left-sided stamps.
(erc-stamp--current-datestamp-left,
erc-stamp--format-date-stamp,
erc-stamp--insert-date-stamp-as-phony-message,
erc-stamp--lr-date-on-pre-modify): New functions and state variable to
help ERC treat date stamps as separate messages while working within
the established mechanism for processing inserted messages. Shadow
`erc-stamp--invisible-property' when calling `erc-format-timestamp' in
order to prevent date stamps from inheriting other `invisible' props.
These date stamps are special in that they have no business being
hidden along with the current message.
(erc-insert-timestamp-left-and-right): On initial run in any buffer,
remember whether the date stamp needed newline massaging on insertion.
Move all business for inserting date stamps to post-modify hooks, but
run them forcibly if this is the very first date stamp in the current
buffer. Also mention some specifics related to relevant text props in
the doc string.
(erc-format-timestamp): Don't add `invisible' prop to stamp unless
`erc-stamp--invisible-property' is non-nil.
(erc-stamp--csf-props-updated-p): New local variable.
(erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text
property for existing messages when a user enables the option
mid-session. Add and remove hooks for use with automatic timestamp
echoing.
(erc-stamp--add-csf-on-post-modify): New function to add
`cursor-sensor-functions' property on post-modify hooks.
(erc-stamp--setup): Perform some additional teardown.
(erc-stamp--on-clear-message): Look for text property `erc-ts' instead
of `erc-timestamp'.
(erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp
text prop in current message.
(erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use
hook `erc-stamp--insert-date-hook' instead of excised function-valued
variable interface `erc-stamp--insert-date-function'.
* lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal
utility to find beginning of message.
* lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New
internal variables for initializing and conveying metadata-oriented
text properties among insert and send hooks.
(erc-insert-modify-hook): Mention reserved depth ranges for built-in
members in doc string.
(erc-send-action): Use convenience variable to modifying text props
instead of awkwardly overriding `erc-insert-pre-hook'.
(erc--check-msg-prop, erc--get-inserted-msg-bounds,
erc--get-inserted-msg-prop, erc--with-inserted-msg,
erc--traverse-inserted): New utility functions and macros to help
modules find metadata and message-delimiting text props.
(erc-display-line-1): Ensure the first character of every message in
an ERC buffer has the `erc-msg' property, as well as any other props
in `erc--msg-props', when populated.
(erc--hide-message): Don't bother offsetting start of first message in
a buffer.
(erc--ranked-properties, erc--order-text-properties-from-hash): New
variable and function to convert `erc--msg-props' into a plist
suitable for `add-text-properties'.
(erc-display-message): Make doc string more informative. Bind and
initialize `erc--msg-props' for use by all hooks. Respect
`erc--msg-prop-overrides' when non-nil. Don't add `erc-command'
property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item
when the parameter PARSED is non-nil.
(erc--own-property-names): Add `erc-stamp-type'.
(erc--get-speaker-bounds): Use helper to find message start.
(erc-process-ctcp-query, erc-send-current-line): Use convenience
variable to leverage framework for manipulating message metadata
instead of overriding `erc-insert-pre-hook'.
(erc-display-msg): Bind `erc--msg-props' for use by all send-related
hooks. Add text props from table after `erc-send-post-hook'.
(erc-restore-text-properties): Improve doc string.
(erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg):
Make phony message more realistic.
(erc-fill-tests--wrap-populate): Shorten overlong line.
(erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant
in asserting no gaps exist in `line-prefix' property interval.
(erc-fill-tests--compare): Compare text props on text-prop values that
are themselves strings.
* test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp):
Ensure `erc-stamp' is loaded.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--stamp-left-current-nick,
erc-scenarios-match--invisible-stamp): Use `default-value' for
`erc-insert-modify-hook' in ordering assertion.
(erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove
unused assertion helper functions.
(erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced
ERT tag from function and use utility to find message bounds.
(erc-scenarios-match--stamp-right-fools-invisible): Use real utility
from main library to find message end.
(erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion
utility function.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test.
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New
test.
(erc-scenarios-match--stamp-both-invisible-fill-static): Expect
`erc-cmd' at beginning of inserted message's filled line, even if the
line starts with white space. Also, add new function parameter
`assert-ds', a callback to run when visiting the second date stamp,
which is followed by a hidden message. In the test of the same name,
expect the date stamp's invisibility interval to begin at the newline
after the previous message and to not contain any existing
invisibility props, namely, those belonging to the subsequent hidden
"fools" message. Also use shortened "metadata" text prop names.
(erc-scenarios-match--stamp-both-invisible-fill-static--nooffset):
Expect the date stamp's invisibility interval to match its field's
instead of starting and ending sooner.
* test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at
the start of the message.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules
from mutating hooks.
(erc--order-text-properties-from-hash, erc--check-msg-prop): New
tests.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
test data.
* test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
Update.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* test/lisp/erc/resources/match/fools/fill-wrap.eld: New file.
(Bug#60936)
2023-09-21 23:54:31 -07:00
|
|
|
(if-let ((n (string-to-number command)) ((zerop n))) (intern command) n))
|
2022-06-16 01:20:49 -07:00
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
;; Teach url.el how to open irc:// URLs with ERC.
|
|
|
|
;; To activate, customize `url-irc-function' to `url-irc-erc'.
|
|
|
|
|
2022-07-11 05:14:57 -07:00
|
|
|
(defcustom erc-url-connect-function nil
|
|
|
|
"When non-nil, a function used to connect to an IRC URL.
|
|
|
|
Called with a string meant to represent a URL scheme, like
|
|
|
|
\"ircs\", followed by any number of keyword arguments recognized
|
|
|
|
by `erc' and `erc-tls'."
|
|
|
|
:group 'erc
|
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
2022-11-29 22:53:44 -08:00
|
|
|
:package-version '(ERC . "5.5")
|
2022-07-11 05:14:57 -07:00
|
|
|
:type '(choice (const nil) function))
|
|
|
|
|
|
|
|
(defun erc--url-default-connect-function (scheme &rest plist)
|
|
|
|
(let* ((ircsp (if scheme
|
|
|
|
(string-suffix-p "s" scheme)
|
|
|
|
(or (eql 6697 (plist-get plist :port))
|
|
|
|
(yes-or-no-p "Connect using TLS? "))))
|
|
|
|
(erc-server (plist-get plist :server))
|
|
|
|
(erc-port (or (plist-get plist :port)
|
|
|
|
(and ircsp (erc-normalize-port 'ircs-u))
|
|
|
|
erc-port))
|
|
|
|
(erc-nick (or (plist-get plist :nick) erc-nick))
|
|
|
|
(erc-password (plist-get plist :password))
|
|
|
|
(args (erc-select-read-args)))
|
|
|
|
(unless ircsp
|
|
|
|
(setq ircsp (eql 6697 erc-port)))
|
|
|
|
(apply (if ircsp #'erc-tls #'erc) args)))
|
|
|
|
|
2006-07-14 02:29:50 +00:00
|
|
|
;;;###autoload
|
2022-07-11 05:14:57 -07:00
|
|
|
(defun erc-handle-irc-url (host port channel nick password &optional scheme)
|
|
|
|
"Use ERC to IRC on HOST:PORT in CHANNEL.
|
2006-07-14 02:29:50 +00:00
|
|
|
If ERC is already connected to HOST:PORT, simply /join CHANNEL.
|
2022-07-11 05:14:57 -07:00
|
|
|
Otherwise, connect to HOST:PORT as NICK and /join CHANNEL.
|
|
|
|
|
|
|
|
Beginning with ERC 5.5, new connections require human intervention.
|
|
|
|
Customize `erc-url-connect-function' to override this."
|
|
|
|
(when (eql port 0) (setq port nil))
|
|
|
|
(let* ((net (erc-networks--determine host))
|
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
2023-05-30 23:27:12 -07:00
|
|
|
(erc--display-context `((erc-interactive-display . url)
|
|
|
|
,@erc--display-context))
|
2022-07-11 05:14:57 -07:00
|
|
|
(server-buffer
|
|
|
|
;; Viable matches may slip through the cracks for unknown
|
|
|
|
;; networks. Additional passes could likely improve things.
|
|
|
|
(car (erc-buffer-filter
|
|
|
|
(lambda ()
|
|
|
|
(and (not erc--target)
|
|
|
|
(erc-server-process-alive)
|
|
|
|
;; Always trust a matched network.
|
|
|
|
(or (and net (eq net (erc-network)))
|
|
|
|
(and (string-equal erc-session-server host)
|
|
|
|
;; Ports only matter when dialed hosts
|
|
|
|
;; match and we have sufficient info.
|
|
|
|
(or (not port)
|
|
|
|
(= (erc-normalize-port erc-session-port)
|
|
|
|
port)))))))))
|
|
|
|
key deferred)
|
|
|
|
(unless server-buffer
|
|
|
|
(setq deferred t
|
|
|
|
server-buffer (apply (or erc-url-connect-function
|
|
|
|
#'erc--url-default-connect-function)
|
|
|
|
scheme
|
|
|
|
:server host
|
|
|
|
`(,@(and port (list :port port))
|
|
|
|
,@(and nick (list :nick nick))
|
|
|
|
,@(and password `(:password ,password))))))
|
|
|
|
(when channel
|
|
|
|
;; These aren't percent-decoded by default
|
|
|
|
(when (string-prefix-p "%" channel)
|
|
|
|
(setq channel (url-unhex-string channel)))
|
|
|
|
(cl-multiple-value-setq (channel key) (split-string channel "[?]"))
|
|
|
|
(if deferred
|
|
|
|
;; Alternatively, we could make this a defmethod, so when
|
|
|
|
;; autojoin is loaded, it can do its own thing. Also, as
|
|
|
|
;; with `erc-once-with-server-event', it's fine to set local
|
|
|
|
;; hooks here because they're killed when reconnecting.
|
|
|
|
(with-current-buffer server-buffer
|
|
|
|
(letrec ((f (lambda (&rest _)
|
|
|
|
(remove-hook 'erc-after-connect f t)
|
|
|
|
(erc-cmd-JOIN channel key))))
|
|
|
|
(add-hook 'erc-after-connect f nil t)))
|
|
|
|
(with-current-buffer server-buffer
|
|
|
|
(erc-cmd-JOIN channel key))))))
|
2006-07-14 02:29:50 +00:00
|
|
|
|
2006-01-29 13:08:58 +00:00
|
|
|
(provide 'erc)
|
|
|
|
|
|
|
|
;;; erc.el ends here
|