aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2010-11-05 15:17:46 +0100
committerLars Magne Ingebrigtsen2010-11-05 15:17:46 +0100
commit5c0c0f77b0b3af28653a6a8e798f69d132425c0e (patch)
tree6c484c9782fc9a92497fc9674fb2b6f4bf56adb1
parente06918d22b68821e7c1aa8148622232f106fbfc5 (diff)
downloademacs-5c0c0f77b0b3af28653a6a8e798f69d132425c0e.tar.gz
emacs-5c0c0f77b0b3af28653a6a8e798f69d132425c0e.zip
Decode utf-8 strings in mixed environments by default.
Done via the new `erc-coding-system-precedence' variable.
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/erc/ChangeLog5
-rw-r--r--lisp/erc/erc-backend.el19
3 files changed, 28 insertions, 1 deletions
diff --git a/etc/NEWS b/etc/NEWS
index b0f6a76cc2f..2acca998e3a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -303,6 +303,11 @@ successful NickServ identification, or after `erc-autojoin-delay'
303seconds. The default value, 'ident, means to autojoin immediately 303seconds. The default value, 'ident, means to autojoin immediately
304after connecting. 304after connecting.
305 305
306*** New variable `erc-coding-system-precedence': If we use `undecided'
307as the server coding system, this variable will then be consulted.
308The default is to decode strings that can be decoded as utf-8 as
309utf-8, and do the normal `undecided' decoding for the rest.
310
306** In ido-mode, C-v is no longer bound to ido-toggle-vc. 311** In ido-mode, C-v is no longer bound to ido-toggle-vc.
307The reason is that this interferes with cua-mode. 312The reason is that this interferes with cua-mode.
308 313
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 49f039c51b9..1f27dbdb7f7 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,8 @@
12010-11-05 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * erc-backend.el (erc-coding-system-precedence): New variable.
4 (erc-decode-string-from-target): Use it.
5
12010-10-24 Julien Danjou <julien@danjou.info> 62010-10-24 Julien Danjou <julien@danjou.info>
2 7
3 * erc-backend.el (erc-server-JOIN): Set the correct target list on join. 8 * erc-backend.el (erc-server-JOIN): Set the correct target list on join.
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 46e9d6c8c2c..3bc56989f4f 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -324,6 +324,13 @@ Good luck."
324 :type 'integer 324 :type 'integer
325 :group 'erc-server) 325 :group 'erc-server)
326 326
327(defcustom erc-coding-system-precedence '(utf-8 undecided)
328 "List of coding systems to be preferred when receiving a string from the server.
329This will only be consulted if the coding system in
330`erc-server-coding-system' is `undecided'."
331 :group 'erc-server
332 :type '(repeat coding-system))
333
327(defcustom erc-server-coding-system (if (and (fboundp 'coding-system-p) 334(defcustom erc-server-coding-system (if (and (fboundp 'coding-system-p)
328 (coding-system-p 'undecided) 335 (coding-system-p 'undecided)
329 (coding-system-p 'utf-8)) 336 (coding-system-p 'utf-8))
@@ -334,7 +341,9 @@ This is either a coding system, a cons, a function, or nil.
334 341
335If a cons, the encoding system for outgoing text is in the car 342If a cons, the encoding system for outgoing text is in the car
336and the decoding system for incoming text is in the cdr. The most 343and the decoding system for incoming text is in the cdr. The most
337interesting use for this is to put `undecided' in the cdr. 344interesting use for this is to put `undecided' in the cdr. This
345means that `erc-coding-system-precedence' will be consulted, and the
346first match there will be used.
338 347
339If a function, it is called with the argument `target' and should 348If a function, it is called with the argument `target' and should
340return a coding system or a cons as described above. 349return a coding system or a cons as described above.
@@ -705,6 +714,14 @@ This is indicated by `erc-encoding-coding-alist', defaulting to the value of
705 (let ((coding (erc-coding-system-for-target target))) 714 (let ((coding (erc-coding-system-for-target target)))
706 (when (consp coding) 715 (when (consp coding)
707 (setq coding (cdr coding))) 716 (setq coding (cdr coding)))
717 (when (eq coding 'undecided)
718 (let ((codings (detect-coding-string str))
719 (precedence erc-coding-system-precedence))
720 (while (and precedence
721 (not (memq (car precedence) codings)))
722 (pop precedence))
723 (when precedence
724 (setq coding (car precedence)))))
708 (erc-decode-coding-string str coding))) 725 (erc-decode-coding-string str coding)))
709 726
710;; proposed name, not used by anything yet 727;; proposed name, not used by anything yet