aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2019-05-26 20:17:38 -0400
committerNoam Postavsky2019-06-01 20:01:43 -0400
commit4541e31d9c522df3cef6e7ab939655f6f92e7fb4 (patch)
treea95f90b569905192e1280db0eb6f4541be4202ed
parentb9c0e3e8c01b5d6cd9b86e41c31e228bd6ba45cc (diff)
downloademacs-4541e31d9c522df3cef6e7ab939655f6f92e7fb4.tar.gz
emacs-4541e31d9c522df3cef6e7ab939655f6f92e7fb4.zip
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.
-rw-r--r--doc/misc/rcirc.texi7
-rw-r--r--lisp/net/rcirc.el17
2 files changed, 17 insertions, 7 deletions
diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi
index bbcd0ed4620..1482a14fad5 100644
--- a/doc/misc/rcirc.texi
+++ b/doc/misc/rcirc.texi
@@ -337,9 +337,10 @@ channel name and join that channel. (Also @code{/join #emacs}.)
337@cindex disconnect from a channel 337@cindex disconnect from a channel
338@cindex stop talking on a channel 338@cindex stop talking on a channel
339@cindex kill channel buffer 339@cindex kill channel buffer
340This leaves the current channel. You can optionally provide a reason 340This leaves the current channel. You can optionally provide a
341for parting. When you kill a channel buffer, you automatically part the 341different channel name and reason for parting. When you kill a
342corresponding channel. (Also @code{/part you are too weird!}.) 342channel buffer, you automatically part the corresponding channel.
343(Also @code{/part #emacs you are too weird!}.)
343 344
344@item C-c C-r 345@item C-c C-r
345@kindex C-c C-r 346@kindex C-c C-r
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."
2185 (read-string "Channel: ")))) 2185 (read-string "Channel: "))))
2186 (rcirc-send-string process (concat "INVITE " nick-channel))) 2186 (rcirc-send-string process (concat "INVITE " nick-channel)))
2187 2187
2188;; TODO: /part #channel reason, or consider removing #channel altogether
2189(defun-rcirc-command part (channel) 2188(defun-rcirc-command part (channel)
2190 "Part CHANNEL." 2189 "Part CHANNEL.
2190CHANNEL should be a string of the form \"#CHANNEL-NAME REASON\".
2191If omitted, CHANNEL-NAME defaults to TARGET, and REASON defaults
2192to `rcirc-id-string'."
2191 (interactive "sPart channel: ") 2193 (interactive "sPart channel: ")
2192 (let ((channel (if (> (length channel) 0) channel target))) 2194 (let ((channel (if (> (length channel) 0) channel target))
2193 (rcirc-send-string process (concat "PART " channel " :" rcirc-id-string)))) 2195 (msg rcirc-id-string))
2196 (when (string-match "\\`\\([&#+!]\\S-+\\)?\\s-*\\(.+\\)?\\'" channel)
2197 (when (match-beginning 2)
2198 (setq msg (match-string 2 channel)))
2199 (setq channel (if (match-beginning 1)
2200 (match-string 1 channel)
2201 target)))
2202 (rcirc-send-string process (concat "PART " channel " :" msg))))
2194 2203
2195(defun-rcirc-command quit (reason) 2204(defun-rcirc-command quit (reason)
2196 "Send a quit message to server with REASON." 2205 "Send a quit message to server with REASON."