diff options
| author | F. Jason Park | 2023-11-10 13:34:31 -0800 |
|---|---|---|
| committer | F. Jason Park | 2023-11-12 20:37:49 -0800 |
| commit | 1d2aa130caeb6494e647db02237cfd414249a3db (patch) | |
| tree | 0ad3cfafb9ce182bca7d2cc499d01b1ab158f824 | |
| parent | 583d73e9a0edb8cb79c4a821b39685aa220bbefa (diff) | |
| download | emacs-1d2aa130caeb6494e647db02237cfd414249a3db.tar.gz emacs-1d2aa130caeb6494e647db02237cfd414249a3db.zip | |
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)
| -rw-r--r-- | doc/misc/erc.texi | 5 | ||||
| -rw-r--r-- | etc/ERC-NEWS | 13 | ||||
| -rw-r--r-- | lisp/erc/erc-goodies.el | 121 | ||||
| -rw-r--r-- | lisp/erc/erc-match.el | 14 | ||||
| -rw-r--r-- | lisp/erc/erc.el | 63 | ||||
| -rw-r--r-- | test/lisp/erc/erc-scenarios-base-send-message.el | 54 | ||||
| -rw-r--r-- | test/lisp/erc/erc-tests.el | 3 |
7 files changed, 217 insertions, 56 deletions
diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi index 10902eac33f..44e82084b90 100644 --- a/doc/misc/erc.texi +++ b/doc/misc/erc.texi | |||
| @@ -450,6 +450,11 @@ Buttonize URLs, nicknames, and other text | |||
| 450 | @item capab-identify | 450 | @item capab-identify |
| 451 | Mark unidentified users on freenode and other servers supporting CAPAB. | 451 | Mark unidentified users on freenode and other servers supporting CAPAB. |
| 452 | 452 | ||
| 453 | @cindex modules, command-indicator | ||
| 454 | @item command-indicator | ||
| 455 | Echo command lines for ``slash commands'', like @kbd{/JOIN #erc} and | ||
| 456 | @kbd{/HELP join} | ||
| 457 | |||
| 453 | @cindex modules, completion | 458 | @cindex modules, completion |
| 454 | @cindex modules, pcomplete | 459 | @cindex modules, pcomplete |
| 455 | @item completion (aka pcomplete) | 460 | @item completion (aka pcomplete) |
diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS index f59023eae62..cd4a283ef1c 100644 --- a/etc/ERC-NEWS +++ b/etc/ERC-NEWS | |||
| @@ -157,6 +157,19 @@ asking users who've customized this option to switch to | |||
| 157 | that some other solution, like automatic migration, is justified, | 157 | that some other solution, like automatic migration, is justified, |
| 158 | please make that known on the bug list. | 158 | please make that known on the bug list. |
| 159 | 159 | ||
| 160 | ** Module 'noncommands' deprecated, replaced by 'command-indicator'. | ||
| 161 | Command-line echoing has returned to ERC after a near decade-long | ||
| 162 | hiatus. This means you can elect to have ERC leave a trail of (most) | ||
| 163 | slash-command input submitted at the prompt, in a manner resembling | ||
| 164 | that of a shell or a REPL. The particulars are likely of little | ||
| 165 | interest to most users, but the gist is that this functionality was | ||
| 166 | removed in 5.3.x (Emacs 24.5) without mention in this document or a | ||
| 167 | change log. Everything's mostly been restored, except that the | ||
| 168 | feature is now opt-in. The only real gotcha is that related faces and | ||
| 169 | options, like 'erc-command-indicator', have moved to the 'erc-goodies' | ||
| 170 | library, although their Custom groups remain the same. Add | ||
| 171 | 'command-indicator' to 'erc-modules' to get started. | ||
| 172 | |||
| 160 | ** 'erc-button-alist' and 'erc-nick-popup-alist' have evolved slightly. | 173 | ** 'erc-button-alist' and 'erc-nick-popup-alist' have evolved slightly. |
| 161 | It's no secret that the 'buttons' module treats potential nicknames | 174 | It's no secret that the 'buttons' module treats potential nicknames |
| 162 | specially. This is perhaps most evident in its treatment of the | 175 | specially. This is perhaps most evident in its treatment of the |
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el index 4cc81dd9378..1482c21e931 100644 --- a/lisp/erc/erc-goodies.el +++ b/lisp/erc/erc-goodies.el | |||
| @@ -471,21 +471,26 @@ For use with `keep-place-indicator' module." | |||
| 471 | erc-cmd-COUNTRY | 471 | erc-cmd-COUNTRY |
| 472 | erc-cmd-SV | 472 | erc-cmd-SV |
| 473 | erc-cmd-SM | 473 | erc-cmd-SM |
| 474 | erc-cmd-SMV | 474 | erc-cmd-SAY |
| 475 | erc-cmd-LASTLOG) | 475 | erc-cmd-LASTLOG) |
| 476 | "List of commands that are aliases for CTCP ACTION or for ERC messages. | 476 | "List of client \"slash commands\" that perform their own buffer I/O. |
| 477 | 477 | The `command-indicator' module forgoes echoing these commands, | |
| 478 | If a command's function symbol is in this list, the typed command | 478 | most of which aren't actual interactive lisp commands.") |
| 479 | does not appear in the ERC buffer after the user presses ENTER.") | ||
| 480 | 479 | ||
| 481 | ;;;###autoload(autoload 'erc-noncommands-mode "erc-goodies" nil t) | 480 | ;;;###autoload(autoload 'erc-noncommands-mode "erc-goodies" nil t) |
| 482 | (define-erc-module noncommands nil | 481 | (define-erc-module noncommands nil |
| 483 | "This mode distinguishes non-commands. | 482 | "Treat commands that display themselves specially. |
| 484 | Commands listed in `erc-insert-this' know how to display | 483 | This module has been a no-op since ERC 5.3 and has likely only |
| 485 | themselves." | 484 | ever made sense in the context of `erc-command-indicator'. It |
| 485 | was deprecated in ERC 5.6." | ||
| 486 | ((add-hook 'erc--input-review-functions #'erc-send-distinguish-noncommands)) | 486 | ((add-hook 'erc--input-review-functions #'erc-send-distinguish-noncommands)) |
| 487 | ((remove-hook 'erc--input-review-functions | 487 | ((remove-hook 'erc--input-review-functions |
| 488 | #'erc-send-distinguish-noncommands))) | 488 | #'erc-send-distinguish-noncommands))) |
| 489 | (make-obsolete-variable 'erc-noncommand-mode | ||
| 490 | 'erc-command-indicator-mode "30.1") | ||
| 491 | (make-obsolete 'erc-noncommand-mode 'erc-command-indicator-mode "30.1") | ||
| 492 | (make-obsolete 'erc-noncommand-enable 'erc-command-indicator-enable "30.1") | ||
| 493 | (make-obsolete 'erc-noncommand-disable 'erc-command-indicator-disable "30.1") | ||
| 489 | 494 | ||
| 490 | (defun erc-send-distinguish-noncommands (state) | 495 | (defun erc-send-distinguish-noncommands (state) |
| 491 | "If STR is an ERC non-command, set `insertp' in STATE to nil." | 496 | "If STR is an ERC non-command, set `insertp' in STATE to nil." |
| @@ -499,6 +504,106 @@ themselves." | |||
| 499 | ;; Inhibit sending this string. | 504 | ;; Inhibit sending this string. |
| 500 | (setf (erc-input-insertp state) nil)))) | 505 | (setf (erc-input-insertp state) nil)))) |
| 501 | 506 | ||
| 507 | |||
| 508 | ;;; Command-indicator | ||
| 509 | |||
| 510 | (defface erc-command-indicator-face | ||
| 511 | '((t :inherit (erc-input-face fixed-pitch-serif))) | ||
| 512 | "Face for echoed command lines, including the prompt. | ||
| 513 | See option `erc-command-indicator'." | ||
| 514 | :package-version '(ERC . "5.6") ; standard value, from bold | ||
| 515 | :group 'erc-faces) | ||
| 516 | |||
| 517 | (defcustom erc-command-indicator 'erc-prompt | ||
| 518 | "Pseudo prompt for echoed command lines. | ||
| 519 | An analog of the option `erc-prompt' that replaces the \"speaker | ||
| 520 | label\" for echoed \"slash\" commands submitted at the prompt. A | ||
| 521 | value of nil means ERC only inserts the command-line portion | ||
| 522 | alone, without the prompt, which may trick certain modules, like | ||
| 523 | `fill', into treating the leading slash command itself as the | ||
| 524 | message's speaker." | ||
| 525 | :package-version '(ERC . "5.6") | ||
| 526 | :group 'erc-display | ||
| 527 | :type '(choice (const :tag "Defer to `erc-prompt'" erc-prompt) | ||
| 528 | (const :tag "Print command lines without a prompt" nil) | ||
| 529 | (string :tag "User-provided string") | ||
| 530 | (function :tag "User-provided function"))) | ||
| 531 | |||
| 532 | ;;;###autoload(autoload 'erc-command-indicator-mode "erc-goodies" nil t) | ||
| 533 | (define-erc-module command-indicator nil | ||
| 534 | "Echo command lines for \"slash commands,\" like /JOIN, /HELP, etc. | ||
| 535 | Skip those appearing in `erc-noncommands-list'. | ||
| 536 | |||
| 537 | Users can run \\[erc-command-indicator-toggle-hidden] to hide and | ||
| 538 | reveal echoed command lines after they've been inserted." | ||
| 539 | ((add-hook 'erc--input-review-functions | ||
| 540 | #'erc--command-indicator-permit-insertion 80 t) | ||
| 541 | (erc-command-indicator-toggle-hidden -1)) | ||
| 542 | ((remove-hook 'erc--input-review-functions | ||
| 543 | #'erc--command-indicator-permit-insertion t) | ||
| 544 | (erc-command-indicator-toggle-hidden +1)) | ||
| 545 | 'local) | ||
| 546 | |||
| 547 | (defun erc-command-indicator () | ||
| 548 | "Return the command-indicator prompt as a string. | ||
| 549 | Do nothing if the variable `erc-command-indicator' is nil." | ||
| 550 | (and erc-command-indicator | ||
| 551 | (let ((prompt (if (functionp erc-command-indicator) | ||
| 552 | (funcall erc-command-indicator) | ||
| 553 | erc-command-indicator))) | ||
| 554 | (concat prompt (and (not (string-empty-p prompt)) | ||
| 555 | (not (string-suffix-p " " prompt)) | ||
| 556 | " "))))) | ||
| 557 | |||
| 558 | (defun erc-command-indicator-toggle-hidden (arg) | ||
| 559 | "Toggle whether echoed \"slash commands\" are visible." | ||
| 560 | (interactive "P") | ||
| 561 | (erc--toggle-hidden 'command-indicator arg)) | ||
| 562 | |||
| 563 | (defun erc--command-indicator-permit-insertion (state) | ||
| 564 | "Insert `erc-input' STATE's message if it's an echoed command." | ||
| 565 | (cl-assert erc-command-indicator-mode) | ||
| 566 | (when (erc--input-split-cmdp state) | ||
| 567 | (setf (erc--input-split-insertp state) #'erc--command-indicator-display) | ||
| 568 | (erc-send-distinguish-noncommands state))) | ||
| 569 | |||
| 570 | ;; This function used to be called `erc-display-command'. It was | ||
| 571 | ;; neutered in ERC 5.3.x (Emacs 24.5), commented out in 5.4, removed | ||
| 572 | ;; in 5.5, and restored in 5.6. | ||
| 573 | (defun erc--command-indicator-display (line) | ||
| 574 | "Insert command LINE as echoed input resembling that of REPLs and shells." | ||
| 575 | (when erc-insert-this | ||
| 576 | (save-excursion | ||
| 577 | (erc--assert-input-bounds) | ||
| 578 | (let ((insert-position (marker-position (goto-char erc-insert-marker))) | ||
| 579 | (erc--msg-props (or erc--msg-props | ||
| 580 | (let ((ovs erc--msg-prop-overrides)) | ||
| 581 | (map-into `((erc-msg . slash-cmd) | ||
| 582 | ,@(reverse ovs)) | ||
| 583 | 'hash-table))))) | ||
| 584 | (when-let ((string (erc-command-indicator)) | ||
| 585 | (erc-input-marker (copy-marker erc-input-marker))) | ||
| 586 | (erc-display-prompt nil nil string 'erc-command-indicator-face) | ||
| 587 | (remove-text-properties insert-position (point) | ||
| 588 | '(field nil erc-prompt nil)) | ||
| 589 | (set-marker erc-input-marker nil)) | ||
| 590 | (let ((beg (point))) | ||
| 591 | (insert line) | ||
| 592 | (erc-put-text-property beg (point) | ||
| 593 | 'font-lock-face 'erc-command-indicator-face) | ||
| 594 | (insert "\n")) | ||
| 595 | (save-restriction | ||
| 596 | (narrow-to-region insert-position (point)) | ||
| 597 | (run-hooks 'erc-send-modify-hook) | ||
| 598 | (run-hooks 'erc-send-post-hook) | ||
| 599 | (cl-assert (> (- (point-max) (point-min)) 1)) | ||
| 600 | (erc--hide-message 'command-indicator) | ||
| 601 | (add-text-properties (point-min) (1+ (point-min)) | ||
| 602 | (erc--order-text-properties-from-hash | ||
| 603 | erc--msg-props)))) | ||
| 604 | (erc--refresh-prompt)))) | ||
| 605 | |||
| 606 | |||
| 502 | ;;; IRC control character processing. | 607 | ;;; IRC control character processing. |
| 503 | (defgroup erc-control-characters nil | 608 | (defgroup erc-control-characters nil |
| 504 | "Dealing with control characters." | 609 | "Dealing with control characters." |
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el index 8644e61106f..6fff54d3cf4 100644 --- a/lisp/erc/erc-match.el +++ b/lisp/erc/erc-match.el | |||
| @@ -695,19 +695,7 @@ This function is meant to be called from `erc-text-matched-hook'." | |||
| 695 | Expect the function `erc-hide-fools' or similar to be present in | 695 | Expect the function `erc-hide-fools' or similar to be present in |
| 696 | `erc-text-matched-hook'." | 696 | `erc-text-matched-hook'." |
| 697 | (interactive "P") | 697 | (interactive "P") |
| 698 | (erc-match--toggle-hidden 'match-fools arg)) | 698 | (erc--toggle-hidden 'match-fools arg)) |
| 699 | |||
| 700 | (defun erc-match--toggle-hidden (prop arg) | ||
| 701 | "Toggle invisibility for spec member PROP. | ||
| 702 | Treat ARG in a manner similar to mode toggles defined by | ||
| 703 | `define-minor-mode'." | ||
| 704 | (when arg | ||
| 705 | (setq arg (prefix-numeric-value arg))) | ||
| 706 | (if (memq prop (ensure-list buffer-invisibility-spec)) | ||
| 707 | (unless (natnump arg) | ||
| 708 | (remove-from-invisibility-spec prop)) | ||
| 709 | (when (or (not arg) (natnump arg)) | ||
| 710 | (add-to-invisibility-spec prop)))) | ||
| 711 | 699 | ||
| 712 | (provide 'erc-match) | 700 | (provide 'erc-match) |
| 713 | 701 | ||
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 6a110f7ca77..cd1c925a757 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el | |||
| @@ -346,8 +346,13 @@ with a value of 2 and means disallow more than 1 line of input." | |||
| 346 | "If non-nil, hide input prompt upon disconnecting. | 346 | "If non-nil, hide input prompt upon disconnecting. |
| 347 | To unhide, type something in the input area. Once revealed, a | 347 | To unhide, type something in the input area. Once revealed, a |
| 348 | prompt remains unhidden until the next disconnection. Channel | 348 | prompt remains unhidden until the next disconnection. Channel |
| 349 | prompts are unhidden upon rejoining. See | 349 | prompts are unhidden upon rejoining. For behavior concerning |
| 350 | `erc-unhide-query-prompt' for behavior concerning query prompts." | 350 | query prompts, see `erc-unhide-query-prompt'. Longtime ERC users |
| 351 | should note that this option was repurposed in ERC 5.5 because it | ||
| 352 | had lain dormant for years after being sidelined in 5.3 when its | ||
| 353 | only use in the interactive client was removed. Before then, its | ||
| 354 | role was controlling whether `erc-command-indicator' would appear | ||
| 355 | alongside echoed slash-command lines." | ||
| 351 | :package-version '(ERC . "5.5") | 356 | :package-version '(ERC . "5.5") |
| 352 | :group 'erc-display | 357 | :group 'erc-display |
| 353 | :type '(choice (const :tag "Always hide prompt" t) | 358 | :type '(choice (const :tag "Always hide prompt" t) |
| @@ -759,28 +764,6 @@ See also the variable `erc-prompt'." | |||
| 759 | (concat prompt " ") | 764 | (concat prompt " ") |
| 760 | prompt))) | 765 | prompt))) |
| 761 | 766 | ||
| 762 | (defcustom erc-command-indicator nil | ||
| 763 | "Indicator used by ERC for showing commands. | ||
| 764 | |||
| 765 | If non-nil, this will be used in the ERC buffer to indicate | ||
| 766 | commands (i.e., input starting with a `/'). | ||
| 767 | |||
| 768 | If nil, the prompt will be constructed from the variable `erc-prompt'." | ||
| 769 | :group 'erc-display | ||
| 770 | :type '(choice (const nil) string function)) | ||
| 771 | |||
| 772 | (defun erc-command-indicator () | ||
| 773 | "Return the command indicator prompt as a string. | ||
| 774 | |||
| 775 | This only has any meaning if the variable `erc-command-indicator' is non-nil." | ||
| 776 | (and erc-command-indicator | ||
| 777 | (let ((prompt (if (functionp erc-command-indicator) | ||
| 778 | (funcall erc-command-indicator) | ||
| 779 | erc-command-indicator))) | ||
| 780 | (if (> (length prompt) 0) | ||
| 781 | (concat prompt " ") | ||
| 782 | prompt)))) | ||
| 783 | |||
| 784 | (defcustom erc-notice-prefix "*** " | 767 | (defcustom erc-notice-prefix "*** " |
| 785 | "Prefix for all notices." | 768 | "Prefix for all notices." |
| 786 | :group 'erc-display | 769 | :group 'erc-display |
| @@ -1364,12 +1347,6 @@ This will only be used if `erc-header-line-face-method' is non-nil." | |||
| 1364 | "ERC face for the prompt." | 1347 | "ERC face for the prompt." |
| 1365 | :group 'erc-faces) | 1348 | :group 'erc-faces) |
| 1366 | 1349 | ||
| 1367 | (defface erc-command-indicator-face | ||
| 1368 | '((t :weight bold)) | ||
| 1369 | "ERC face for the command indicator. | ||
| 1370 | See the variable `erc-command-indicator'." | ||
| 1371 | :group 'erc-faces) | ||
| 1372 | |||
| 1373 | (defface erc-notice-face | 1350 | (defface erc-notice-face |
| 1374 | '((default :weight bold) | 1351 | '((default :weight bold) |
| 1375 | (((class color) (min-colors 88) (supports :weight semi-bold)) | 1352 | (((class color) (min-colors 88) (supports :weight semi-bold)) |
| @@ -2077,7 +2054,7 @@ buffer rather than a server buffer.") | |||
| 2077 | 2054 | ||
| 2078 | (defcustom erc-modules '( autojoin button completion fill imenu irccontrols | 2055 | (defcustom erc-modules '( autojoin button completion fill imenu irccontrols |
| 2079 | list match menu move-to-prompt netsplit | 2056 | list match menu move-to-prompt netsplit |
| 2080 | networks noncommands readonly ring stamp track) | 2057 | networks readonly ring stamp track) |
| 2081 | "A list of modules which ERC should enable. | 2058 | "A list of modules which ERC should enable. |
| 2082 | If you set the value of this without using `customize' remember to call | 2059 | If you set the value of this without using `customize' remember to call |
| 2083 | \(erc-update-modules) after you change it. When using `customize', modules | 2060 | \(erc-update-modules) after you change it. When using `customize', modules |
| @@ -2127,6 +2104,7 @@ removed from the list will be disabled." | |||
| 2127 | (const :tag "button: Buttonize URLs, nicknames, and other text" button) | 2104 | (const :tag "button: Buttonize URLs, nicknames, and other text" button) |
| 2128 | (const :tag "capab: Mark unidentified users on servers supporting CAPAB" | 2105 | (const :tag "capab: Mark unidentified users on servers supporting CAPAB" |
| 2129 | capab-identify) | 2106 | capab-identify) |
| 2107 | (const :tag "command-indicator: Echo command lines." command-indicator) | ||
| 2130 | (const :tag "completion: Complete nicknames and commands (programmable)" | 2108 | (const :tag "completion: Complete nicknames and commands (programmable)" |
| 2131 | completion) | 2109 | completion) |
| 2132 | (const :tag "dcc: Provide Direct Client-to-Client support" dcc) | 2110 | (const :tag "dcc: Provide Direct Client-to-Client support" dcc) |
| @@ -2146,7 +2124,7 @@ removed from the list will be disabled." | |||
| 2146 | (const :tag "networks: Provide data about IRC networks" networks) | 2124 | (const :tag "networks: Provide data about IRC networks" networks) |
| 2147 | (const :tag "nickbar: Show nicknames in a dyamic side window" nickbar) | 2125 | (const :tag "nickbar: Show nicknames in a dyamic side window" nickbar) |
| 2148 | (const :tag "nicks: Uniquely colorize nicknames in target buffers" nicks) | 2126 | (const :tag "nicks: Uniquely colorize nicknames in target buffers" nicks) |
| 2149 | (const :tag "noncommands: Don't display non-IRC commands after evaluation" | 2127 | (const :tag "noncommands: Deprecated. See module `command-indicator'." |
| 2150 | noncommands) | 2128 | noncommands) |
| 2151 | (const :tag "notifications: Desktop alerts on PRIVMSG or mentions" | 2129 | (const :tag "notifications: Desktop alerts on PRIVMSG or mentions" |
| 2152 | notifications) | 2130 | notifications) |
| @@ -3328,6 +3306,18 @@ don't bother including the preceding newline." | |||
| 3328 | (cl-incf beg)) | 3306 | (cl-incf beg)) |
| 3329 | (erc--merge-prop (1- beg) (1- end) 'invisible value))))) | 3307 | (erc--merge-prop (1- beg) (1- end) 'invisible value))))) |
| 3330 | 3308 | ||
| 3309 | (defun erc--toggle-hidden (prop arg) | ||
| 3310 | "Toggle invisibility for spec member PROP. | ||
| 3311 | Treat ARG in a manner similar to mode toggles defined by | ||
| 3312 | `define-minor-mode'." | ||
| 3313 | (when arg | ||
| 3314 | (setq arg (prefix-numeric-value arg))) | ||
| 3315 | (if (memq prop (ensure-list buffer-invisibility-spec)) | ||
| 3316 | (unless (natnump arg) | ||
| 3317 | (remove-from-invisibility-spec prop)) | ||
| 3318 | (when (or (not arg) (natnump arg)) | ||
| 3319 | (add-to-invisibility-spec prop)))) | ||
| 3320 | |||
| 3331 | (defun erc--delete-inserted-message (beg-or-point &optional end) | 3321 | (defun erc--delete-inserted-message (beg-or-point &optional end) |
| 3332 | "Remove message between BEG and END. | 3322 | "Remove message between BEG and END. |
| 3333 | Expect BEG and END to match bounds as returned by the macro | 3323 | Expect BEG and END to match bounds as returned by the macro |
| @@ -7051,7 +7041,9 @@ queue. Expect LINES-OBJ to be an `erc--input-split' object." | |||
| 7051 | (when (erc--input-split-sendp lines-obj) | 7041 | (when (erc--input-split-sendp lines-obj) |
| 7052 | (dolist (line (erc--input-split-lines lines-obj)) | 7042 | (dolist (line (erc--input-split-lines lines-obj)) |
| 7053 | (when (erc--input-split-insertp lines-obj) | 7043 | (when (erc--input-split-insertp lines-obj) |
| 7054 | (erc-display-msg line)) | 7044 | (if (functionp (erc--input-split-insertp lines-obj)) |
| 7045 | (funcall (erc--input-split-insertp lines-obj) line) | ||
| 7046 | (erc-display-msg line))) | ||
| 7055 | (erc-process-input-line (concat line "\n") | 7047 | (erc-process-input-line (concat line "\n") |
| 7056 | (null erc-flood-protect) | 7048 | (null erc-flood-protect) |
| 7057 | (not (erc--input-split-cmdp lines-obj)))))) | 7049 | (not (erc--input-split-cmdp lines-obj)))))) |
| @@ -7557,7 +7549,10 @@ sequences, process the lines verbatim. Use this for multiline | |||
| 7557 | user input." | 7549 | user input." |
| 7558 | (let* ((cb (current-buffer)) | 7550 | (let* ((cb (current-buffer)) |
| 7559 | (s "") | 7551 | (s "") |
| 7560 | (sp (or (erc-command-indicator) (erc-prompt))) | 7552 | (sp (or (and (bound-and-true-p erc-command-indicator-mode) |
| 7553 | (fboundp 'erc-command-indicator) | ||
| 7554 | (erc-command-indicator)) | ||
| 7555 | (erc-prompt))) | ||
| 7561 | (args (and (boundp 'erc-script-args) erc-script-args))) | 7556 | (args (and (boundp 'erc-script-args) erc-script-args))) |
| 7562 | (if (and args (string-match "^ " args)) | 7557 | (if (and args (string-match "^ " args)) |
| 7563 | (setq args (substring args 1))) | 7558 | (setq args (substring args 1))) |
diff --git a/test/lisp/erc/erc-scenarios-base-send-message.el b/test/lisp/erc/erc-scenarios-base-send-message.el index 904381abe6a..bf9e0f5ae3a 100644 --- a/test/lisp/erc/erc-scenarios-base-send-message.el +++ b/test/lisp/erc/erc-scenarios-base-send-message.el | |||
| @@ -69,4 +69,58 @@ | |||
| 69 | (funcall expect 10 "<alice> No, not till Thursday;")))))) | 69 | (funcall expect 10 "<alice> No, not till Thursday;")))))) |
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | ;; This asserts that the `command-indicator' module only inserts | ||
| 73 | ;; prompt-like prefixes for normal slash commands, like /JOIN. | ||
| 74 | |||
| 75 | (ert-deftest erc-scenarios-base-send-message--command-indicator () | ||
| 76 | :tags '(:expensive-test) | ||
| 77 | (erc-scenarios-common-with-cleanup | ||
| 78 | ((erc-scenarios-common-dialog "base/send-message") | ||
| 79 | (erc-server-flood-penalty 0.1) | ||
| 80 | (dumb-server (erc-d-run "localhost" t 'noncommands)) | ||
| 81 | (erc-modules `(command-indicator fill-wrap ,@erc-modules)) | ||
| 82 | (expect (erc-d-t-make-expecter))) | ||
| 83 | |||
| 84 | (ert-info ("Connect to foonet") | ||
| 85 | (with-current-buffer (erc :server "127.0.0.1" | ||
| 86 | :port (process-contact dumb-server :service) | ||
| 87 | :nick "tester" | ||
| 88 | :full-name "tester") | ||
| 89 | (funcall expect 5 "debug mode") | ||
| 90 | (erc-scenarios-common-say "/join #chan") | ||
| 91 | (funcall expect 10 "ERC> /join #chan"))) | ||
| 92 | |||
| 93 | (with-current-buffer (erc-d-t-wait-for 5 (get-buffer "#chan")) | ||
| 94 | (ert-info ("Prompt absent for CTCP ACTION") | ||
| 95 | (funcall expect 10 "<bob> alice: For hands, to do Rome") | ||
| 96 | (erc-scenarios-common-say "/me sad") | ||
| 97 | (funcall expect -0.1 "ERC> /me sad") | ||
| 98 | (funcall expect 10 "* tester sad")) | ||
| 99 | |||
| 100 | (ert-info ("Prompt absent for literal command") | ||
| 101 | (funcall expect 10 "<alice> bob: Spotted, detested") | ||
| 102 | (erc-scenarios-common-say "/say /me sad") | ||
| 103 | (funcall expect -0.1 "ERC> /say /me sad") | ||
| 104 | (funcall expect 10 "<tester> /me sad")) | ||
| 105 | |||
| 106 | (ert-info ("Prompt absent for /SV") | ||
| 107 | (funcall expect 10 "<bob> Marcus, my brother!") | ||
| 108 | (erc-scenarios-common-say "/sv") | ||
| 109 | (funcall expect -0.1 "ERC> /sv") | ||
| 110 | (funcall expect 10 "<tester> I'm using ERC")) | ||
| 111 | |||
| 112 | (ert-info ("Prompt absent module list via /SM") | ||
| 113 | (funcall expect 10 "<bob> alice: You still wrangle") | ||
| 114 | (erc-scenarios-common-say "/sm") | ||
| 115 | (funcall expect -0.1 "ERC> /sm") | ||
| 116 | (funcall expect 10 "<tester> I'm using the following modules: ") | ||
| 117 | (funcall expect 10 "<alice> No, not till Thursday;")) | ||
| 118 | |||
| 119 | (ert-info ("Prompt present for /QUIT in issuing buffer") | ||
| 120 | (erc-scenarios-common-say "/quit") | ||
| 121 | (funcall expect 10 "ERC> /quit")) | ||
| 122 | |||
| 123 | (with-current-buffer "foonet" | ||
| 124 | (funcall expect 10 "ERC finished"))))) | ||
| 125 | |||
| 72 | ;;; erc-scenarios-base-send-message.el ends here | 126 | ;;; erc-scenarios-base-send-message.el ends here |
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index 2898ca7be75..e7422d330c0 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el | |||
| @@ -2543,7 +2543,8 @@ | |||
| 2543 | (kill-buffer "#chan"))) | 2543 | (kill-buffer "#chan"))) |
| 2544 | 2544 | ||
| 2545 | (defconst erc-tests--modules | 2545 | (defconst erc-tests--modules |
| 2546 | '( autoaway autojoin bufbar button capab-identify completion dcc fill identd | 2546 | '( autoaway autojoin bufbar button capab-identify |
| 2547 | command-indicator completion dcc fill identd | ||
| 2547 | imenu irccontrols keep-place list log match menu move-to-prompt netsplit | 2548 | imenu irccontrols keep-place list log match menu move-to-prompt netsplit |
| 2548 | networks nickbar nicks noncommands notifications notify page readonly | 2549 | networks nickbar nicks noncommands notifications notify page readonly |
| 2549 | replace ring sasl scrolltobottom services smiley sound | 2550 | replace ring sasl scrolltobottom services smiley sound |