aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Abrahamsen2019-06-21 13:35:27 -0700
committerEric Abrahamsen2019-06-21 13:35:27 -0700
commit5563d1cd829e6c17d22c18e345101feaf736312a (patch)
treeb618184fbe66020a637142eb96d5f9060d4e02a9
parentcf804c86724248fc68c3adf74cad56c590e56194 (diff)
downloademacs-scratch/gnus-decoded.tar.gz
emacs-scratch/gnus-decoded.zip
Remove all remaining uses of gnus-group-decoded-namescratch/gnus-decoded
* lisp/gnus/gnus-art.el (gnus-article-setup-buffer): * lisp/gnus/nnrss.el (nnrss-retrieve-groups): * lisp/gnus/message.el (message-forward-subject-author-subject): (message-forward-subject-name-subject): * lisp/gnus/gnus-msg.el (gnus-inews-insert-gcc): (gnus-inews-make-draft): * lisp/gnus/gnus-group.el (gnus-group-compact-group): (gnus-group-list-active): (gnus-group-kill-group): (gnus-group-set-current-level): (gnus-group-expire-articles-1): (gnus-group-catchup-current): (gnus-group-edit-group): (gnus-group-rename-group): (gnus-group-delete-group): (gnus-group-name-at-point): Remove calls in all these places, group names are always decoded. * lisp/gnus/gnus-cache.el: Remove variables gnus-cache-unified-group-names and gnus-cache-decoded-group-names, and function gnus-cache-decoded-group-name. (gnus-cache-generate-active): Do not access gnus-cache-unified-group-names. (gnus-cache-file-name): Don't decode.
-rw-r--r--lisp/gnus/gnus-art.el4
-rw-r--r--lisp/gnus/gnus-cache.el41
-rw-r--r--lisp/gnus/gnus-group.el126
-rw-r--r--lisp/gnus/gnus-msg.el3
-rw-r--r--lisp/gnus/message.el19
-rw-r--r--lisp/gnus/nnrss.el2
6 files changed, 70 insertions, 125 deletions
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index baa8a244c07..7a8b1b82715 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -4496,9 +4496,7 @@ commands:
4496(defun gnus-article-setup-buffer () 4496(defun gnus-article-setup-buffer ()
4497 "Initialize the article buffer." 4497 "Initialize the article buffer."
4498 (let* ((name (if gnus-single-article-buffer "*Article*" 4498 (let* ((name (if gnus-single-article-buffer "*Article*"
4499 (concat "*Article " 4499 (concat "*Article " gnus-newsgroup-name "*")))
4500 (gnus-group-decoded-name gnus-newsgroup-name)
4501 "*")))
4502 (original 4500 (original
4503 (progn (string-match "\\*Article" name) 4501 (progn (string-match "\\*Article" name)
4504 (concat " *Original Article" 4502 (concat " *Original Article"
diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el
index 5e6483d1053..14d5d4aaebd 100644
--- a/lisp/gnus/gnus-cache.el
+++ b/lisp/gnus/gnus-cache.el
@@ -430,41 +430,7 @@ Returns the list of articles removed."
430 (and unread (memq 'unread class)) 430 (and unread (memq 'unread class))
431 (and (not unread) (not ticked) (not dormant) (memq 'read class)))) 431 (and (not unread) (not ticked) (not dormant) (memq 'read class))))
432 432
433(defvar gnus-cache-decoded-group-names nil
434 "Alist of original group names and decoded group names.
435Decoding is done according to `gnus-group-name-charset-method-alist'
436or `gnus-group-name-charset-group-alist'.")
437
438(defvar gnus-cache-unified-group-names nil
439 "Alist of unified decoded group names and original group names.
440A group name is decoded according to
441`gnus-group-name-charset-method-alist' or
442`gnus-group-name-charset-group-alist' first, and is encoded and
443decoded again according to `nnmail-pathname-coding-system',
444`file-name-coding-system', or `default-file-name-coding-system'.
445
446It is used when asking for an original group name from a cache
447directory name, in which non-ASCII characters might have been unified
448into the ones of a certain charset particularly if the `utf-8' coding
449system for example was used.")
450
451(defun gnus-cache-decoded-group-name (group)
452 "Return a decoded group name of GROUP."
453 (or (cdr (assoc group gnus-cache-decoded-group-names))
454 (let ((decoded (gnus-group-decoded-name group))
455 (coding (or nnmail-pathname-coding-system
456 file-name-coding-system
457 default-file-name-coding-system)))
458 (push (cons group decoded) gnus-cache-decoded-group-names)
459 (push (cons (decode-coding-string
460 (encode-coding-string decoded coding)
461 coding)
462 group)
463 gnus-cache-unified-group-names)
464 decoded)))
465
466(defun gnus-cache-file-name (group article) 433(defun gnus-cache-file-name (group article)
467 (setq group (gnus-cache-decoded-group-name group))
468 (expand-file-name 434 (expand-file-name
469 (if (stringp article) article (int-to-string article)) 435 (if (stringp article) article (int-to-string article))
470 (file-name-as-directory 436 (file-name-as-directory
@@ -733,12 +699,7 @@ If LOW, update the lower bound instead."
733 (push (pop files) alphs))) 699 (push (pop files) alphs)))
734 ;; If we have nums, then this is probably a valid group. 700 ;; If we have nums, then this is probably a valid group.
735 (when (setq nums (sort nums '<)) 701 (when (setq nums (sort nums '<))
736 ;; Use non-decoded group name. 702 (puthash group
737 ;; FIXME: this is kind of a workaround. The active file should
738 ;; be updated at the time articles are cached. It will make
739 ;; `gnus-cache-unified-group-names' needless.
740 (puthash (or (cdr (assoc group gnus-cache-unified-group-names))
741 group)
742 (cons (car nums) (car (last nums))) 703 (cons (car nums) (car (last nums)))
743 gnus-cache-active-hashtb)) 704 gnus-cache-active-hashtb))
744 ;; Go through all the other files. 705 ;; Go through all the other files.
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 528dbce1614..7a17b16bf94 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -2104,9 +2104,7 @@ be permanent."
2104(defun gnus-group-name-at-point () 2104(defun gnus-group-name-at-point ()
2105 "Return a group name from around point if it exists, or nil." 2105 "Return a group name from around point if it exists, or nil."
2106 (if (derived-mode-p 'gnus-group-mode) 2106 (if (derived-mode-p 'gnus-group-mode)
2107 (let ((group (gnus-group-group-name))) 2107 (gnus-group-group-name)
2108 (when group
2109 (gnus-group-decoded-name group)))
2110 ;; FIXME: Use rx. 2108 ;; FIXME: Use rx.
2111 (let ((regexp "[][\C-@-\t\v-*,/:-@\\^`{-\C-?]*\ 2109 (let ((regexp "[][\C-@-\t\v-*,/:-@\\^`{-\C-?]*\
2112\\(nn[a-z]+\\(?:\\+[^][\C-@-*,/:-@\\^`{-\C-?]+\\)?:\ 2110\\(nn[a-z]+\\(?:\\+[^][\C-@-*,/:-@\\^`{-\C-?]+\\)?:\
@@ -2797,20 +2795,19 @@ be removed from the server, even when it's empty."
2797 (unless (gnus-check-backend-function 'request-delete-group group) 2795 (unless (gnus-check-backend-function 'request-delete-group group)
2798 (error "This back end does not support group deletion")) 2796 (error "This back end does not support group deletion"))
2799 (prog1 2797 (prog1
2800 (let ((group-decoded (gnus-group-decoded-name group))) 2798 (when (or no-prompt
2801 (when (or no-prompt 2799 (gnus-yes-or-no-p
2802 (gnus-yes-or-no-p 2800 (format
2803 (format 2801 "Do you really want to delete %s%s? "
2804 "Do you really want to delete %s%s? " 2802 group (if force " and all its contents" ""))))
2805 group-decoded (if force " and all its contents" "")))) 2803 (gnus-message 6 "Deleting group %s..." group)
2806 (gnus-message 6 "Deleting group %s..." group-decoded) 2804 (if (not (gnus-request-delete-group group force))
2807 (if (not (gnus-request-delete-group group force)) 2805 (gnus-error 3 "Couldn't delete group %s" group)
2808 (gnus-error 3 "Couldn't delete group %s" group-decoded) 2806 (gnus-message 6 "Deleting group %s...done" group)
2809 (gnus-message 6 "Deleting group %s...done" group-decoded) 2807 (gnus-group-goto-group group)
2810 (gnus-group-goto-group group) 2808 (gnus-group-kill-group 1 t)
2811 (gnus-group-kill-group 1 t) 2809 (gnus-set-active group nil)
2812 (gnus-set-active group nil) 2810 t))
2813 t)))
2814 (gnus-group-position-point))) 2811 (gnus-group-position-point)))
2815 2812
2816(defun gnus-group-rename-group (group new-name) 2813(defun gnus-group-rename-group (group new-name)
@@ -2845,34 +2842,30 @@ and NEW-NAME will be prompted for."
2845 (gnus-group-real-name new-name) 2842 (gnus-group-real-name new-name)
2846 (gnus-info-method (gnus-get-info group))))) 2843 (gnus-info-method (gnus-get-info group)))))
2847 2844
2848 (let ((decoded-group (gnus-group-decoded-name group)) 2845 (when (gnus-active new-name)
2849 (decoded-new-name (gnus-group-decoded-name new-name))) 2846 (error "The group %s already exists" new-name))
2850 (when (gnus-active new-name)
2851 (error "The group %s already exists" decoded-new-name))
2852 2847
2853 (gnus-message 6 "Renaming group %s to %s..." 2848 (gnus-message 6 "Renaming group %s to %s..." group new-name)
2854 decoded-group decoded-new-name) 2849 (prog1
2855 (prog1 2850 (if (progn
2856 (if (progn 2851 (gnus-group-goto-group group)
2857 (gnus-group-goto-group group) 2852 (not (when (< (gnus-group-group-level) gnus-level-zombie)
2858 (not (when (< (gnus-group-group-level) gnus-level-zombie) 2853 (gnus-request-rename-group group new-name))))
2859 (gnus-request-rename-group group new-name)))) 2854 (gnus-error 3 "Couldn't rename group %s to %s"
2860 (gnus-error 3 "Couldn't rename group %s to %s" 2855 group new-name)
2861 decoded-group decoded-new-name) 2856 ;; We rename the group internally by killing it...
2862 ;; We rename the group internally by killing it... 2857 (gnus-group-kill-group)
2863 (gnus-group-kill-group) 2858 ;; ... changing its name ...
2864 ;; ... changing its name ... 2859 (setcar (cdar gnus-list-of-killed-groups) new-name)
2865 (setcar (cdar gnus-list-of-killed-groups) new-name) 2860 ;; ... and then yanking it. Magic!
2866 ;; ... and then yanking it. Magic! 2861 (gnus-group-yank-group)
2867 (gnus-group-yank-group) 2862 (gnus-set-active new-name (gnus-active group))
2868 (gnus-set-active new-name (gnus-active group)) 2863 (gnus-message 6 "Renaming group %s to %s...done" group new-name)
2869 (gnus-message 6 "Renaming group %s to %s...done" 2864 new-name)
2870 decoded-group decoded-new-name) 2865 (setq gnus-killed-list (delete group gnus-killed-list))
2871 new-name) 2866 (gnus-set-active group nil)
2872 (setq gnus-killed-list (delete group gnus-killed-list)) 2867 (gnus-dribble-touch)
2873 (gnus-set-active group nil) 2868 (gnus-group-position-point)))
2874 (gnus-dribble-touch)
2875 (gnus-group-position-point))))
2876 2869
2877(defun gnus-group-edit-group (group &optional part) 2870(defun gnus-group-edit-group (group &optional part)
2878 "Edit the group on the current line." 2871 "Edit the group on the current line."
@@ -2899,7 +2892,7 @@ and NEW-NAME will be prompted for."
2899 ((eq part 'method) "select method") 2892 ((eq part 'method) "select method")
2900 ((eq part 'params) "group parameters") 2893 ((eq part 'params) "group parameters")
2901 (t "group info")) 2894 (t "group info"))
2902 (gnus-group-decoded-name group)) 2895 group)
2903 `(lambda (form) 2896 `(lambda (form)
2904 (gnus-group-edit-group-done ',part ,group form))) 2897 (gnus-group-edit-group-done ',part ,group form)))
2905 (local-set-key 2898 (local-set-key
@@ -3534,7 +3527,7 @@ up is returned."
3534 "Do you really want to mark all articles in %s as read? " 3527 "Do you really want to mark all articles in %s as read? "
3535 "Mark all unread articles in %s as read? ") 3528 "Mark all unread articles in %s as read? ")
3536 (if (= (length groups) 1) 3529 (if (= (length groups) 1)
3537 (gnus-group-decoded-name (car groups)) 3530 (car groups)
3538 (format "these %d groups" (length groups))))))) 3531 (format "these %d groups" (length groups)))))))
3539 n 3532 n
3540 (while (setq group (pop groups)) 3533 (while (setq group (pop groups))
@@ -3619,8 +3612,7 @@ Uses the process/prefix convention."
3619 3612
3620(defun gnus-group-expire-articles-1 (group) 3613(defun gnus-group-expire-articles-1 (group)
3621 (when (gnus-check-backend-function 'request-expire-articles group) 3614 (when (gnus-check-backend-function 'request-expire-articles group)
3622 (gnus-message 6 "Expiring articles in %s..." 3615 (gnus-message 6 "Expiring articles in %s..." group)
3623 (gnus-group-decoded-name group))
3624 (let* ((info (gnus-get-info group)) 3616 (let* ((info (gnus-get-info group))
3625 (expirable (if (gnus-group-total-expirable-p group) 3617 (expirable (if (gnus-group-total-expirable-p group)
3626 (cons nil (gnus-list-of-read-articles group)) 3618 (cons nil (gnus-list-of-read-articles group))
@@ -3647,8 +3639,7 @@ Uses the process/prefix convention."
3647 ;; Just expire using the normal expiry values. 3639 ;; Just expire using the normal expiry values.
3648 (gnus-request-expire-articles articles-to-expire group)))) 3640 (gnus-request-expire-articles articles-to-expire group))))
3649 (gnus-close-group group)) 3641 (gnus-close-group group))
3650 (gnus-message 6 "Expiring articles in %s...done" 3642 (gnus-message 6 "Expiring articles in %s...done" group)
3651 (gnus-group-decoded-name group))
3652 ;; Return the list of un-expired articles. 3643 ;; Return the list of un-expired articles.
3653 (cdr expirable)))) 3644 (cdr expirable))))
3654 3645
@@ -3685,7 +3676,7 @@ Uses the process/prefix convention."
3685 (dolist (group (gnus-group-process-prefix n)) 3676 (dolist (group (gnus-group-process-prefix n))
3686 (gnus-group-remove-mark group) 3677 (gnus-group-remove-mark group)
3687 (gnus-message 6 "Changed level of %s from %d to %d" 3678 (gnus-message 6 "Changed level of %s from %d to %d"
3688 (gnus-group-decoded-name group) 3679 group
3689 (or (gnus-group-group-level) gnus-level-killed) 3680 (or (gnus-group-group-level) gnus-level-killed)
3690 level) 3681 level)
3691 (gnus-group-change-level 3682 (gnus-group-change-level
@@ -3832,7 +3823,7 @@ of groups killed."
3832 ;; `gnus-newsrc-hashtb', this check will always return nil. 3823 ;; `gnus-newsrc-hashtb', this check will always return nil.
3833 (when (numberp (gnus-group-unread group)) 3824 (when (numberp (gnus-group-unread group))
3834 (gnus-request-update-group-status group 'unsubscribe)) 3825 (gnus-request-update-group-status group 'unsubscribe))
3835 (message "Killed group %s" (gnus-group-decoded-name group))) 3826 (message "Killed group %s" group))
3836 ;; If there are lots and lots of groups to be killed, we use 3827 ;; If there are lots and lots of groups to be killed, we use
3837 ;; this thing instead. 3828 ;; this thing instead.
3838 (dolist (group (nreverse groups)) 3829 (dolist (group (nreverse groups))
@@ -3970,7 +3961,7 @@ entail asking the server for the groups."
3970 (add-text-properties 3961 (add-text-properties
3971 (point) (prog1 (1+ (point)) 3962 (point) (prog1 (1+ (point))
3972 (insert " *: " 3963 (insert " *: "
3973 (gnus-group-decoded-name group) 3964 group
3974 "\n")) 3965 "\n"))
3975 (list 'gnus-group group 3966 (list 'gnus-group group
3976 'gnus-unread t 3967 'gnus-unread t
@@ -4694,22 +4685,21 @@ Note: currently only implemented in nnml."
4694 (error "No group to compact")) 4685 (error "No group to compact"))
4695 (unless (gnus-check-backend-function 'request-compact-group group) 4686 (unless (gnus-check-backend-function 'request-compact-group group)
4696 (error "This back end does not support group compaction")) 4687 (error "This back end does not support group compaction"))
4697 (let ((group-decoded (gnus-group-decoded-name group))) 4688 (gnus-message 6 "\
4698 (gnus-message 6 "\
4699Compacting group %s... (this may take a long time)" 4689Compacting group %s... (this may take a long time)"
4700 group-decoded) 4690 group)
4701 (prog1 4691 (prog1
4702 (if (not (gnus-request-compact-group group)) 4692 (if (not (gnus-request-compact-group group))
4703 (gnus-error 3 "Couldn't compact group %s" group-decoded) 4693 (gnus-error 3 "Couldn't compact group %s" group)
4704 (gnus-message 6 "Compacting group %s...done" group-decoded) 4694 (gnus-message 6 "Compacting group %s...done" group)
4705 t) 4695 t)
4706 ;; Invalidate the "original article" buffer which might be out of date. 4696 ;; Invalidate the "original article" buffer which might be out of date.
4707 ;; #### NOTE: Yes, this might be a bit rude, but since compaction 4697 ;; #### NOTE: Yes, this might be a bit rude, but since compaction
4708 ;; #### will not happen very often, I think this is acceptable. 4698 ;; #### will not happen very often, I think this is acceptable.
4709 (let ((original (get-buffer gnus-original-article-buffer))) 4699 (let ((original (get-buffer gnus-original-article-buffer)))
4710 (and original (gnus-kill-buffer original))) 4700 (and original (gnus-kill-buffer original)))
4711 ;; Update the group line to reflect new information (art number etc). 4701 ;; Update the group line to reflect new information (art number etc).
4712 (gnus-group-update-group-line)))) 4702 (gnus-group-update-group-line)))
4713 4703
4714(provide 'gnus-group) 4704(provide 'gnus-group)
4715 4705
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index b6d649d7603..0ac0164bb7a 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -413,7 +413,7 @@ Thank you for your help in stamping out bugs.
413(defun gnus-inews-make-draft (articles) 413(defun gnus-inews-make-draft (articles)
414 `(lambda () 414 `(lambda ()
415 (gnus-inews-make-draft-meta-information 415 (gnus-inews-make-draft-meta-information
416 ,(gnus-group-decoded-name gnus-newsgroup-name) ',articles))) 416 ,gnus-newsgroup-name ',articles)))
417 417
418(autoload 'nnir-article-number "nnir" nil nil 'macro) 418(autoload 'nnir-article-number "nnir" nil nil 'macro)
419(autoload 'nnir-article-group "nnir" nil nil 'macro) 419(autoload 'nnir-article-group "nnir" nil nil 'macro)
@@ -1722,7 +1722,6 @@ this is a reply."
1722(defun gnus-inews-insert-gcc (&optional group) 1722(defun gnus-inews-insert-gcc (&optional group)
1723 "Insert the Gcc to say where the article is to be archived." 1723 "Insert the Gcc to say where the article is to be archived."
1724 (let* ((group (or group gnus-newsgroup-name)) 1724 (let* ((group (or group gnus-newsgroup-name))
1725 (group (when group (gnus-group-decoded-name group)))
1726 (var (or gnus-outgoing-message-group gnus-message-archive-group)) 1725 (var (or gnus-outgoing-message-group gnus-message-archive-group))
1727 (gcc-self-val 1726 (gcc-self-val
1728 (and group (not (gnus-virtual-group-p group)) 1727 (and group (not (gnus-virtual-group-p group))
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index c2374c70730..97b6d7e231a 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -1884,7 +1884,6 @@ You must have the \"hashcash\" binary installed, see `hashcash-path'."
1884(autoload 'gnus-delay-article "gnus-delay") 1884(autoload 'gnus-delay-article "gnus-delay")
1885(autoload 'gnus-extract-address-components "gnus-util") 1885(autoload 'gnus-extract-address-components "gnus-util")
1886(autoload 'gnus-find-method-for-group "gnus") 1886(autoload 'gnus-find-method-for-group "gnus")
1887(autoload 'gnus-group-decoded-name "gnus-group")
1888(autoload 'gnus-group-name-charset "gnus-group") 1887(autoload 'gnus-group-name-charset "gnus-group")
1889(autoload 'gnus-group-name-decode "gnus-group") 1888(autoload 'gnus-group-name-decode "gnus-group")
1890(autoload 'gnus-groups-from-server "gnus") 1889(autoload 'gnus-groups-from-server "gnus")
@@ -7322,12 +7321,11 @@ news, Source is the list of newsgroups is was posted to."
7322 (let* ((group (message-fetch-field "newsgroups")) 7321 (let* ((group (message-fetch-field "newsgroups"))
7323 (from (message-fetch-field "from")) 7322 (from (message-fetch-field "from"))
7324 (prefix 7323 (prefix
7325 (if group 7324 (or group
7326 (gnus-group-decoded-name group) 7325 (or (and from (or
7327 (or (and from (or 7326 (car (gnus-extract-address-components from))
7328 (car (gnus-extract-address-components from)) 7327 (cadr (gnus-extract-address-components from))))
7329 (cadr (gnus-extract-address-components from)))) 7328 "(nowhere)"))))
7330 "(nowhere)"))))
7331 (concat "[" 7329 (concat "["
7332 (if message-forward-decoded-p 7330 (if message-forward-decoded-p
7333 prefix 7331 prefix
@@ -7341,10 +7339,9 @@ Source is the sender, and if the original message was news, Source is
7341the list of newsgroups is was posted to." 7339the list of newsgroups is was posted to."
7342 (let* ((group (message-fetch-field "newsgroups")) 7340 (let* ((group (message-fetch-field "newsgroups"))
7343 (prefix 7341 (prefix
7344 (if group 7342 (or group
7345 (gnus-group-decoded-name group) 7343 (or (message-fetch-field "from")
7346 (or (message-fetch-field "from") 7344 "(nowhere)"))))
7347 "(nowhere)"))))
7348 (concat "[" 7345 (concat "["
7349 (if message-forward-decoded-p 7346 (if message-forward-decoded-p
7350 prefix 7347 prefix
diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el
index 0bfecb28e09..f4a387b2a4b 100644
--- a/lisp/gnus/nnrss.el
+++ b/lisp/gnus/nnrss.el
@@ -367,7 +367,7 @@ for decoding when the cdr that the data specify is not available.")
367 (with-current-buffer nntp-server-buffer 367 (with-current-buffer nntp-server-buffer
368 (erase-buffer) 368 (erase-buffer)
369 (dolist (group groups) 369 (dolist (group groups)
370 (let ((elem (assoc-string (gnus-group-decoded-name group) nnrss-server-data))) 370 (let ((elem (assoc-string group nnrss-server-data)))
371 (insert (format "%S %s 1 y\n" group (or (cadr elem) 0))))) 371 (insert (format "%S %s 1 y\n" group (or (cadr elem) 0)))))
372 'active)) 372 'active))
373 373