[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r102258: Decode utf-8 strings in mixe
From: |
Lars Magne Ingebrigtsen |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r102258: Decode utf-8 strings in mixed environments by default. |
Date: |
Fri, 05 Nov 2010 15:17:46 +0100 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 102258
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Fri 2010-11-05 15:17:46 +0100
message:
Decode utf-8 strings in mixed environments by default.
Done via the new `erc-coding-system-precedence' variable.
modified:
etc/NEWS
lisp/erc/ChangeLog
lisp/erc/erc-backend.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2010-11-03 19:53:47 +0000
+++ b/etc/NEWS 2010-11-05 14:17:46 +0000
@@ -303,6 +303,11 @@
seconds. The default value, 'ident, means to autojoin immediately
after connecting.
+*** New variable `erc-coding-system-precedence': If we use `undecided'
+as the server coding system, this variable will then be consulted.
+The default is to decode strings that can be decoded as utf-8 as
+utf-8, and do the normal `undecided' decoding for the rest.
+
** In ido-mode, C-v is no longer bound to ido-toggle-vc.
The reason is that this interferes with cua-mode.
=== modified file 'lisp/erc/ChangeLog'
--- a/lisp/erc/ChangeLog 2010-10-25 00:04:44 +0000
+++ b/lisp/erc/ChangeLog 2010-11-05 14:17:46 +0000
@@ -1,3 +1,8 @@
+2010-11-05 Lars Magne Ingebrigtsen <address@hidden>
+
+ * erc-backend.el (erc-coding-system-precedence): New variable.
+ (erc-decode-string-from-target): Use it.
+
2010-10-24 Julien Danjou <address@hidden>
* erc-backend.el (erc-server-JOIN): Set the correct target list on join.
=== modified file 'lisp/erc/erc-backend.el'
--- a/lisp/erc/erc-backend.el 2010-10-24 21:36:09 +0000
+++ b/lisp/erc/erc-backend.el 2010-11-05 14:17:46 +0000
@@ -324,6 +324,13 @@
:type 'integer
:group 'erc-server)
+(defcustom erc-coding-system-precedence '(utf-8 undecided)
+ "List of coding systems to be preferred when receiving a string from the
server.
+This will only be consulted if the coding system in
+`erc-server-coding-system' is `undecided'."
+ :group 'erc-server
+ :type '(repeat coding-system))
+
(defcustom erc-server-coding-system (if (and (fboundp 'coding-system-p)
(coding-system-p 'undecided)
(coding-system-p 'utf-8))
@@ -334,7 +341,9 @@
If a cons, the encoding system for outgoing text is in the car
and the decoding system for incoming text is in the cdr. The most
-interesting use for this is to put `undecided' in the cdr.
+interesting use for this is to put `undecided' in the cdr. This
+means that `erc-coding-system-precedence' will be consulted, and the
+first match there will be used.
If a function, it is called with the argument `target' and should
return a coding system or a cons as described above.
@@ -705,6 +714,14 @@
(let ((coding (erc-coding-system-for-target target)))
(when (consp coding)
(setq coding (cdr coding)))
+ (when (eq coding 'undecided)
+ (let ((codings (detect-coding-string str))
+ (precedence erc-coding-system-precedence))
+ (while (and precedence
+ (not (memq (car precedence) codings)))
+ (pop precedence))
+ (when precedence
+ (setq coding (car precedence)))))
(erc-decode-coding-string str coding)))
;; proposed name, not used by anything yet
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r102258: Decode utf-8 strings in mixed environments by default.,
Lars Magne Ingebrigtsen <=