]> git.eshelyaron.com Git - emacs.git/commitdiff
Make gnus cache work with group names having '/'
authorJames Thomas <james.thomas@ahimsa.global>
Thu, 14 Mar 2024 03:12:00 +0000 (08:42 +0530)
committerEshel Yaron <me@eshelyaron.com>
Sun, 31 Mar 2024 18:05:21 +0000 (20:05 +0200)
Make `gnus-cache-file-name` use the existing
`nnmail-group-pathname`.

* lisp/gnus/gnus-cache.el (gnus-cache-file-name)
(gnus-cache-update-article):
* lisp/gnus/nnmail.el (nnmail-group-pathname):

(cherry picked from commit 0df8dadde2edaee406c76d639a22c70d0b03426b)

lisp/gnus/gnus-cache.el
lisp/gnus/nnmail.el

index 961219eee8f4c4d022c44c530e5ccc8434fad91d..7af02368d3659a66215432a7185ab019fb71ac8a 100644 (file)
@@ -443,23 +443,9 @@ Returns the list of articles removed."
       (and (not unread) (not ticked) (not dormant) (memq 'read class))))
 
 (defun gnus-cache-file-name (group article)
-  (expand-file-name
-   (if (stringp article) article (int-to-string article))
-   (file-name-as-directory
-    (expand-file-name
-     (nnheader-translate-file-chars
-      (if (gnus-use-long-file-name 'not-cache)
-         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)
-                 (setq group (concat (substring group 0 (match-beginning 0))
-                                     "/" (substring group (match-end 0)))))
-         (nnheader-replace-chars-in-string group ?. ?/)))
-      t)
-     gnus-cache-directory))))
+  (nnmail-group-pathname
+   group gnus-cache-directory
+   (if (stringp article) article (int-to-string article))))
 
 (defun gnus-cache-update-article (group article)
   "If ARTICLE is in the cache, remove it and re-enter it."
@@ -699,9 +685,10 @@ If LOW, update the lower bound instead."
                          (file-name-as-directory
                           (expand-file-name gnus-cache-directory))))
             (directory-file-name directory))
-           (nnheader-replace-chars-in-string
-            (substring (directory-file-name directory) (match-end 0))
-            ?/ ?.)))
+           (url-unhex-string
+             (nnheader-replace-chars-in-string
+             (substring (directory-file-name directory) (match-end 0))
+             ?/ ?.))))
         nums alphs)
     (when top
       (gnus-message 5 "Generating the cache active file...")
index fef12eebe09806e20252b08d5f223dbc0e5ea674..a9f5b89c6febb4f5ed3dc6384dc53a2343da1d33 100644 (file)
@@ -33,6 +33,7 @@
 (require 'mail-source)
 (require 'mm-util)
 (require 'gnus-int)
+(require 'browse-url)
 
 (autoload 'mail-send-and-exit "sendmail" nil t)
 
@@ -627,7 +628,7 @@ These will be logged to the \"*nnmail split*\" buffer."
   (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 ?/ ?_)
+                 (browse-url-url-encode-chars group "[/%]")
                  ?. ?_))
      (setq group (nnheader-translate-file-chars group))
      ;; If this directory exists, we use it directly.