emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2d3ae5d5e68 03/37: Add subcommand erc-cmd-HELP handler to erc-dcc


From: F. Jason Park
Subject: master 2d3ae5d5e68 03/37: Add subcommand erc-cmd-HELP handler to erc-dcc
Date: Sat, 8 Apr 2023 17:31:27 -0400 (EDT)

branch: master
commit 2d3ae5d5e68a21e51105168b1d9503f28e9e98c3
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>

    Add subcommand erc-cmd-HELP handler to erc-dcc
    
    * 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 | 22 ++++++++++++++++++++++
 lisp/erc/erc-dcc.el    |  8 ++++++++
 2 files changed, 30 insertions(+)

diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el
index 5601ede27a5..e6ae62d3a2e 100644
--- a/lisp/erc/erc-compat.el
+++ b/lisp/erc/erc-compat.el
@@ -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
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 4c557e0e0f9..70683a92ffc 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]