From: ShengHuo ZHU Date: Mon, 8 Nov 1999 04:11:07 +0000 (+0000) Subject: Agent and cache are happy with "...". X-Git-Url: http://cgit.sxemacs.org/?a=commitdiff_plain;h=0f6d7f28d160274833daba734c09b783b685c6fe;p=gnus Agent and cache are happy with "...". Remove backslash before dot. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6d72a4f17..3a4148c1d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +1999-11-07 22:56:46 Shenghuo ZHU + + * gnus-agent.el (gnus-agent-save-group-info): Remove backslash + before dot. + * gnus-util.el (gnus-write-active-file): Ditto. + +1999-11-07 22:31:10 Shenghuo ZHU + + * nnheader.el (nnheader-replace-duplicate-chars-in-string): New + function. + * gnus-cache.el (gnus-cache-file-name): Use it. + * gnus-agent.el (gnus-agent-group-path): Use it. + * nnmail.el (nnmail-group-pathname): Use it. + 1999-11-07 21:07:55 Shenghuo ZHU * gnus-start.el (gnus-active-to-gnus-format): Don't insert backslash diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el index 1b16f3d43..d35bf36f6 100644 --- a/lisp/gnus-agent.el +++ b/lisp/gnus-agent.el @@ -624,15 +624,23 @@ the actual number of articles toggled is returned." (concat "^" (regexp-quote group) " ") nil t) (gnus-delete-line)) (insert (format "%S %d %d y\n" (intern group) (cdr active) - (car active))))))) + (car active))) + (goto-char (point-max)) + (while (search-backward "\\." nil t) + (delete-char 1)))))) (defun gnus-agent-group-path (group) "Translate GROUP into a path." (if nnmail-use-long-file-names (gnus-group-real-name group) - (nnheader-replace-chars-in-string - (nnheader-translate-file-chars (gnus-group-real-name group)) - ?. ?/))) + (nnheader-translate-file-chars + (nnheader-replace-chars-in-string + (nnheader-replace-duplicate-chars-in-string + (nnheader-replace-chars-in-string + (gnus-group-real-name group) + ?/ ?_) + ?. ?_) + ?. ?/)))) diff --git a/lisp/gnus-cache.el b/lisp/gnus-cache.el index 30927d793..fcb8bb52a 100644 --- a/lisp/gnus-cache.el +++ b/lisp/gnus-cache.el @@ -412,7 +412,9 @@ Returns the list of articles removed." (nnheader-translate-file-chars (if (gnus-use-long-file-name 'not-cache) group - (let ((group (nnheader-replace-chars-in-string group ?/ ?_))) + (let ((group (nnheader-replace-duplicate-chars-in-string + (nnheader-replace-chars-in-string group ?/ ?_) + ?. ?_))) ;; Translate the first colon into a slash. (when (string-match ":" group) (aset group (match-beginning 0) ?/)) diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index fac744ca5..761e3b3de 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -953,7 +953,10 @@ ARG is passed to the first function." (or (cdr (symbol-value sym)) (car (symbol-value sym))) (car (symbol-value sym)))))) - hashtb))) + hashtb) + (goto-char (point-max)) + (while (search-backward "\\." nil t) + (delete-char 1)))) (provide 'gnus-util) diff --git a/lisp/nnheader.el b/lisp/nnheader.el index 19a655f61..c193ca1c3 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -676,6 +676,21 @@ without formatting." (setq idx (1+ idx))) string)) +(defun nnheader-replace-duplicate-chars-in-string (string from to) + "Replace characters in STRING from FROM to TO." + (let ((string (substring string 0)) ;Copy string. + (len (length string)) + (idx 0) prev i) + ;; Replace all occurrences of FROM with TO. + (while (< idx len) + (setq i (aref string idx)) + (when (and (eq prev from) (= i from)) + (aset string (1- idx) to) + (aset string idx to)) + (setq prev i) + (setq idx (1+ idx))) + string)) + (defun nnheader-file-to-group (file &optional top) "Return a group name based on FILE and TOP." (nnheader-replace-chars-in-string diff --git a/lisp/nnmail.el b/lisp/nnmail.el index 73057c2ff..88ccb1eee 100644 --- a/lisp/nnmail.el +++ b/lisp/nnmail.el @@ -463,6 +463,9 @@ parameter. It should return nil, `warn' or `delete'." "Make pathname for GROUP." (concat (let ((dir (file-name-as-directory (expand-file-name dir)))) + (setq group (nnheader-replace-duplicate-chars-in-string + (nnheader-replace-chars-in-string group ?/ ?_) + ?. ?_)) (setq group (nnheader-translate-file-chars group)) ;; If this directory exists, we use it directly. (if (or nnmail-use-long-file-names