From 28517cf23b5ed65f8a421dddcffec6a0aecd7fe5 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Thu, 9 Mar 2023 06:28:53 -0800 Subject: [PATCH 0/3] *** NOT A PATCH *** *** BLURB HERE *** F. Jason Park (3): [5.6] Replace Info-goto-node with info in erc-button-alist [5.6] Add erc-button helper for substituting command keys [5.6] Allow erc-button-add-face to take an object lisp/erc/erc-button.el | 172 +++++++++++++++++++++++++++++++++---- lisp/erc/erc-networks.el | 22 ++--- test/lisp/erc/erc-tests.el | 56 ++++++++++++ 3 files changed, 220 insertions(+), 30 deletions(-) Interdiff: diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index 49e3caf49a1..c94a412eea8 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -134,7 +134,7 @@ erc-button-alist ("[`‘]\\([a-zA-Z][-a-zA-Z_0-9!*<=>+]+\\)['’]" 1 t erc-button-describe-symbol 1) ;; pseudo links - ("\\bInfo:[\"]\\([^\"]+\\)[\"]" 0 t info 1) + ("\\(?:\\bInfo: ?\\|(info \\)[\"]\\(([^\"]+\\)[\"])?" 0 t info 1) ("\\b\\(Ward\\|Wiki\\|WardsWiki\\|TheWiki\\):\\([A-Z][a-z]+\\([A-Z][a-z]+\\)+\\)" 0 t (lambda (page) (browse-url (concat "http://c2.com/cgi-bin/wiki?" page))) @@ -600,25 +600,39 @@ erc-button--substitute-command-keys-in-region (insert s)) (cons beg (point))) -(defun erc-button--display-error-notice-with-keys (parsed &rest strings) - "Add help keys to STRINGS for corner-case admonishments. -Return inserted result." +;;;###autoload +(defun erc-button--display-error-notice-with-keys (&optional parsed buffer + &rest strings) + "Add help keys to STRINGS for configuration-related admonishments. +Return inserted result. PARSED can be an `erc-response' object, +a string, or nil. BUFFER can be a buffer, a string, or nil. As +a special case, PARSED can also be a buffer as long as BUFFER is +a string or nil." + (when (stringp buffer) + (push buffer strings) + (setq buffer nil)) (when (stringp parsed) (push parsed strings) (setq parsed nil)) + (when (bufferp parsed) + (cl-assert (null buffer)) + (setq buffer parsed + parsed nil)) (let* ((string (apply #'concat strings)) (erc-insert-post-hook (cons (lambda () - (setq string (buffer-substring (point-min) (1- (point-max))))) + (setq string (buffer-substring (point-min) + (1- (point-max))))) erc-insert-post-hook)) (erc-button-alist `((,(rx "\\[" (group (+ (not "]"))) "]") 0 erc-button--substitute-command-keys-in-region erc-button-describe-symbol 1) ,@erc-button-alist))) - (erc-display-error-notice parsed string) + (erc-display-message parsed '(notice error) (or buffer 'active) string) string)) +;;;###autoload (defun erc-button--display-error-notice-with-keys-and-warn (&rest args) "Like `erc-button--display-error-notice-with-keys' but also warn." (let ((string (apply #'erc-button--display-error-notice-with-keys args))) -- 2.39.2