aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2014-04-04 13:26:23 -0400
committerStefan Monnier2014-04-04 13:26:23 -0400
commit1f0e1785ee2235ec04042a2ac86d5248a615d706 (patch)
tree1e974d6c53d3cf10ce2b0d29e726eed3211222d9
parent0de7d982ca1a9baab47c8a272230660b6ddb729b (diff)
downloademacs-1f0e1785ee2235ec04042a2ac86d5248a615d706.tar.gz
emacs-1f0e1785ee2235ec04042a2ac86d5248a615d706.zip
* lisp/erc/erc.el (erc-invite-only-mode, erc-toggle-channel-mode): Simplify.
(erc-load-script): Tighten a regexp.
-rw-r--r--lisp/erc/ChangeLog5
-rw-r--r--lisp/erc/erc.el30
2 files changed, 19 insertions, 16 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 6d99fdf73d9..defa6f93e71 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,8 @@
12014-04-04 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * erc.el (erc-invite-only-mode, erc-toggle-channel-mode): Simplify.
4 (erc-load-script): Tighten a regexp.
5
12014-02-25 Julien Danjou <julien@danjou.info> 62014-02-25 Julien Danjou <julien@danjou.info>
2 7
3 * erc-networks.el (erc-determine-network): Check that NETWORK as a 8 * erc-networks.el (erc-determine-network): Check that NETWORK as a
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index d93e9e02156..dbbc37e1eb7 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -5542,12 +5542,11 @@ This command is sent even if excess flood is detected."
5542 (interactive "P") 5542 (interactive "P")
5543 (erc-set-active-buffer (current-buffer)) 5543 (erc-set-active-buffer (current-buffer))
5544 (let ((tgt (erc-default-target))) 5544 (let ((tgt (erc-default-target)))
5545 (cond ((or (not tgt) (not (erc-channel-p tgt))) 5545 (if (or (not tgt) (not (erc-channel-p tgt)))
5546 (erc-display-message nil 'error (current-buffer) 'no-target)) 5546 (erc-display-message nil 'error (current-buffer) 'no-target)
5547 (arg (erc-load-irc-script-lines (list (concat "/mode " tgt " -i")) 5547 (erc-load-irc-script-lines
5548 t)) 5548 (list (concat "/mode " tgt (if arg " -i" " +i")))
5549 (t (erc-load-irc-script-lines (list (concat "/mode " tgt " +i")) 5549 t))))
5550 t)))))
5551 5550
5552(defun erc-get-channel-mode-from-keypress (key) 5551(defun erc-get-channel-mode-from-keypress (key)
5553 "Read a key sequence and call the corresponding channel mode function. 5552 "Read a key sequence and call the corresponding channel mode function.
@@ -5579,15 +5578,14 @@ If CHANNEL is non-nil, toggle MODE for that channel, otherwise use
5579 (interactive "P") 5578 (interactive "P")
5580 (erc-set-active-buffer (current-buffer)) 5579 (erc-set-active-buffer (current-buffer))
5581 (let ((tgt (or channel (erc-default-target)))) 5580 (let ((tgt (or channel (erc-default-target))))
5582 (cond ((or (null tgt) (null (erc-channel-p tgt))) 5581 (if (or (null tgt) (null (erc-channel-p tgt)))
5583 (erc-display-message nil 'error 'active 'no-target)) 5582 (erc-display-message nil 'error 'active 'no-target)
5584 ((member mode erc-channel-modes) 5583 (let* ((active (member mode erc-channel-modes))
5585 (erc-log (format "%s: Toggle mode %s OFF" tgt mode)) 5584 (newstate (if active "OFF" "ON")))
5586 (message "Toggle channel mode %s OFF" mode) 5585 (erc-log (format "%s: Toggle mode %s %s" tgt mode newstate))
5587 (erc-server-send (format "MODE %s -%s" tgt mode))) 5586 (message "Toggle channel mode %s %s" mode newstate)
5588 (t (erc-log (format "%s: Toggle channel mode %s ON" tgt mode)) 5587 (erc-server-send (format "MODE %s %s%s"
5589 (message "Toggle channel mode %s ON" mode) 5588 tgt (if active "-" "+") mode))))))
5590 (erc-server-send (format "MODE %s +%s" tgt mode))))))
5591 5589
5592(defun erc-insert-mode-command () 5590(defun erc-insert-mode-command ()
5593 "Insert the line \"/mode <current target> \" at `point'." 5591 "Insert the line \"/mode <current target> \" at `point'."
@@ -5650,7 +5648,7 @@ as an Emacs Lisp program. Otherwise, treat it as a regular IRC
5650script." 5648script."
5651 (erc-log (concat "erc-load-script: " file)) 5649 (erc-log (concat "erc-load-script: " file))
5652 (cond 5650 (cond
5653 ((string-match "\\.el$" file) 5651 ((string-match "\\.el\\'" file)
5654 (load file)) 5652 (load file))
5655 (t 5653 (t
5656 (erc-load-irc-script file)))) 5654 (erc-load-irc-script file))))