Gnus development mailing list
 help / color / mirror / Atom feed
From: Justus@Piater.name
To: Reiner Steib <Reiner.Steib@gmx.de>
Cc: ding@gnus.org, Christoph Conrad <christoph.conrad@gmx.de>
Subject: nnir.el cleanup (was Re: nnir.el swish++ interface broken)
Date: Sun, 20 Apr 2008 09:48:14 +0200	[thread overview]
Message-ID: <x8ttzhx55mp.fsf_-_@tool.montefiore.ulg.ac.be> (raw)
In-Reply-To: <v9od85oifa.fsf@marauder.physik.uni-ulm.de> (Reiner Steib's message of "Sat, 19 Apr 2008 19:36:57 +0200")

[-- Attachment #1: Type: text/plain, Size: 1301 bytes --]

Reiner Steib <reinersteib+gmane@imap.cc> wrote on Sat, 19 Apr 2008
19:36:57 +0200:

>     ;; eliminate all ".", "/", "\" from beginning. Always matches.
>     (string-match "^[./\\]*\\(.*\\)$" dirnam)
>     (setq group (substitute ?. ?/ (match-string 1 dirnam))) ;; "/" -> "."
>     (setq group (substitute ?. ?\\ group)) ;; "\\" -> "."
>
> I'm not sure what values of dirnam and group need to be considered.
> Maybe using `gnus-replace-in-string' could simplify this code?
>
> Additionally, `substitute' is a function from the `cl' package.  While
> it is okay to use cl macros at compile time[1], using cl at runtime.

This is not my code; I just moved it around during restructuring. But
how about the attached patch and the following change-log entry?

(nnir-compose-result): use `gnus-replace-in-string' instead of
`string-match', `match-string' and `substitute'

Christoph, can you verify that it still works for you? The changed
lines are irrelevant to the nnmaildir backend. You'll have to apply
the patch though; no more easy downloading of the full file :-):

>> I also updated the complete file on my Web server.
>
> I'd suggest not to distribute Gnus files on your Web server.  

(Of course, this was never intended to be a "distribution", just to
lower the barrier for testers.)

Justus


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnir.el.diff --]
[-- Type: text/x-diff, Size: 977 bytes --]

Index: nnir.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/contrib/nnir.el,v
retrieving revision 7.28
diff -u -r7.28 nnir.el
--- nnir.el	19 Apr 2008 17:19:12 -0000	7.28
+++ nnir.el	20 Apr 2008 07:35:24 -0000
@@ -880,10 +880,11 @@
     (setq dirnam
 	  (substring dirnam 0 (if (string= server "nnmaildir:") -5 -1)))
 
-    ;; eliminate all ".", "/", "\" from beginning. Always matches.
-    (string-match "^[./\\]*\\(.*\\)$" dirnam)
-    (setq group (substitute ?. ?/ (match-string 1 dirnam))) ;; "/" -> "."
-    (setq group (substitute ?. ?\\ group)) ;; "\\" -> "."
+    ;; Set group to dirnam without any leading dots or slashes,
+    ;; and with all subsequent slashes replaced by dots
+    (setq group (gnus-replace-in-string
+                 (gnus-replace-in-string dirnam "^[./\\]" "" t)
+                 "[/\\]" "." t))
 
     (vector (nnir-group-full-name group server)
 	    (if (string= server "nnmaildir:")

  reply	other threads:[~2008-04-20  7:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87y77fiszu.fsf@ID-24456.user.uni-berlin.de>
     [not found] ` <87lk3fvw4l.fsf@ID-24456.user.uni-berlin.de>
     [not found]   ` <873apmapq9.fsf_-_@ID-24456.user.uni-berlin.de>
     [not found]     ` <x8tfxtm2mqc.fsf@tool.montefiore.ulg.ac.be>
2008-04-16 10:50       ` FIX Christoph Conrad
2008-04-16 18:22         ` nnir.el swish++ interface broken (was: FIX) Reiner Steib
2008-04-17  7:20           ` nnir.el swish++ interface broken Justus-bulk
2008-04-17  7:37             ` Christoph Conrad
2008-04-17 18:01               ` Christoph Conrad
2008-04-19 17:36             ` Reiner Steib
2008-04-20  7:48               ` Justus [this message]
2008-04-20 10:09                 ` nnir.el cleanup Reiner Steib
2008-04-20 15:39                   ` Christoph Conrad
2008-04-20 20:02                     ` Reiner Steib
2008-04-22 17:52                       ` Christoph Conrad
2008-04-24 18:06                         ` Reiner Steib
2008-04-24 18:34                           ` Christoph Conrad
2008-04-24 18:17                         ` Compiler warnings in nnir.el (was: nnir.el cleanup) Reiner Steib
2008-04-25  2:27                           ` Compiler warnings in nnir.el Stefan Monnier
2008-04-20 11:03                 ` nnir.el cleanup (was Re: nnir.el swish++ interface broken) Christoph Conrad
2008-04-21 13:40                 ` Christoph Conrad

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=x8ttzhx55mp.fsf_-_@tool.montefiore.ulg.ac.be \
    --to=justus@piater.name \
    --cc=Reiner.Steib@gmx.de \
    --cc=christoph.conrad@gmx.de \
    --cc=ding@gnus.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).