emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 0df8dadde2e 1/2: Make gnus cache work with group names having '/'


From: Eric Abrahamsen
Subject: master 0df8dadde2e 1/2: Make gnus cache work with group names having '/'
Date: Sat, 30 Mar 2024 18:19:58 -0400 (EDT)

branch: master
commit 0df8dadde2edaee406c76d639a22c70d0b03426b
Author: James Thomas <james.thomas@ahimsa.global>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    Make gnus cache work with group names having '/'
    
    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):
---
 lisp/gnus/gnus-cache.el | 27 +++++++--------------------
 lisp/gnus/nnmail.el     |  3 ++-
 2 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el
index 961219eee8f..7af02368d36 100644
--- a/lisp/gnus/gnus-cache.el
+++ b/lisp/gnus/gnus-cache.el
@@ -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...")
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index fef12eebe09..a9f5b89c6fe 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]