]> git.eshelyaron.com Git - emacs.git/commitdiff
Add subcommand erc-cmd-HELP handler to erc-dcc
authorF. Jason Park <jp@neverwas.me>
Sat, 25 Mar 2023 16:13:40 +0000 (09:13 -0700)
committerF. Jason Park <jp@neverwas.me>
Sat, 8 Apr 2023 21:23:50 +0000 (14:23 -0700)
* lisp/erc/erc-compat.el (erc-compat--28-split-string-shell-command,
erc-compat--split-string-shell-command): New functions introduced in
Emacs 28 for splitting pcomplete input.
* lisp/erc/erc-dcc.el (erc-cmd-DCC): Elect to tokenize line specially.
(erc-dcc--cmd-help): Add help handler.  (Bug#62444.)

lisp/erc/erc-compat.el
lisp/erc/erc-dcc.el

index 5601ede27a510f4c264eaf3298db56adad9f6d1a..e6ae62d3a2eea3f16adfbd50abd8e8dc8d022830 100644 (file)
@@ -409,6 +409,28 @@ If START or END is negative, it counts from the end."
                  (cons '("\\`irc6?s?://" . erc-compat--29-browse-url-irc)
                        existing))))))
 
+
+;;;; Misc 28.1
+
+(defvar comint-file-name-quote-list)
+(defvar shell-file-name-quote-list)
+(declare-function shell--parse-pcomplete-arguments "shell" nil)
+
+(defun erc-compat--28-split-string-shell-command (string)
+  (require 'comint)
+  (require 'shell)
+  (with-temp-buffer
+    (insert string)
+    (let ((comint-file-name-quote-list shell-file-name-quote-list))
+      (car (shell--parse-pcomplete-arguments)))))
+
+(defmacro erc-compat--split-string-shell-command (string)
+  ;; Autoloaded in Emacs 28.
+  (list (if (fboundp 'split-string-shell-command)
+            'split-string-shell-command
+          'erc-compat--28-split-string-shell-command)
+        string))
+
 (provide 'erc-compat)
 
 ;;; erc-compat.el ends here
index 4c557e0e0f9cadca3fc35d24b0b1dba3129ae0e9..70683a92ffcd27704cb5e10387f14b2e355a3939 100644 (file)
@@ -404,8 +404,16 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
         (apropos "erc-dcc-do-.*-command")
         t))))
 
+(put 'erc-cmd-DCC 'do-not-parse-args t)
 (autoload 'pcomplete-erc-all-nicks "erc-pcomplete")
 
+;;;###autoload(put 'erc-cmd-DCC 'erc--cmd-help 'erc-dcc--cmd-help)
+(defun erc-dcc--cmd-help (&rest args)
+  (describe-function
+   (or (and args (intern-soft (concat "erc-dcc-do-"
+                                      (upcase (car args)) "-command")))
+       'erc-cmd-DCC)))
+
 ;;;###autoload
 (defun pcomplete/erc-mode/DCC ()
   "Provide completion for the /DCC command."