diff options
author | Eric Abrahamsen <eric@ericabrahamsen.net> | 2018-11-16 12:53:56 -0800 |
---|---|---|
committer | Eric Abrahamsen <eric@ericabrahamsen.net> | 2019-08-03 14:52:56 -0700 |
commit | cb12a84f2c519a48dd87453c925e3bc36d9944db (patch) | |
tree | 69d5c1c16b8ba0bd2c23fccb2b5b642f7228f818 /lisp/gnus/gnus-start.el | |
parent | c6b4eed80ae3529ada01ca6a5ef5d5b196e97bde (diff) | |
download | emacs-cb12a84f2c519a48dd87453c925e3bc36d9944db.tar.gz |
Remove Gnus group name encoding/decoding
This completes the process started in c1b63af445. Gnus group names are
now fully decoded inside the Gnus system.
* lisp/gnus/gnus-agent.el (gnus-agent-file-coding-system): Change
default to utf-8-emacs.
(gnus-agent-decoded-group-names, gnus-agent-decoded-group-name):
Remove variable and function. Remove all usage in this file.
* lisp/gnus/gnus-cache.el (gnus-cache-decoded-group-names,
gnus-cache-unified-group-names, gnus-cache-decoded-group-name):
Remove these variables and function. Remove all usage in this file.
* lisp/gnus/gnus-group.el (gnus-tmp-decoded-group): Remove this
variable, gnus-tmp-group is now decoded.
(gnus-group-completing-read): Don't encode or decode group names
here.
(gnus-group-make-group): Remove ENCODED argument.
* lisp/gnus/gnus-srvr.el (gnus-browse-foreign-server): Decode group
names here.
* lisp/gnus/gnus-start.el (gnus-make-hashtable-from-newsrc-alist):
check for encoded group names and decode.
(gnus-active-to-gnus-format): Make sure incoming group names are
decoded.
(gnus-read-newsrc-el-file): Check for encoded group names in
gnus-topic-alist.
* lisp/gnus/nnagent.el: Don't use a unibyte buffer.
* lisp/gnus/nnheader.el (nnheader-file-coding-system): Switch default
from 'raw-text to 'undecided, on the assumption that 'undecided will
probably write 'utf-8-emacs unless the user has arranged things
otherwise.
* lisp/gnus/nnimap.el (nnimap-decode-gnus-group,
nnimap-encode-gnus-group): Remove functions and their use.
* lisp/gnus/nnmail.el (nnmail-parse-active): Remove encoding.
(nnmail-active-file-coding-system): Default to 'utf-8-emacs instead
of 'raw-text.
(nnmail-group-names-not-encoded-p): Obsolete this variable; stop
using it.
* lisp/gnus/gnus-art.el:
* lisp/gnus/gnus-cus.el:
* lisp/gnus/gnus-msg.el:
* lisp/gnus/gnus-start.el:
* lisp/gnus/gnus-sum.el:
* lisp/gnus/gnus.el:
* lisp/gnus/nnml.el:
* lisp/gnus/message.el:
* lisp/gnus/nnrss.el: Stop using gnus-group-decoded-name in all these
files.
Diffstat (limited to 'lisp/gnus/gnus-start.el')
-rw-r--r-- | lisp/gnus/gnus-start.el | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 0f91c4d9b4e..f7ede54b105 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -35,6 +35,7 @@ (autoload 'gnus-agent-read-servers-validate "gnus-agent") (autoload 'gnus-agent-save-local "gnus-agent") (autoload 'gnus-agent-possibly-alter-active "gnus-agent") +(declare-function gnus-group-decoded-name "gnus-group" (string)) (eval-when-compile (require 'cl-lib)) @@ -1828,17 +1829,22 @@ The info element is shared with the same element of (if (setq rest (member method methods)) (gnus-info-set-method info (car rest)) (push method methods))) + ;; Check for encoded group names and decode them. + (when (string-match-p "[^[:ascii:]]" (setq gname (car info))) + (let ((decoded (gnus-group-decoded-name gname))) + (setf gname decoded + (car info) decoded))) ;; Check for duplicates. - (if (gethash (car info) gnus-newsrc-hashtb) + (if (gethash gname gnus-newsrc-hashtb) ;; Remove this entry from the alist. (setcdr alist (cddr alist)) (puthash - (car info) + gname ;; Preserve number of unread articles in groups. - (list (and ohashtb (car (gethash (car info) ohashtb))) + (list (and ohashtb (car (gethash gname ohashtb))) info) gnus-newsrc-hashtb) - (push (car info) gnus-group-list)) + (push gname gnus-group-list)) (setq alist (cdr alist))) (setq gnus-group-list (nreverse gnus-group-list)) ;; Make the same select-methods in `gnus-server-alist' identical @@ -2144,9 +2150,7 @@ The info element is shared with the same element of (cond ((numberp group) (number-to-string group)) ((symbolp group) - (encode-coding-string - (symbol-name group) - 'latin-1)) + (symbol-name group)) ((stringp group) group))))) (numberp (setq max (read cur))) @@ -2155,7 +2159,11 @@ The info element is shared with the same element of (skip-chars-forward " \t") (memq (char-after) '(?= ?x ?j))))) - (progn (puthash group (cons min max) hashtb) + (progn (when (string-match-p "[^[:ascii:]]" group) + ;; NNTP servers may give us encoded group + ;; names. + (setq group (gnus-group-decoded-name group))) + (puthash group (cons min max) hashtb) ;; If group is moderated, stick it in the ;; moderation cache. (when (eq (char-after) ?m) @@ -2394,6 +2402,17 @@ If FORCE is non-nil, the .newsrc file is read." (when gnus-newsrc-assoc (setq gnus-newsrc-alist gnus-newsrc-assoc)))) (gnus-make-hashtable-from-newsrc-alist) + (when gnus-topic-alist + (setq gnus-topic-alist + (mapcar + (lambda (elt) + (cons (car elt) + (mapcar (lambda (g) + (if (string-match-p "[^[:ascii:]]" g) + (gnus-group-decoded-name g) + g)) + (cdr elt)))) + gnus-topic-alist))) (when (file-newer-than-file-p file ding-file) ;; Old format quick file (gnus-message 5 "Reading %s..." file) @@ -2492,7 +2511,9 @@ If FORCE is non-nil, the .newsrc file is read." (read buf)) group (if (numberp group) (number-to-string group) - (symbol-name group))) + ;; newsrc files are written as 'raw-text. + (decode-coding-string + (symbol-name group) 'raw-text))) (widen) (cond ;; It's possible that "group" is actually an options line. @@ -2911,10 +2932,6 @@ SPECIFIC-VARIABLES, or those in `gnus-variable-list'." (setq default-directory (file-name-directory buffer-file-name)) (buffer-disable-undo) (erase-buffer) - ;; Use a unibyte buffer since group names are unibyte strings; - ;; in particular, non-ASCII group names are the ones encoded by - ;; a certain coding system. - (mm-disable-multibyte) ;; Write options. (when gnus-newsrc-options (insert gnus-newsrc-options)) |