Commit 8e5cfb97 authored by Eric Abrahamsen's avatar Eric Abrahamsen

WIP on removing all internal encoding/decoding

parent 2ea55c27
......@@ -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)
......@@ -1327,7 +1327,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)
......@@ -1357,7 +1360,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)
......@@ -1434,7 +1437,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")))
......
......@@ -388,7 +388,7 @@ category."))
:tag "topic parameters"
"(gnus)Topic Parameters"))
(widget-insert " for <")
(widget-insert (gnus-group-decoded-name (or group topic)))
(widget-insert (or group topic))
(widget-insert "> and press ")
(widget-create 'push-button
:tag "done"
......@@ -837,8 +837,7 @@ When called interactively, FILE defaults to the current score file.
This can be changed using the `\\[gnus-score-change-score-file]' command."
(interactive (list gnus-current-score-file))
(unless file
(error "No score file for %s"
(gnus-group-decoded-name gnus-newsgroup-name)))
(error "No score file for %s" gnus-newsgroup-name))
(let ((scores (gnus-score-load file))
(types (mapcar (lambda (entry)
`(group :format "%v%h\n"
......
......@@ -479,7 +479,6 @@ simple manner."
(defvar gnus-tmp-news-method)
(defvar gnus-tmp-colon)
(defvar gnus-tmp-news-server)
(defvar gnus-tmp-decoded-group)
(defvar gnus-tmp-header)
(defvar gnus-tmp-process-marked)
(defvar gnus-tmp-summary-live)
......@@ -518,14 +517,9 @@ simple manner."
(?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d)
(?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
(gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) ?d)
(?g (if (boundp 'gnus-tmp-decoded-group)
gnus-tmp-decoded-group
gnus-tmp-group)
?s)
(?g gnus-tmp-group ?s)
(?G gnus-tmp-qualified-group ?s)
(?c (gnus-short-group-name (if (boundp 'gnus-tmp-decoded-group)
gnus-tmp-decoded-group
gnus-tmp-group))
(?c (gnus-short-group-name gnus-tmp-group)
?s)
(?C gnus-tmp-comment ?s)
(?D gnus-tmp-newsgroup-description ?s)
......@@ -1398,8 +1392,7 @@ if it is a string, only list groups matching REGEXP."
((functionp regexp) (funcall regexp group))))
(add-text-properties
(point) (prog1 (1+ (point))
(insert " " mark " *: "
(gnus-group-decoded-name group)
(insert " " mark " *: " group
"\n"))
(list 'gnus-group group
'gnus-unread t
......@@ -1508,8 +1501,6 @@ if it is a string, only list groups matching REGEXP."
"Insert a group line in the group buffer."
(let* ((gnus-tmp-method
(gnus-server-get-method gnus-tmp-group gnus-tmp-method))
(group-name-charset (gnus-group-name-charset gnus-tmp-method
gnus-tmp-group))
(gnus-tmp-active (gnus-active gnus-tmp-group))
(gnus-tmp-number-total
(if gnus-tmp-active
......@@ -1528,16 +1519,13 @@ if it is a string, only list groups matching REGEXP."
((= gnus-tmp-level gnus-level-zombie) ?Z)
(t ?K)))
(gnus-tmp-qualified-group
(gnus-group-name-decode (gnus-group-real-name gnus-tmp-group)
group-name-charset))
(gnus-group-real-name gnus-tmp-group))
(gnus-tmp-comment
(or (gnus-group-get-parameter gnus-tmp-group 'comment t)
gnus-tmp-group))
(gnus-tmp-newsgroup-description
(if gnus-description-hashtb
(or (gnus-group-name-decode
(gethash gnus-tmp-group gnus-description-hashtb)
group-name-charset) "")
(or (gethash gnus-tmp-group gnus-description-hashtb) "")
""))
(gnus-tmp-moderated
(if (and gnus-moderated-hashtb
......@@ -1574,9 +1562,7 @@ if it is a string, only list groups matching REGEXP."
(point)
(prog1 (1+ (point))
;; Insert the text.
(let ((gnus-tmp-decoded-group (gnus-group-name-decode
gnus-tmp-group group-name-charset)))
(eval gnus-group-line-format-spec)))
(eval gnus-group-line-format-spec))
`(gnus-group ,gnus-tmp-group
gnus-unread ,(if (numberp number)
(string-to-number gnus-tmp-number-of-unread)
......@@ -2166,6 +2152,9 @@ Non-ASCII group names are allowed. The arguments are the same as
`gnus-active-hashtb' and `gnus-group-history' respectively if
they are omitted. Can handle COLLECTION as a list, hash table,
or vector."
;; This function is a little more complicated for backwards
;; compatibility. In theory, `collection' will only ever be a list
;; or a hash table, and the group names will all be fully decoded.
(or collection (setq collection gnus-active-hashtb))
(let* ((choices
(mapcar
......@@ -2726,13 +2715,13 @@ The user will be prompted for GROUP."
(interactive (list (gnus-group-completing-read)))
(gnus-group-make-group (gnus-group-real-name group)
(gnus-group-server group)
nil nil t))
nil nil))
(defun gnus-group-make-group (name &optional method address args encoded)
(defun gnus-group-make-group (name &optional method address args)
"Add a new newsgroup.
The user will be prompted for a NAME, for a select METHOD, and an
ADDRESS. NAME should be a human-readable string (i.e., not be encoded
even if it contains non-ASCII characters) unless ENCODED is non-nil.
even if it contains non-ASCII characters).
If the backend supports it, the group will also be created on the
server."
......@@ -2743,10 +2732,6 @@ server."
(when (stringp method)
(setq method (or (gnus-server-to-method method) method)))
(unless encoded
(setq name (encode-coding-string
name
(gnus-group-name-charset method name))))
(let* ((meth (gnus-method-simplify
(when (and method
(not (gnus-server-equal method gnus-select-method)))
......@@ -2755,7 +2740,7 @@ server."
(nname (if method (gnus-group-prefixed-name name meth) name))
backend info)
(when (gnus-group-entry nname)
(error "Group %s already exists" (gnus-group-decoded-name nname)))
(error "Group %s already exists" nname))
;; Subscribe to the new group.
(gnus-group-change-level
(setq info (list t nname gnus-level-default-subscribed nil nil meth))
......@@ -3076,8 +3061,7 @@ If called with a prefix argument, ask for the file type."
(coding (gnus-group-name-charset method name)))
(setcar (cdr method) (encode-coding-string file coding))
(gnus-group-make-group
(encode-coding-string (gnus-group-real-name name) coding)
method nil nil t)))
(gnus-group-real-name name) method nil nil)))
(defvar nnweb-type-definition)
(defvar gnus-group-web-type-history nil)
......@@ -4458,9 +4442,9 @@ and the second element is the address."
(prin1-to-string (car method)))
(and (consp method)
(nth 1 (gnus-info-method info)))
nil t)
nil)
;; It's a native group.
(gnus-group-make-group (gnus-info-group info) nil nil nil t)))
(gnus-group-make-group (gnus-info-group info) nil nil nil)))
(gnus-message 6 "Note: New group created")
(setq entry
(gnus-group-entry (gnus-group-prefixed-name
......
......@@ -859,12 +859,7 @@ claim them."
((= level gnus-level-zombie) ?Z)
(t ?K)))
(max 0 (- (1+ (cddr group)) (cadr group)))
;; Don't decode if name is ASCII
(if (eq (detect-coding-string name t) 'undecided)
name
(decode-coding-string
name
(inline (gnus-group-name-charset method name)))))))
name)))
(list 'gnus-group name)
)))
(switch-to-buffer (current-buffer)))
......
......@@ -1834,17 +1834,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 "[^\000-\177]" (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
......@@ -2150,9 +2155,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)))
......@@ -2918,10 +2921,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))
......
This diff is collapsed.
......@@ -1175,16 +1175,10 @@ ARG is passed to the first function."
(throw 'found nil)))
t))
;; gnus.el requires mm-util.
(declare-function mm-disable-multibyte "mm-util")
(defun gnus-write-active-file (file hashtb &optional full-names)
;; `coding-system-for-write' should be `raw-text' or equivalent.
(let ((coding-system-for-write nnmail-active-file-coding-system))
(with-temp-file file
;; The buffer should be in the unibyte mode because group names
;; are ASCII text or encoded non-ASCII text (i.e., unibyte).
(mm-disable-multibyte)
(insert (format ";; -*- encoding: %s; -*-\n\n" coding-system-for-write))
(maphash
(lambda (group active)
(when active
......
......@@ -3455,11 +3455,9 @@ server is native)."
"Return the prefix of the current group name."
(< 0 (length (gnus-group-real-prefix group))))
(declare-function gnus-group-decoded-name "gnus-group" (string))
(defun gnus-summary-buffer-name (group)
"Return the summary buffer name of GROUP."
(concat "*Summary " (gnus-group-decoded-name group) "*"))
(concat "*Summary " group "*"))
(defun gnus-group-method (group)
"Return the server or method used for selecting GROUP.
......
......@@ -117,18 +117,17 @@
(gnus-request-accept-article "nndraft:queue" nil t t))
(deffoo nnagent-request-set-mark (group action server)
(mm-with-unibyte-buffer
(insert "(gnus-agent-synchronize-group-flags \""
group
"\" '")
(gnus-pp action)
(insert " \""
(gnus-method-to-server gnus-command-method)
"\"")
(insert ")\n")
(let ((coding-system-for-write nnheader-file-coding-system))
(write-region (point-min) (point-max) (gnus-agent-lib-file "flags")
t 'silent)))
(insert "(gnus-agent-synchronize-group-flags \""
group
"\" '")
(gnus-pp action)
(insert " \""
(gnus-method-to-server gnus-command-method)
"\"")
(insert ")\n")
(let ((coding-system-for-write nnheader-file-coding-system))
(write-region (point-min) (point-max) (gnus-agent-lib-file "flags")
t 'silent))
;; Also set the marks for the original back end that keeps marks in
;; the local system.
(let ((gnus-agent nil))
......
......@@ -30,7 +30,6 @@
(defvar nnmail-extra-headers)
(defvar gnus-newsgroup-name)
(defvar nnheader-file-coding-system)
(defvar jka-compr-compression-info-list)
;; Requiring `gnus-util' at compile time creates a circular
......@@ -566,7 +565,8 @@ the line could be found."
(defvar nntp-server-buffer nil)
(defvar nntp-process-response nil)
(defvar nnheader-file-coding-system 'undecided
"Coding system used in file backends of Gnus.")
(defvar nnheader-callback-function nil)
(defun nnheader-init-server-buffer ()
......@@ -938,9 +938,6 @@ first. Otherwise, find the newest one, though it may take a time."
(when (string-match (car ange-ftp-path-format) path)
(ange-ftp-re-read-dir path)))))
(defvar nnheader-file-coding-system 'raw-text
"Coding system used in file backends of Gnus.")
(defun nnheader-insert-file-contents (filename &optional visit beg end replace)
"Like `insert-file-contents', q.v., but only reads in the file.
A buffer may be modified in several ways after reading into the buffer due
......
......@@ -119,12 +119,6 @@ some servers.")
(defvoo nnimap-namespace nil)
(defun nnimap-decode-gnus-group (group)
(decode-coding-string group 'utf-8))
(defun nnimap-encode-gnus-group (group)
(encode-coding-string group 'utf-8))
(defvoo nnimap-fetch-partial-articles nil
"If non-nil, Gnus will fetch partial articles.
If t, Gnus will fetch only the first part. If a string, it
......@@ -209,8 +203,6 @@ textual parts.")
(format "%s" (nreverse params))))
(deffoo nnimap-retrieve-headers (articles &optional group server _fetch-old)
(when group
(setq group (nnimap-decode-gnus-group group)))
(with-current-buffer nntp-server-buffer
(erase-buffer)
(when (nnimap-change-group group server)
......@@ -630,8 +622,6 @@ textual parts.")
nnimap-status-string)
(deffoo nnimap-request-article (article &optional group server to-buffer)
(when group
(setq group (nnimap-decode-gnus-group group)))
(with-current-buffer nntp-server-buffer
(let ((result (nnimap-change-group group server))
parts structure)
......@@ -663,8 +653,6 @@ textual parts.")
(cons group article)))))))
(deffoo nnimap-request-head (article &optional group server to-buffer)
(when group
(setq group (nnimap-decode-gnus-group group)))
(when (nnimap-change-group group server)
(with-current-buffer (nnimap-buffer)
(when (stringp article)
......@@ -682,8 +670,6 @@ textual parts.")
(cons group article)))))))
(deffoo nnimap-request-articles (articles &optional group server)
(when group
(setq group (nnimap-decode-gnus-group group)))
(with-current-buffer nntp-server-buffer
(let ((result (nnimap-change-group group server)))
(when result
......@@ -833,7 +819,6 @@ textual parts.")
(nreverse parts)))
(deffoo nnimap-request-group (group &optional server dont-check info)
(setq group (nnimap-decode-gnus-group group))
(let ((result (nnimap-change-group
;; Don't SELECT the group if we're going to select it
;; later, anyway.
......@@ -860,11 +845,10 @@ textual parts.")
(- (cdr active) (car active))
(car active)
(cdr active)
(nnimap-encode-gnus-group group)))
group))
t))))
(deffoo nnimap-request-group-scan (group &optional server info)
(setq group (nnimap-decode-gnus-group group))
(when (nnimap-change-group nil server)
(let (marks high low)
(with-current-buffer (nnimap-buffer)
......@@ -896,23 +880,20 @@ textual parts.")
(insert
(format
"211 %d %d %d %S\n" (1+ (- high low)) low high
(nnimap-encode-gnus-group group)))
group))
t))))
(deffoo nnimap-request-create-group (group &optional server _args)
(setq group (nnimap-decode-gnus-group group))
(when (nnimap-change-group nil server)
(with-current-buffer (nnimap-buffer)
(car (nnimap-command "CREATE %S" (nnimap-group-to-imap group))))))
(deffoo nnimap-request-delete-group (group &optional _force server)
(setq group (nnimap-decode-gnus-group group))
(when (nnimap-change-group nil server)
(with-current-buffer (nnimap-buffer)
(car (nnimap-command "DELETE %S" (nnimap-group-to-imap group))))))
(deffoo nnimap-request-rename-group (group new-name &optional server)
(setq group (nnimap-decode-gnus-group group))
(when (nnimap-change-group nil server)
(with-current-buffer (nnimap-buffer)
(nnimap-unselect-group)
......@@ -927,7 +908,6 @@ textual parts.")
(nnimap-command "EXAMINE DOES.NOT.EXIST"))
(deffoo nnimap-request-expunge-group (group &optional server)
(setq group (nnimap-decode-gnus-group group))
(when (nnimap-change-group group server)
(with-current-buffer (nnimap-buffer)
(car (nnimap-command "EXPUNGE")))))
......@@ -956,9 +936,6 @@ textual parts.")
(deffoo nnimap-request-move-article (article group server accept-form
&optional _last
internal-move-group)
(setq group (nnimap-decode-gnus-group group))
(when internal-move-group
(setq internal-move-group (nnimap-decode-gnus-group internal-move-group)))
(with-temp-buffer
(mm-disable-multibyte)
(when (funcall (if internal-move-group
......@@ -992,7 +969,6 @@ textual parts.")
result))))))
(deffoo nnimap-request-expire-articles (articles group &optional server force)
(setq group (nnimap-decode-gnus-group group))
(cond
((null articles)
nil)
......@@ -1141,8 +1117,6 @@ If LIMIT, first try to limit the search to the N last articles."
"delete this article now"))))))
(deffoo nnimap-request-scan (&optional group server)
(when group
(setq group (nnimap-decode-gnus-group group)))
(when (and (nnimap-change-group nil server)
nnimap-inbox
nnimap-split-methods)
......@@ -1161,7 +1135,6 @@ If LIMIT, first try to limit the search to the N last articles."
flags))
(deffoo nnimap-request-update-group-status (group status &optional server)
(setq group (nnimap-decode-gnus-group group))
(when (nnimap-change-group nil server)
(let ((command (assoc
status
......@@ -1172,7 +1145,6 @@ If LIMIT, first try to limit the search to the N last articles."
(nnimap-command "%s %S" (cadr command) (nnimap-group-to-imap group)))))))
(deffoo nnimap-request-set-mark (group actions &optional server)
(setq group (nnimap-decode-gnus-group group))
(when (nnimap-change-group group server)
(let (sequence)
(with-current-buffer (nnimap-buffer)
......@@ -1207,8 +1179,7 @@ If LIMIT, first try to limit the search to the N last articles."
;; that's determined by the IMAP server later. So just
;; return the group name.
(lambda (group)
(list (list group)))))))
(setq group (nnimap-decode-gnus-group group))
(list (list group)))))))
(when (nnimap-change-group nil server)
(nnmail-check-syntax)
(let ((message-id (message-field-value "message-id"))
......@@ -1286,7 +1257,6 @@ If LIMIT, first try to limit the search to the N last articles."
result))
(deffoo nnimap-request-replace-article (article group buffer)
(setq group (nnimap-decode-gnus-group group))
(let (group-art)
(when (and (nnimap-change-group group)
;; Put the article into the group.
......@@ -1370,8 +1340,7 @@ If LIMIT, first try to limit the search to the N last articles."
(dolist (response responses)
(let* ((sequence (car response))
(response (cadr response))
(group (cadr (assoc sequence sequences)))
(egroup (nnimap-encode-gnus-group group)))
(group (cadr (assoc sequence sequences))))
(when (and group
(equal (caar response) "OK"))
(let ((uidnext (nnimap-find-parameter "UIDNEXT" response))
......@@ -1383,14 +1352,14 @@ If LIMIT, first try to limit the search to the N last articles."
(setq highest (1- (string-to-number (car uidnext)))))
(cond
((null highest)
(insert (format "%S 0 1 y\n" egroup)))
(insert (format "%S 0 1 y\n" group)))
((zerop exists)
;; Empty group.
(insert (format "%S %d %d y\n" egroup
(insert (format "%S %d %d y\n" group
highest (1+ highest))))
(t
;; Return the widest possible range.
(insert (format "%S %d 1 y\n" egroup
(insert (format "%S %d 1 y\n" group
(or highest exists)))))))))
t)))))
......@@ -1402,7 +1371,7 @@ If LIMIT, first try to limit the search to the N last articles."
(nnimap-get-groups)))
(unless (assoc group nnimap-current-infos)
;; Insert dummy numbers here -- they don't matter.
(insert (format "%S 0 1 y\n" (nnimap-encode-gnus-group group)))))
(insert (format "%S 0 1 y\n" group))))
t)))
(deffoo nnimap-retrieve-group-data-early (server infos)
......@@ -1419,8 +1388,7 @@ If LIMIT, first try to limit the search to the N last articles."
;; what and how to request the data.
(dolist (info infos)
(setq params (gnus-info-params info)
group (nnimap-decode-gnus-group
(gnus-group-real-name (gnus-info-group info)))
group (gnus-group-real-name (gnus-info-group info))
active (cdr (assq 'active params))
unexist (assq 'unexist (gnus-info-marks info))
uidvalidity (cdr (assq 'uidvalidity params))
......@@ -1501,16 +1469,13 @@ If LIMIT, first try to limit the search to the N last articles."
(active (gnus-active group)))
(when active
(insert (format "%S %d %d y\n"
(nnimap-encode-gnus-group
(nnimap-decode-gnus-group
(gnus-group-real-name group)))
(gnus-group-real-name group)
(cdr active)
(car active))))))))))))
(defun nnimap-update-infos (flags infos)
(dolist (info infos)
(let* ((group (nnimap-decode-gnus-group
(gnus-group-real-name (gnus-info-group info))))
(let* ((group (gnus-group-real-name (gnus-info-group info)))
(marks (cdr (assoc group flags))))
(when marks
(nnimap-update-info info marks)))))
......@@ -1723,8 +1688,7 @@ If LIMIT, first try to limit the search to the N last articles."
(nreverse result))))
(defun nnimap-store-info (info active)
(let* ((group (nnimap-decode-gnus-group
(gnus-group-real-name (gnus-info-group info))))
(let* ((group (gnus-group-real-name (gnus-info-group info)))
(entry (assoc group nnimap-current-infos)))
(if entry
(setcdr entry (list info active))
......@@ -1851,8 +1815,6 @@ If LIMIT, first try to limit the search to the N last articles."
(autoload 'nnir-search-thread "nnir")
(deffoo nnimap-request-thread (header &optional group server)
(when group
(setq group (nnimap-decode-gnus-group group)))
(if gnus-refer-thread-use-nnir
(nnir-search-thread header)
(when (nnimap-change-group group server)
......
......@@ -595,7 +595,7 @@ using different case (i.e. mailing-list@domain vs Mailing-List@Domain)."
(defun nnmail-request-post (&optional server)
(mail-send-and-exit nil))
(defvar nnmail-file-coding-system 'raw-text
(defvar nnmail-file-coding-system 'undecided
"Coding system used in nnmail.")
(defvar nnmail-incoming-coding-system
......@@ -661,9 +661,12 @@ nn*-request-list should have been called before calling this function."
(condition-case err
(progn
(narrow-to-region (point) (point-at-eol))
(setq group (read buffer))
(unless (stringp group)
(setq group (encode-coding-string (symbol-name group) 'latin-1)))
(setq group (read buffer)
group
(cond ((symbolp group)
(symbol-name group))
((numberp group)
(number-to-string group))))
(if (and (numberp (setq max (read buffer)))
(numberp (setq min (read buffer))))
(push (list group (cons min max))
......@@ -673,7 +676,7 @@ nn*-request-list should have been called before calling this function."
(forward-line 1))
group-assoc))
(defcustom nnmail-active-file-coding-system 'raw-text
(defcustom nnmail-active-file-coding-system 'undecided
"Coding system for active file."
:group 'nnmail-various
:type 'coding-system)
......@@ -683,7 +686,7 @@ nn*-request-list should have been called before calling this function."
(let ((coding-system-for-write nnmail-active-file-coding-system))
(when file-name
(with-temp-file file-name
(mm-disable-multibyte)
; (mm-disable-multibyte)
(nnmail-generate-active group-assoc)))))
(defun nnmail-generate-active (alist)
......@@ -691,7 +694,7 @@ nn*-request-list should have been called before calling this function."
(erase-buffer)
(let (group)
(while (setq group (pop alist))
(insert (format "%S %d %d y\n" (intern (car group)) (cdadr group)
(insert (format "%s %d %d y\n" (car group) (cdadr group)
(caadr group))))
(goto-char (point-max))
(while (search-backward "\\." nil t)
......@@ -1023,7 +1026,7 @@ If SOURCE is a directory spec, try to return the group name component."
(nnmail-check-duplication message-id func artnum-func))
1))
(defvar nnmail-group-names-not-encoded-p nil
(defvar nnmail-group-names-not-encoded-p t
"Non-nil means group names are not encoded.")
(defun nnmail-split-incoming (incoming func &optional exit-func
......@@ -1044,6 +1047,10 @@ will be copied over from that buffer."
(erase-buffer)
(if (bufferp incoming)
(insert-buffer-substring incoming)
;; The following coding system is set to
;; `mm-text-coding-system', which is set to some flavor of
;; 'raw-text "to get rid of ^Ms". But it's going to do a lot
;; more than that, right? Shouldn't this also be 'undecided?
(let ((coding-system-for-read nnmail-incoming-coding-system))
(mm-insert-file-contents incoming)))
(prog1
......
......@@ -419,7 +419,7 @@ This variable is set by `nnmaildir-request-article'.")
(t (signal (car err) (cdr err)))))))))
(defun nnmaildir--update-nov (server group article)
(let ((nnheader-file-coding-system 'binary)
(let ((nnheader-file-coding-system 'undecided)
(srv-dir (nnmaildir--srv-dir server))
(storage-version 1) ;; [version article-number msgid [...nov...]]
dir gname pgname msgdir prefix suffix file attr mtime novdir novfile
......
......@@ -740,9 +740,9 @@ article number. This function is called narrowed to an article."
(defun nnml-active-number (group &optional server)
"Compute the next article number in GROUP on SERVER."
(let* ((encoded (if nnmail-group-names-not-encoded-p
(nnml-encoded-group-name group server)))
(active (cadr (assoc-string (or encoded group) nnml-group-alist))))
;; FIXME: This originally checked `nnml-group-names-not-encoded-p'
;; and maybe encoded the group name.
(let ((active (cadr (assoc-string group nnml-group-alist))))
;; The group wasn't known to nnml, so we just create an active
;; entry for it.
(unless active
......@@ -760,7 +760,7 @@ article number. This function is called narrowed to an article."
(cons (caar nnml-article-file-alist)
(caar (last nnml-article-file-alist)))
(cons 1 0)))
(push (list (or encoded group) active) nnml-group-alist))
(push (list group active) nnml-group-alist))
(setcdr active (1+ (cdr active)))
(while (file-exists-p
(nnml-group-pathname group (int-to-string (cdr active)) server))
......@@ -910,7 +910,7 @@ Unless no-active is non-nil, update the active file too."
;; Update the active info for this group.
(let ((group (directory-file-name dir))
entry last)
(setq group (nnheader-file-to-group (nnml-encoded-group-name group)
(setq group (nnheader-file-to-group group
nnml-directory)
entry (assoc group nnml-group-alist)
last (or (caadr entry) 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment