aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2014-07-08 15:45:24 -0400
committerStefan Monnier2014-07-08 15:45:24 -0400
commit27e81f9f4e368176a3b17ceeadd2e0aa5dd9d1ed (patch)
tree4bcb8a5e285ae876b738e483274080bbebc58d3b
parentdff76c18cce008747c917a3e5f79d242338c7884 (diff)
downloademacs-27e81f9f4e368176a3b17ceeadd2e0aa5dd9d1ed.tar.gz
emacs-27e81f9f4e368176a3b17ceeadd2e0aa5dd9d1ed.zip
* lisp/erc/erc.el (erc-channel-receive-names): Reduce redundancy.
-rw-r--r--lisp/erc/ChangeLog4
-rw-r--r--lisp/erc/erc.el46
2 files changed, 26 insertions, 24 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 2e5d2772c58..58aa0387f19 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,7 @@
12014-07-08 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * erc.el (erc-channel-receive-names): Reduce redundancy.
4
12014-06-19 Kelvin White <kelvin.white77@gmail.com> 52014-06-19 Kelvin White <kelvin.white77@gmail.com>
2 6
3 * erc-backend.el: Handle user modes in relevant server responses 7 * erc-backend.el: Handle user modes in relevant server responses
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index d43be54de2b..3bd9ff3ce71 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2797,7 +2797,8 @@ VALUE is computed by evaluating the rest of LINE in Lisp."
2797 (concat "\n" (pp-to-string val)) 2797 (concat "\n" (pp-to-string val))
2798 (format " %S\n" val))))) 2798 (format " %S\n" val)))))
2799 (apropos-internal "^erc-" 'custom-variable-p)))) 2799 (apropos-internal "^erc-" 'custom-variable-p))))
2800 (current-buffer)) t) 2800 (current-buffer))
2801 t)
2801 (t nil))) 2802 (t nil)))
2802(defalias 'erc-cmd-VAR 'erc-cmd-SET) 2803(defalias 'erc-cmd-VAR 'erc-cmd-SET)
2803(defalias 'erc-cmd-VARIABLE 'erc-cmd-SET) 2804(defalias 'erc-cmd-VARIABLE 'erc-cmd-SET)
@@ -3874,7 +3875,8 @@ If FACE is non-nil, it will be used to propertize the prompt. If it is nil,
3874 (insert (read-from-minibuffer "Message: " 3875 (insert (read-from-minibuffer "Message: "
3875 (string (if (featurep 'xemacs) 3876 (string (if (featurep 'xemacs)
3876 last-command-char 3877 last-command-char
3877 last-command-event)) read-map)) 3878 last-command-event))
3879 read-map))
3878 (erc-send-current-line))) 3880 (erc-send-current-line)))
3879 3881
3880(defvar erc-action-history-list () 3882(defvar erc-action-history-list ()
@@ -4106,10 +4108,12 @@ E.g. \"Read error to Nick [user@some.host]: 110\" would be shortened to
4106 host (regexp-quote host)) 4108 host (regexp-quote host))
4107 (or (when (string-match (concat "^\\(Read error\\) to " 4109 (or (when (string-match (concat "^\\(Read error\\) to "
4108 nick "\\[" host "\\]: " 4110 nick "\\[" host "\\]: "
4109 "\\(.+\\)$") reason) 4111 "\\(.+\\)$")
4112 reason)
4110 (concat (match-string 1 reason) ": " (match-string 2 reason))) 4113 (concat (match-string 1 reason) ": " (match-string 2 reason)))
4111 (when (string-match (concat "^\\(Ping timeout\\) for " 4114 (when (string-match (concat "^\\(Ping timeout\\) for "
4112 nick "\\[" host "\\]$") reason) 4115 nick "\\[" host "\\]$")
4116 reason)
4113 (match-string 1 reason)) 4117 (match-string 1 reason))
4114 reason)) 4118 reason))
4115 4119
@@ -4226,7 +4230,8 @@ See also `erc-format-nick-function'."
4226 (let ((nick (erc-server-user-nickname user))) 4230 (let ((nick (erc-server-user-nickname user)))
4227 (concat (erc-propertize 4231 (concat (erc-propertize
4228 (erc-get-user-mode-prefix nick) 4232 (erc-get-user-mode-prefix nick)
4229 'face 'erc-nick-prefix-face) nick))) 4233 'face 'erc-nick-prefix-face)
4234 nick)))
4230 4235
4231(defun erc-get-user-mode-prefix (user) 4236(defun erc-get-user-mode-prefix (user)
4232 (when user 4237 (when user
@@ -4252,7 +4257,8 @@ also `erc-format-nick-function'."
4252 (let ((nick (erc-server-user-nickname user))) 4257 (let ((nick (erc-server-user-nickname user)))
4253 (concat (erc-propertize 4258 (concat (erc-propertize
4254 (erc-get-user-mode-prefix nick) 4259 (erc-get-user-mode-prefix nick)
4255 'face 'erc-nick-prefix-face) nick)))) 4260 'face 'erc-nick-prefix-face)
4261 nick))))
4256 4262
4257(defun erc-format-my-nick () 4263(defun erc-format-my-nick ()
4258 "Return the beginning of this user's message, correctly propertized." 4264 "Return the beginning of this user's message, correctly propertized."
@@ -4772,24 +4778,16 @@ channel."
4772 (let ((updatep t)) 4778 (let ((updatep t))
4773 (setq name item op 'off voice 'off halfop 'off admin 'off owner 'off) 4779 (setq name item op 'off voice 'off halfop 'off admin 'off owner 'off)
4774 (if (rassq (elt item 0) prefix) 4780 (if (rassq (elt item 0) prefix)
4775 (cond ((= (length item) 1) 4781 (if (= (length item) 1)
4776 (setq updatep nil)) 4782 (setq updatep nil)
4777 ((eq (elt item 0) voice-ch) 4783 (setq name (substring item 1))
4778 (setq name (substring item 1) 4784 (setf (pcase (aref item 0)
4779 voice 'on)) 4785 ((pred (eq voice-ch)) voice)
4780 ((eq (elt item 0) hop-ch) 4786 ((pred (eq hop-ch)) hop)
4781 (setq name (substring item 1) 4787 ((pred (eq op-ch)) op)
4782 halfop 'on)) 4788 ((pred (eq adm-ch)) adm)
4783 ((eq (elt item 0) op-ch) 4789 ((pred (eq own-ch)) own))
4784 (setq name (substring item 1) 4790 'on)))
4785 op 'on))
4786 ((eq (elt item 0) adm-ch)
4787 (setq name (substring item 1)
4788 admin 'on))
4789 ((eq (elt item 0) own-ch)
4790 (setq name (substring item 1)
4791 owner 'on))
4792 (t (setq name (substring item 1)))))
4793 (when updatep 4791 (when updatep
4794 (puthash (erc-downcase name) t 4792 (puthash (erc-downcase name) t
4795 erc-channel-new-member-names) 4793 erc-channel-new-member-names)