summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-agent.el
diff options
context:
space:
mode:
authorEric Abrahamsen <eric@ericabrahamsen.net>2018-11-16 12:53:56 -0800
committerEric Abrahamsen <eric@ericabrahamsen.net>2019-08-03 14:52:56 -0700
commitcb12a84f2c519a48dd87453c925e3bc36d9944db (patch)
tree69d5c1c16b8ba0bd2c23fccb2b5b642f7228f818 /lisp/gnus/gnus-agent.el
parentc6b4eed80ae3529ada01ca6a5ef5d5b196e97bde (diff)
downloademacs-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-agent.el')
-rw-r--r--lisp/gnus/gnus-agent.el58
1 files changed, 21 insertions, 37 deletions
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el
index 40d0d246056..d9c9e940700 100644
--- a/lisp/gnus/gnus-agent.el
+++ b/lisp/gnus/gnus-agent.el
@@ -229,7 +229,7 @@ NOTES:
"Cache of message subjects for spam messages.
Actually a hash table holding subjects mapped to t.")
(defvar gnus-agent-file-name nil)
-(defvar gnus-agent-file-coding-system 'raw-text)
+(defvar gnus-agent-file-coding-system 'utf-8-emacs)
(defvar gnus-agent-file-loading-cache nil)
(defvar gnus-agent-total-fetched-hashtb nil)
(defvar gnus-agent-inhibit-update-total-fetched-for nil)
@@ -406,8 +406,6 @@ manipulated as follows:
(defun gnus-agent-read-group ()
"Read a group name in the minibuffer, with completion."
(let ((def (or (gnus-group-group-name) gnus-newsgroup-name)))
- (when def
- (setq def (gnus-group-decoded-name def)))
(gnus-group-completing-read nil nil t nil nil def)))
;;; Fetching setup functions.
@@ -1330,7 +1328,10 @@ downloaded into the agent."
(gnus-make-directory (file-name-directory file))
(with-temp-file file
;; Emacs got problem to match non-ASCII group in multibyte buffer.
- (mm-disable-multibyte)
+
+ ;; FIXME: Is this still an issue now that group names are
+ ;; always strings?
+ ;(mm-disable-multibyte)
(when (file-exists-p file)
(nnheader-insert-file-contents file)
@@ -1360,7 +1361,7 @@ downloaded into the agent."
(gnus-make-directory (file-name-directory file))
(with-temp-buffer
;; Emacs got problem to match non-ASCII group in multibyte buffer.
- (mm-disable-multibyte)
+ ;(mm-disable-multibyte)
(when (file-exists-p file)
(nnheader-insert-file-contents file)
@@ -1372,18 +1373,6 @@ downloaded into the agent."
oactive-min (read (current-buffer))) ;; min
(cons oactive-min oactive-max))))))))
-(defvar gnus-agent-decoded-group-names nil
- "Alist of non-ASCII group names and decoded ones.")
-
-(defun gnus-agent-decoded-group-name (group)
- "Return a decoded group name of GROUP."
- (or (cdr (assoc group gnus-agent-decoded-group-names))
- (if (string-match "[^\000-\177]" group)
- (let ((decoded (gnus-group-decoded-name group)))
- (push (cons group decoded) gnus-agent-decoded-group-names)
- decoded)
- group)))
-
(defun gnus-agent-group-path (group)
"Translate GROUP into a file name."
@@ -1395,7 +1384,7 @@ downloaded into the agent."
(nnheader-translate-file-chars
(nnheader-replace-duplicate-chars-in-string
(nnheader-replace-chars-in-string
- (gnus-group-real-name (gnus-agent-decoded-group-name group))
+ (gnus-group-real-name group)
?/ ?_)
?. ?_)))
(if (or nnmail-use-long-file-names
@@ -1409,7 +1398,7 @@ downloaded into the agent."
;; unplugged. The agent must, therefore, use the same directory
;; while plugged.
(nnmail-group-pathname
- (gnus-group-real-name (gnus-agent-decoded-group-name group))
+ (gnus-group-real-name group)
(if gnus-command-method
(gnus-agent-directory)
(let ((gnus-command-method (gnus-find-method-for-group group)))
@@ -1437,7 +1426,7 @@ downloaded into the agent."
(format " *Gnus agent %s history*"
(gnus-agent-method)))))
gnus-agent-history-buffers)
- (mm-disable-multibyte) ;; everything is binary
+ ;(mm-disable-multibyte) ;; everything is binary
(erase-buffer)
(insert "\n")
(let ((file (gnus-agent-lib-file "history")))
@@ -1525,8 +1514,7 @@ downloaded into the agent."
(setq selected-sets (nreverse selected-sets))
(gnus-make-directory dir)
- (gnus-message 7 "Fetching articles for %s..."
- (gnus-agent-decoded-group-name group))
+ (gnus-message 7 "Fetching articles for %s..." group)
(unwind-protect
(while (setq articles (pop selected-sets))
@@ -1537,8 +1525,7 @@ downloaded into the agent."
(let (article)
(while (setq article (pop articles))
(gnus-message 10 "Fetching article %s for %s..."
- article
- (gnus-agent-decoded-group-name group))
+ article group)
(when (or
(gnus-backlog-request-article group article
nntp-server-buffer)
@@ -1875,8 +1862,7 @@ article numbers will be returned."
(with-current-buffer nntp-server-buffer
(if articles
(progn
- (gnus-message 8 "Fetching headers for %s..."
- (gnus-agent-decoded-group-name group))
+ (gnus-message 8 "Fetching headers for %s..." group)
;; Fetch them.
(gnus-make-directory (nnheader-translate-file-chars
@@ -3058,8 +3044,7 @@ FORCE is equivalent to setting the expiration predicates to true."
;; provided a non-nil active
(let ((dir (gnus-agent-group-pathname group))
- (file-name-coding-system nnmail-pathname-coding-system)
- (decoded (gnus-agent-decoded-group-name group)))
+ (file-name-coding-system nnmail-pathname-coding-system))
(gnus-agent-with-refreshed-group
group
(when (boundp 'gnus-agent-expire-current-dirs)
@@ -3068,8 +3053,8 @@ FORCE is equivalent to setting the expiration predicates to true."
(if (and (not force)
(eq 'DISABLE (gnus-agent-find-parameter group
'agent-enable-expiration)))
- (gnus-message 5 "Expiry skipping over %s" decoded)
- (gnus-message 5 "Expiring articles in %s" decoded)
+ (gnus-message 5 "Expiry skipping over %s" group)
+ (gnus-message 5 "Expiring articles in %s" group)
(gnus-agent-load-alist group)
(let* ((bytes-freed 0)
(size-files-deleted 0.0)
@@ -3293,7 +3278,7 @@ line." (point) nov-file)))
(keep
(gnus-agent-message 10
"gnus-agent-expire: %s:%d: Kept %s article%s."
- decoded article-number keep (if fetch-date " and file" ""))
+ group article-number keep (if fetch-date " and file" ""))
(when fetch-date
(unless (file-exists-p
(concat dir (number-to-string
@@ -3301,7 +3286,7 @@ line." (point) nov-file)))
(setf (nth 1 entry) nil)
(gnus-agent-message 3 "gnus-agent-expire cleared \
download flag on %s:%d as the cached article file is missing."
- decoded (caar dlist)))
+ group (caar dlist)))
(unless marker
(gnus-message 1 "gnus-agent-expire detected a \
missing NOV entry. Run gnus-agent-regenerate-group to restore it.")))
@@ -3379,12 +3364,12 @@ article alist" type) actions))
(when actions
(gnus-agent-message 8 "gnus-agent-expire: %s:%d: %s"
- decoded article-number
+ group article-number
(mapconcat #'identity actions ", ")))))
(t
(gnus-agent-message
10 "gnus-agent-expire: %s:%d: Article kept as \
-expiration tests failed." decoded article-number)
+expiration tests failed." group article-number)
(gnus-agent-append-to-list
tail-alist (cons article-number fetch-date)))
)
@@ -3835,7 +3820,7 @@ If REREAD is not nil, downloaded articles are marked as unread."
(sit-for 1)
t)))))
(when group
- (gnus-message 5 "Regenerating in %s" (gnus-agent-decoded-group-name group))
+ (gnus-message 5 "Regenerating in %s" group)
(let* ((gnus-command-method (or gnus-command-method
(gnus-find-method-for-group group)))
(file (gnus-agent-article-name ".overview" group))
@@ -3912,8 +3897,7 @@ If REREAD is not nil, downloaded articles are marked as unread."
(> (car downloaded) (car nov-arts))))
;; This entry is missing from the overview file
(gnus-message 3 "Regenerating NOV %s %d..."
- (gnus-agent-decoded-group-name group)
- (car downloaded))
+ group (car downloaded))
(let ((file (concat dir (number-to-string (car downloaded)))))
(mm-with-unibyte-buffer
(nnheader-insert-file-contents file)