From: "Łukasz Stelmach" <stlman@poczta.fm>
To: 41511@debbugs.gnu.org
Cc: "Łukasz Stelmach" <stlman@poczta.fm>
Subject: bug#41511: [PATCH v2] Decode group name before matching against gnus-parameters
Date: Sun, 24 May 2020 19:16:15 +0200 [thread overview]
Message-ID: <20200524171615.14557-1-stlman@poczta.fm> (raw)
In-Reply-To: <20200524165940.13507-1-stlman@poczta.fm>
Group names in Gnus are stored and processed as strings of bytes
(e.g. "Wiadomo\305\233ci-\305\233mieci") while regular expressions in
gnus-parameters are encoded as multibyte strings (e.g. "Wiadomości-śmieci")
and matching the latter aginst the former doesn't work. Parameters set
for groups with non-ascii characters in their names cannot be retrieved.
To fix this problem group name needs to be decoded before being matched
against a regexp.
* gnus.el (gnus-parameters-get-parameter, gnus-group-fast-parameter,
gnus-define-group-parameter): Decode a group name before matching against
a regexp.
---
lisp/gnus/gnus.el | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
v2:
- actually use the decoded-name instead of name in
gnus-define-group-parameter
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index caeab7f55a..e1fea35fdd 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -947,10 +947,11 @@ REST is a plist of following:
(string-match ,variable name))
(,variable
(let ((alist ,variable)
+ (decoded-name (gnus-group-decoded-name name))
elem value)
(while (setq elem (pop alist))
(when (and name
- (string-match (car elem) name))
+ (string-match (car elem) decoded-name))
(setq alist nil
value (cdr elem))))
(if (consp value) (car value) value))))))
@@ -959,10 +960,11 @@ REST is a plist of following:
(and name
(or (gnus-group-find-parameter name ',param ,(and type t))
(let ((alist ,variable)
+ (decoded-name (gnus-group-decoded-name name))
elem value)
(while (setq elem (pop alist))
(when (and name
- (string-match (car elem) name))
+ (string-match (car elem) decoded-name))
(setq alist nil
value (cdr elem))))
,(if type
@@ -3513,9 +3515,10 @@ You should probably use `gnus-find-method-for-group' instead."
(let ((case-fold-search (if (eq gnus-parameters-case-fold-search 'default)
case-fold-search
gnus-parameters-case-fold-search))
+ (decoded-group (gnus-group-decoded-name group))
params-list)
(dolist (elem gnus-parameters)
- (when (string-match (car elem) group)
+ (when (string-match (car elem) decoded-group)
(setq params-list
(nconc (gnus-expand-group-parameters
(car elem) (cdr elem) group)
@@ -3569,7 +3572,8 @@ The function `gnus-group-find-parameter' will do that for you."
(let* ((params (funcall gnus-group-get-parameter-function group))
;; Start easy, check the "real" group parameters.
(simple-results
- (gnus-group-parameter-value params symbol allow-list t)))
+ (gnus-group-parameter-value params symbol allow-list t))
+ (decoded-group (gnus-group-decoded-name group)))
(if simple-results
;; Found results; return them.
(car simple-results)
@@ -3582,7 +3586,7 @@ The function `gnus-group-find-parameter' will do that for you."
(setq head (car tail)
tail (cdr tail))
;; The car is regexp matching for matching the group name.
- (when (string-match (car head) group)
+ (when (string-match (car head) decoded-group)
;; The cdr is the parameters.
(let ((this-result
(gnus-group-parameter-value (cdr head) symbol allow-list t)))
--
2.20.1
next prev parent reply other threads:[~2020-05-24 17:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-24 16:59 bug#41511: [PATCH] Decode group name before matching against gnus-parameters Łukasz Stelmach
2020-05-24 17:16 ` Łukasz Stelmach [this message]
2020-05-24 22:04 ` bug#41511: [PATCH v2] " Eric Abrahamsen
2020-05-25 7:29 ` Łukasz Stelmach
2020-05-25 14:43 ` Eric Abrahamsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200524171615.14557-1-stlman@poczta.fm \
--to=stlman@poczta.fm \
--cc=41511@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.