diff options
| author | F. Jason Park | 2025-02-04 06:11:50 -0800 |
|---|---|---|
| committer | F. Jason Park | 2025-02-07 20:21:36 -0800 |
| commit | e9408918f4e7fe00eb4e25e1e5428fb26c4ad847 (patch) | |
| tree | 646d187e5252a184e3303fb00dbe1809a093847c /lisp | |
| parent | 0e4883f18eecea59e537e2368a0f5674888a1af7 (diff) | |
| download | emacs-e9408918f4e7fe00eb4e25e1e5428fb26c4ad847.tar.gz emacs-e9408918f4e7fe00eb4e25e1e5428fb26c4ad847.zip | |
More clearly define local module behavior in ERC
* doc/misc/erc.texi (Modules): Label all local modules as being such.
Move `querypoll' to the auxiliary section. Rework entire "Local
Modules" portion.
* lisp/erc/erc-goodies.el (erc-keep-place-indicator-mode)
(erc-command-indicator-mode): Mention what buffer types they operate in.
* lisp/erc/erc-nicks.el (erc-nicks-mode): Mention the mode is enabled in
all buffers.
* lisp/erc/erc-notify.el (erc-querypoll-mode): Mention which buffers it
operates in.
* lisp/erc/erc-sasl.el (erc-sasl-mode): Disable completely in target
buffers so its mode variable is nil.
* lisp/erc/erc-services.el (erc-services-regain-mode): Disable in target
buffers.
* lisp/erc/erc.el (erc-open): When activating local modules, skip those
that have just been enabled by a fellow module. Do this even though
their setup code is meant to be idempotent.
* test/lisp/erc/erc-scenarios-base-local-modules.el
(erc-scenarios-base-local-modules--toggle-helpers): Revise to assert
current behavior. (Bug#57955)
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/erc/erc-goodies.el | 8 | ||||
| -rw-r--r-- | lisp/erc/erc-nicks.el | 4 | ||||
| -rw-r--r-- | lisp/erc/erc-notify.el | 6 | ||||
| -rw-r--r-- | lisp/erc/erc-sasl.el | 14 | ||||
| -rw-r--r-- | lisp/erc/erc-services.el | 6 | ||||
| -rw-r--r-- | lisp/erc/erc.el | 4 |
6 files changed, 24 insertions, 18 deletions
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el index cfd0d3415ea..24a3205e0cd 100644 --- a/lisp/erc/erc-goodies.el +++ b/lisp/erc/erc-goodies.el | |||
| @@ -372,7 +372,9 @@ than the indicator's position." | |||
| 372 | "Buffer-local `keep-place' with fringe arrow and/or highlighted face. | 372 | "Buffer-local `keep-place' with fringe arrow and/or highlighted face. |
| 373 | Play nice with global module `keep-place' but don't depend on it. | 373 | Play nice with global module `keep-place' but don't depend on it. |
| 374 | Expect that users may want different combinations of `keep-place' | 374 | Expect that users may want different combinations of `keep-place' |
| 375 | and `keep-place-indicator' in different buffers." | 375 | and `keep-place-indicator' in different buffers. |
| 376 | |||
| 377 | This module is local to individual buffers." | ||
| 376 | ((cond (erc-keep-place-mode) | 378 | ((cond (erc-keep-place-mode) |
| 377 | ((memq 'keep-place erc-modules) | 379 | ((memq 'keep-place erc-modules) |
| 378 | (erc-keep-place-mode +1)) | 380 | (erc-keep-place-mode +1)) |
| @@ -589,7 +591,9 @@ message's speaker." | |||
| 589 | Skip those appearing in `erc-noncommands-list'. | 591 | Skip those appearing in `erc-noncommands-list'. |
| 590 | 592 | ||
| 591 | Users can run \\[erc-command-indicator-toggle-hidden] to hide and | 593 | Users can run \\[erc-command-indicator-toggle-hidden] to hide and |
| 592 | reveal echoed command lines after they've been inserted." | 594 | reveal echoed command lines after they've been inserted. |
| 595 | |||
| 596 | This module is local to individual buffers." | ||
| 593 | ((add-hook 'erc--input-review-functions | 597 | ((add-hook 'erc--input-review-functions |
| 594 | #'erc--command-indicator-permit-insertion 80 t) | 598 | #'erc--command-indicator-permit-insertion 80 t) |
| 595 | (erc-command-indicator-toggle-hidden -1)) | 599 | (erc-command-indicator-toggle-hidden -1)) |
diff --git a/lisp/erc/erc-nicks.el b/lisp/erc/erc-nicks.el index b0629f7754c..a3e9b1f7b46 100644 --- a/lisp/erc/erc-nicks.el +++ b/lisp/erc/erc-nicks.el | |||
| @@ -541,7 +541,9 @@ Abandon search after examining LIMIT faces." | |||
| 541 | nick-object) | 541 | nick-object) |
| 542 | 542 | ||
| 543 | (define-erc-module nicks nil | 543 | (define-erc-module nicks nil |
| 544 | "Uniquely colorize nicknames in target buffers." | 544 | "Uniquely colorize nicknames in target buffers. |
| 545 | |||
| 546 | This module is local per connection." | ||
| 545 | ((if erc--target | 547 | ((if erc--target |
| 546 | (progn | 548 | (progn |
| 547 | (erc-with-server-buffer | 549 | (erc-with-server-buffer |
diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el index 82754cb1989..1e04c90177e 100644 --- a/lisp/erc/erc-notify.el +++ b/lisp/erc/erc-notify.el | |||
| @@ -299,7 +299,8 @@ like `nickbar', to provide UI feedback when changes occur. | |||
| 299 | Once ERC implements the `monitor' extension, this module will serve as | 299 | Once ERC implements the `monitor' extension, this module will serve as |
| 300 | an optional fallback for keeping query-participant rolls up to date on | 300 | an optional fallback for keeping query-participant rolls up to date on |
| 301 | servers that lack support or are stingy with their allotments. Until | 301 | servers that lack support or are stingy with their allotments. Until |
| 302 | such time, this module should be considered experimental. | 302 | such time, this module should be considered experimental and only really |
| 303 | useful for bots and other non-interactive Lisp programs. | ||
| 303 | 304 | ||
| 304 | This is a local ERC module, so selectively polling only a subset of | 305 | This is a local ERC module, so selectively polling only a subset of |
| 305 | query targets is possible but cumbersome. To do so, ensure | 306 | query targets is possible but cumbersome. To do so, ensure |
| @@ -307,7 +308,8 @@ query targets is possible but cumbersome. To do so, ensure | |||
| 307 | as appropriate in desired query buffers. To stop polling for the | 308 | as appropriate in desired query buffers. To stop polling for the |
| 308 | current connection, toggle off the command \\[erc-querypoll-mode] from a | 309 | current connection, toggle off the command \\[erc-querypoll-mode] from a |
| 309 | server buffer, or run \\`M-x C-u erc-querypoll-disable RET' from a | 310 | server buffer, or run \\`M-x C-u erc-querypoll-disable RET' from a |
| 310 | target buffer." | 311 | target buffer. Note that this module's minor mode must remain active in |
| 312 | at least the server buffer." | ||
| 311 | ((if erc--target | 313 | ((if erc--target |
| 312 | (if (erc-query-buffer-p) | 314 | (if (erc-query-buffer-p) |
| 313 | (progn ; accommodate those who eschew `erc-modules' | 315 | (progn ; accommodate those who eschew `erc-modules' |
diff --git a/lisp/erc/erc-sasl.el b/lisp/erc/erc-sasl.el index a16f554f2d1..5228fc5e5aa 100644 --- a/lisp/erc/erc-sasl.el +++ b/lisp/erc/erc-sasl.el | |||
| @@ -34,13 +34,6 @@ | |||
| 34 | ;; | 34 | ;; |
| 35 | ;; - Implement a proxy mechanism that chooses the strongest available | 35 | ;; - Implement a proxy mechanism that chooses the strongest available |
| 36 | ;; mechanism for you. Requires CAP 3.2 (see bug#49860). | 36 | ;; mechanism for you. Requires CAP 3.2 (see bug#49860). |
| 37 | ;; | ||
| 38 | ;; - Integrate with whatever solution ERC eventually settles on to | ||
| 39 | ;; handle user options for different network contexts. At the | ||
| 40 | ;; moment, this does its own thing for stashing and restoring | ||
| 41 | ;; session options, but ERC should make abstractions available for | ||
| 42 | ;; all local modules to use, possibly based on connection-local | ||
| 43 | ;; variables. | ||
| 44 | 37 | ||
| 45 | ;;; Code: | 38 | ;;; Code: |
| 46 | (require 'erc) | 39 | (require 'erc) |
| @@ -315,9 +308,10 @@ If necessary, pass PROMPT to `read-passwd'." | |||
| 315 | 308 | ||
| 316 | (define-erc-module sasl nil | 309 | (define-erc-module sasl nil |
| 317 | "Non-IRCv3 SASL support for ERC. | 310 | "Non-IRCv3 SASL support for ERC. |
| 318 | This doesn't solicit or validate a suite of supported mechanisms." | 311 | This local module only enables its minor mode in server buffers, and it |
| 319 | ;; See bug#49860 for a CAP 3.2-aware WIP implementation. | 312 | doesn't currently solicit or validate supported mechanisms." |
| 320 | ((unless erc--target | 313 | ((if erc--target |
| 314 | (erc-sasl-mode -1) | ||
| 321 | (setq erc-sasl--state (make-erc-sasl--state)) | 315 | (setq erc-sasl--state (make-erc-sasl--state)) |
| 322 | ;; If the previous attempt failed during registration, this may be | 316 | ;; If the previous attempt failed during registration, this may be |
| 323 | ;; non-nil and contain erroneous values, but how can we detect that? | 317 | ;; non-nil and contain erroneous values, but how can we detect that? |
diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el index 429424117eb..25da873076e 100644 --- a/lisp/erc/erc-services.el +++ b/lisp/erc/erc-services.el | |||
| @@ -613,8 +613,10 @@ In practical terms, this means that this module, which is still | |||
| 613 | somewhat experimental, is likely only useful in conjunction with | 613 | somewhat experimental, is likely only useful in conjunction with |
| 614 | SASL authentication or CertFP rather than the traditional approach | 614 | SASL authentication or CertFP rather than the traditional approach |
| 615 | provided by the `services' module it shares a library with (see Info | 615 | provided by the `services' module it shares a library with (see Info |
| 616 | node `(erc) SASL' for more)." | 616 | node `(erc) SASL' for more). |
| 617 | nil nil localp) | 617 | |
| 618 | This local module's minor mode is only active in server buffers." | ||
| 619 | ((when erc--target (erc-services-regain-mode -1))) nil localp) | ||
| 618 | 620 | ||
| 619 | (cl-defmethod erc--nickname-in-use-make-request | 621 | (cl-defmethod erc--nickname-in-use-make-request |
| 620 | ((want string) temp &context (erc-server-connected null) | 622 | ((want string) temp &context (erc-server-connected null) |
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index afa8e0a7b72..0d72b46360e 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el | |||
| @@ -2662,7 +2662,9 @@ side effect of setting the current buffer to the one it returns. Use | |||
| 2662 | (erc--initialize-markers old-point continued-session) | 2662 | (erc--initialize-markers old-point continued-session) |
| 2663 | (erc-determine-parameters server port nick full-name user passwd) | 2663 | (erc-determine-parameters server port nick full-name user passwd) |
| 2664 | (save-excursion (run-mode-hooks) | 2664 | (save-excursion (run-mode-hooks) |
| 2665 | (dolist (mod (car delayed-modules)) (funcall mod +1)) | 2665 | (dolist (mod (car delayed-modules)) |
| 2666 | (unless (and (boundp mod) (symbol-value mod)) | ||
| 2667 | (funcall mod +1))) | ||
| 2666 | (dolist (var (cdr delayed-modules)) (set var nil))) | 2668 | (dolist (var (cdr delayed-modules)) (set var nil))) |
| 2667 | 2669 | ||
| 2668 | ;; Saving log file on exit | 2670 | ;; Saving log file on exit |