diff options
author | Noam Postavsky <npostavs@gmail.com> | 2019-05-26 20:17:38 -0400 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2019-06-01 20:01:43 -0400 |
commit | 4541e31d9c522df3cef6e7ab939655f6f92e7fb4 (patch) | |
tree | a95f90b569905192e1280db0eb6f4541be4202ed /lisp/net | |
parent | b9c0e3e8c01b5d6cd9b86e41c31e228bd6ba45cc (diff) | |
download | emacs-4541e31d9c522df3cef6e7ab939655f6f92e7fb4.tar.gz |
Handle argument to rcirc /part properly (Bug#11157)
* lisp/net/rcirc.el (part): Split out channel name and part reason.
* doc/misc/rcirc.texi (rcirc commands): Clarify that channel name may
be provided to /part.
Diffstat (limited to 'lisp/net')
-rw-r--r-- | lisp/net/rcirc.el | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 50cab7bd160..b317f002ee9 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2185,12 +2185,21 @@ CHANNELS is a comma- or space-separated string of channel names." (read-string "Channel: ")))) (rcirc-send-string process (concat "INVITE " nick-channel))) -;; TODO: /part #channel reason, or consider removing #channel altogether (defun-rcirc-command part (channel) - "Part CHANNEL." + "Part CHANNEL. +CHANNEL should be a string of the form \"#CHANNEL-NAME REASON\". +If omitted, CHANNEL-NAME defaults to TARGET, and REASON defaults +to `rcirc-id-string'." (interactive "sPart channel: ") - (let ((channel (if (> (length channel) 0) channel target))) - (rcirc-send-string process (concat "PART " channel " :" rcirc-id-string)))) + (let ((channel (if (> (length channel) 0) channel target)) + (msg rcirc-id-string)) + (when (string-match "\\`\\([&#+!]\\S-+\\)?\\s-*\\(.+\\)?\\'" channel) + (when (match-beginning 2) + (setq msg (match-string 2 channel))) + (setq channel (if (match-beginning 1) + (match-string 1 channel) + target))) + (rcirc-send-string process (concat "PART " channel " :" msg)))) (defun-rcirc-command quit (reason) "Send a quit message to server with REASON." |