diff options
| author | F. Jason Park | 2024-01-14 13:02:27 -0800 |
|---|---|---|
| committer | F. Jason Park | 2024-01-18 17:06:08 -0800 |
| commit | dd2caf1a7634ea6fd8aebbdc45ea4caf22d786cd (patch) | |
| tree | 19495c4cb5656fd58041da8862c87c8994d00d09 | |
| parent | 13c7933a9d4b26e74e7f5e19d70bb89003239c34 (diff) | |
| download | emacs-dd2caf1a7634ea6fd8aebbdc45ea4caf22d786cd.tar.gz emacs-dd2caf1a7634ea6fd8aebbdc45ea4caf22d786cd.zip | |
Redo doc strings for ERC's entry point commands
* lisp/erc/erc.el: Bump Compat version in Package-Requires header to
29.1.4.4.
(erc-select-read-args): Revise doc string, and update name of internal
`--interactive-env--' entry-point parameter.
(erc, erc-tls): Don't use `&interactive-env' as a variable name, in
case it confuses persons or programs. Overhaul doc string in response
to user complaints. For `erc' specifically, include literal
`:keyword' symbols to help non-Emacs users understand the required
syntax, which isn't obvious without an example, like `erc-tls' has,
and with only "&key" and upcased metasynctatic variables to go by.
(erc--current-buffer-joined-p): Remove assertion.
* test/lisp/erc/erc-scenarios-keep-place-indicator.el
(erc-scenarios-keep-place-indicator--follow): Try waiting for
intermittently failing condition.
* test/lisp/erc/erc-tests.el (erc-select-read-args): Update name of
internal keyword variable.
| -rw-r--r-- | lisp/erc/erc.el | 117 | ||||
| -rw-r--r-- | test/lisp/erc/erc-scenarios-keep-place-indicator.el | 4 | ||||
| -rw-r--r-- | test/lisp/erc/erc-tests.el | 6 |
3 files changed, 57 insertions, 70 deletions
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 6332a8f6763..767a693a52e 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | ;; Michael Olson (mwolson@gnu.org) | 13 | ;; Michael Olson (mwolson@gnu.org) |
| 14 | ;; Kelvin White (kwhite@gnu.org) | 14 | ;; Kelvin White (kwhite@gnu.org) |
| 15 | ;; Version: 5.6-git | 15 | ;; Version: 5.6-git |
| 16 | ;; Package-Requires: ((emacs "27.1") (compat "29.1.4.3")) | 16 | ;; Package-Requires: ((emacs "27.1") (compat "29.1.4.4")) |
| 17 | ;; Keywords: IRC, chat, client, Internet | 17 | ;; Keywords: IRC, chat, client, Internet |
| 18 | ;; URL: https://www.gnu.org/software/emacs/erc.html | 18 | ;; URL: https://www.gnu.org/software/emacs/erc.html |
| 19 | 19 | ||
| @@ -2637,8 +2637,11 @@ typically the same as that reported by `erc-current-nick'." | |||
| 2637 | 2637 | ||
| 2638 | ;;;###autoload | 2638 | ;;;###autoload |
| 2639 | (defun erc-select-read-args () | 2639 | (defun erc-select-read-args () |
| 2640 | "Prompt the user for values of nick, server, port, and password. | 2640 | "Prompt for connection parameters and return them in a plist. |
| 2641 | With prefix arg, also prompt for user and full name." | 2641 | By default, collect `:server', `:port', `:nickname', and |
| 2642 | `:password'. With a non-nil prefix argument, also prompt for | ||
| 2643 | `:user' and `:full-name'. Also return various environmental | ||
| 2644 | properties needed by entry-point commands, like `erc-tls'." | ||
| 2642 | (let* ((input (let ((d (erc-compute-server))) | 2645 | (let* ((input (let ((d (erc-compute-server))) |
| 2643 | (if erc--prompt-for-server-function | 2646 | (if erc--prompt-for-server-function |
| 2644 | (funcall erc--prompt-for-server-function) | 2647 | (funcall erc--prompt-for-server-function) |
| @@ -2692,7 +2695,7 @@ With prefix arg, also prompt for user and full name." | |||
| 2692 | (setq passwd nil)) | 2695 | (setq passwd nil)) |
| 2693 | `( :server ,server :port ,port :nick ,nick ,@(and user `(:user ,user)) | 2696 | `( :server ,server :port ,port :nick ,nick ,@(and user `(:user ,user)) |
| 2694 | ,@(and passwd `(:password ,passwd)) ,@(and full `(:full-name ,full)) | 2697 | ,@(and passwd `(:password ,passwd)) ,@(and full `(:full-name ,full)) |
| 2695 | ,@(and env `(&interactive-env ,env))))) | 2698 | ,@(and env `(--interactive-env-- ,env))))) |
| 2696 | 2699 | ||
| 2697 | (defmacro erc--with-entrypoint-environment (env &rest body) | 2700 | (defmacro erc--with-entrypoint-environment (env &rest body) |
| 2698 | "Run BODY with bindings from ENV alist." | 2701 | "Run BODY with bindings from ENV alist." |
| @@ -2721,30 +2724,40 @@ With prefix arg, also prompt for user and full name." | |||
| 2721 | (full-name (erc-compute-full-name)) | 2724 | (full-name (erc-compute-full-name)) |
| 2722 | id | 2725 | id |
| 2723 | ;; Used by interactive form | 2726 | ;; Used by interactive form |
| 2724 | ((&interactive-env --interactive-env--))) | 2727 | ((--interactive-env-- --interactive-env--))) |
| 2725 | "ERC is a powerful, modular, and extensible IRC client. | 2728 | "Connect to an Internet Relay Chat SERVER on a non-TLS PORT. |
| 2726 | This function is the main entry point for ERC. | 2729 | Use NICK and USER, when non-nil, to inform the IRC commands of |
| 2727 | 2730 | the same name, possibly factoring in a non-nil FULL-NAME as well. | |
| 2728 | It allows selecting connection parameters, and then starts ERC. | 2731 | When PASSWORD is non-nil, also send an opening server password |
| 2729 | 2732 | via the \"PASS\" command. Interactively, prompt for SERVER, | |
| 2730 | Non-interactively, it takes the keyword arguments | 2733 | PORT, NICK, and PASSWORD, along with USER and FULL-NAME when |
| 2731 | (server (erc-compute-server)) | 2734 | given a prefix argument. Non-interactively, expect the rarely |
| 2732 | (port (erc-compute-port)) | 2735 | needed ID parameter, when non-nil, to be a symbol or a string for |
| 2733 | (nick (erc-compute-nick)) | 2736 | naming the server buffer and identifying the connection |
| 2734 | (user (erc-compute-user)) | 2737 | unequivocally. (See Info node `(erc) Connecting' for details |
| 2735 | password | 2738 | about all mentioned parameters.) |
| 2736 | (full-name (erc-compute-full-name)) | 2739 | |
| 2737 | id | 2740 | Together with `erc-tls', this command serves as the main entry |
| 2738 | 2741 | point for ERC, the powerful, modular, and extensible IRC client. | |
| 2739 | That is, if called with | 2742 | Non-interactively, both commands accept the following keyword |
| 2743 | arguments, with their defaults supplied by the indicated | ||
| 2744 | \"compute\" functions: | ||
| 2745 | |||
| 2746 | :server `erc-compute-server' | ||
| 2747 | :port `erc-compute-port' | ||
| 2748 | :nick `erc-compute-nick' | ||
| 2749 | :user `erc-compute-user' | ||
| 2750 | :password N/A | ||
| 2751 | :full-name `erc-compute-full-name' | ||
| 2752 | :id' N/A | ||
| 2753 | |||
| 2754 | For example, when called in the following manner | ||
| 2740 | 2755 | ||
| 2741 | (erc :server \"irc.libera.chat\" :full-name \"J. Random Hacker\") | 2756 | (erc :server \"irc.libera.chat\" :full-name \"J. Random Hacker\") |
| 2742 | 2757 | ||
| 2743 | then the server and full-name will be set to those values, | 2758 | ERC assigns SERVER and FULL-NAME the associated keyword values |
| 2744 | whereas `erc-compute-port' and `erc-compute-nick' will be invoked | 2759 | and defers to `erc-compute-port', `erc-compute-user', and |
| 2745 | for the values of the other parameters. | 2760 | `erc-compute-nick' for those respective parameters. |
| 2746 | |||
| 2747 | See `erc-tls' for the meaning of ID. | ||
| 2748 | 2761 | ||
| 2749 | \(fn &key SERVER PORT NICK USER PASSWORD FULL-NAME ID)" | 2762 | \(fn &key SERVER PORT NICK USER PASSWORD FULL-NAME ID)" |
| 2750 | (interactive (let ((erc--display-context `((erc-interactive-display . erc) | 2763 | (interactive (let ((erc--display-context `((erc-interactive-display . erc) |
| @@ -2770,51 +2783,26 @@ See `erc-tls' for the meaning of ID. | |||
| 2770 | client-certificate | 2783 | client-certificate |
| 2771 | id | 2784 | id |
| 2772 | ;; Used by interactive form | 2785 | ;; Used by interactive form |
| 2773 | ((&interactive-env --interactive-env--))) | 2786 | ((--interactive-env-- --interactive-env--))) |
| 2774 | "ERC is a powerful, modular, and extensible IRC client. | 2787 | "Connect to an IRC server over a TLS-encrypted connection. |
| 2775 | This function is the main entry point for ERC over TLS. | 2788 | Interactively, prompt for SERVER, PORT, NICK, and PASSWORD, along |
| 2776 | 2789 | with USER and FULL-NAME when given a prefix argument. | |
| 2777 | It allows selecting connection parameters, and then starts ERC | 2790 | Non-interactively, also accept a CLIENT-CERTIFICATE, which should |
| 2778 | over TLS. | 2791 | be a list containing the file name of the certificate's key |
| 2779 | 2792 | followed by that of the certificate itself. Alternatively, | |
| 2780 | Non-interactively, it takes the keyword arguments | 2793 | accept a value of t instead of a list, to tell ERC to query |
| 2781 | (server (erc-compute-server)) | 2794 | `auth-source' for the certificate's details. |
| 2782 | (port (erc-compute-port)) | 2795 | |
| 2783 | (nick (erc-compute-nick)) | 2796 | Example client certificate (CertFP) usage: |
| 2784 | (user (erc-compute-user)) | ||
| 2785 | password | ||
| 2786 | (full-name (erc-compute-full-name)) | ||
| 2787 | client-certificate | ||
| 2788 | id | ||
| 2789 | |||
| 2790 | That is, if called with | ||
| 2791 | |||
| 2792 | (erc-tls :server \"irc.libera.chat\" :full-name \"J. Random Hacker\") | ||
| 2793 | |||
| 2794 | then the server and full-name will be set to those values, | ||
| 2795 | whereas `erc-compute-port' and `erc-compute-nick' will be invoked | ||
| 2796 | for the values of their respective parameters. | ||
| 2797 | |||
| 2798 | CLIENT-CERTIFICATE, if non-nil, should either be a list where the | ||
| 2799 | first element is the certificate key file name, and the second | ||
| 2800 | element is the certificate file name itself, or t, which means | ||
| 2801 | that `auth-source' will be queried for the key and the | ||
| 2802 | certificate. Authenticating using a TLS client certificate is | ||
| 2803 | also referred to as \"CertFP\" (Certificate Fingerprint) | ||
| 2804 | authentication by various IRC networks. | ||
| 2805 | |||
| 2806 | Example usage: | ||
| 2807 | 2797 | ||
| 2808 | (erc-tls :server \"irc.libera.chat\" :port 6697 | 2798 | (erc-tls :server \"irc.libera.chat\" :port 6697 |
| 2809 | :client-certificate | 2799 | :client-certificate |
| 2810 | \\='(\"/home/bandali/my-cert.key\" | 2800 | \\='(\"/home/bandali/my-cert.key\" |
| 2811 | \"/home/bandali/my-cert.crt\")) | 2801 | \"/home/bandali/my-cert.crt\")) |
| 2812 | 2802 | ||
| 2813 | When present, ID should be a symbol or a string to use for naming | 2803 | See the alternative entry-point command `erc' as well as Info |
| 2814 | the server buffer and identifying the connection unequivocally. | 2804 | node `(erc) Connecting' for a fuller description of the various |
| 2815 | See Info node `(erc) Network Identifier' for details. Like | 2805 | parameters, like ID. |
| 2816 | CLIENT-CERTIFICATE, this parameter cannot be specified | ||
| 2817 | interactively. | ||
| 2818 | 2806 | ||
| 2819 | \(fn &key SERVER PORT NICK USER PASSWORD FULL-NAME CLIENT-CERTIFICATE ID)" | 2807 | \(fn &key SERVER PORT NICK USER PASSWORD FULL-NAME CLIENT-CERTIFICATE ID)" |
| 2820 | (interactive | 2808 | (interactive |
| @@ -8055,7 +8043,6 @@ See also `erc-downcase'." | |||
| 8055 | 8043 | ||
| 8056 | (defun erc--current-buffer-joined-p () | 8044 | (defun erc--current-buffer-joined-p () |
| 8057 | "Return non-nil if the current buffer is a channel and is joined." | 8045 | "Return non-nil if the current buffer is a channel and is joined." |
| 8058 | (cl-assert erc--target) | ||
| 8059 | (and (erc--target-channel-p erc--target) | 8046 | (and (erc--target-channel-p erc--target) |
| 8060 | (erc--target-channel-joined-p erc--target) | 8047 | (erc--target-channel-joined-p erc--target) |
| 8061 | t)) | 8048 | t)) |
diff --git a/test/lisp/erc/erc-scenarios-keep-place-indicator.el b/test/lisp/erc/erc-scenarios-keep-place-indicator.el index b8ff59f4e02..572045cf0bc 100644 --- a/test/lisp/erc/erc-scenarios-keep-place-indicator.el +++ b/test/lisp/erc/erc-scenarios-keep-place-indicator.el | |||
| @@ -85,8 +85,8 @@ | |||
| 85 | (goto-char (window-point)) | 85 | (goto-char (window-point)) |
| 86 | (should (looking-back (rx "<bob> tester, welcome!"))) | 86 | (should (looking-back (rx "<bob> tester, welcome!"))) |
| 87 | (should (= (pos-bol) (window-start))) | 87 | (should (= (pos-bol) (window-start))) |
| 88 | (should (= (overlay-start erc--keep-place-indicator-overlay) | 88 | (erc-d-t-wait-for 20 |
| 89 | (pos-bol)))) | 89 | (= (overlay-start erc--keep-place-indicator-overlay) (pos-bol)))) |
| 90 | ;; Lower window is still centered at start. | 90 | ;; Lower window is still centered at start. |
| 91 | (other-window 1) | 91 | (other-window 1) |
| 92 | (switch-to-buffer "#chan") | 92 | (switch-to-buffer "#chan") |
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index e3e20b7ba8f..49c72836a22 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el | |||
| @@ -2707,7 +2707,7 @@ | |||
| 2707 | (list :server "irc.libera.chat" | 2707 | (list :server "irc.libera.chat" |
| 2708 | :port 6697 | 2708 | :port 6697 |
| 2709 | :nick (user-login-name) | 2709 | :nick (user-login-name) |
| 2710 | '&interactive-env | 2710 | '--interactive-env-- |
| 2711 | '((erc-server-connect-function . erc-open-tls-stream) | 2711 | '((erc-server-connect-function . erc-open-tls-stream) |
| 2712 | (erc-join-buffer . window)))))) | 2712 | (erc-join-buffer . window)))))) |
| 2713 | 2713 | ||
| @@ -2717,7 +2717,7 @@ | |||
| 2717 | (list :server "irc.gnu.org" | 2717 | (list :server "irc.gnu.org" |
| 2718 | :port 6697 | 2718 | :port 6697 |
| 2719 | :nick (user-login-name) | 2719 | :nick (user-login-name) |
| 2720 | '&interactive-env | 2720 | '--interactive-env-- |
| 2721 | '((erc-server-connect-function . erc-open-tls-stream) | 2721 | '((erc-server-connect-function . erc-open-tls-stream) |
| 2722 | (erc-join-buffer . window)))))) | 2722 | (erc-join-buffer . window)))))) |
| 2723 | 2723 | ||
| @@ -2728,7 +2728,7 @@ | |||
| 2728 | (list :server "irc.gnu.org" | 2728 | (list :server "irc.gnu.org" |
| 2729 | :port 6697 | 2729 | :port 6697 |
| 2730 | :nick (user-login-name) | 2730 | :nick (user-login-name) |
| 2731 | '&interactive-env | 2731 | '--interactive-env-- |
| 2732 | '((erc-server-connect-function | 2732 | '((erc-server-connect-function |
| 2733 | . erc-open-tls-stream) | 2733 | . erc-open-tls-stream) |
| 2734 | (erc--display-context | 2734 | (erc--display-context |