From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/66856 Path: news.gmane.org!not-for-mail From: Justus@Piater.name Newsgroups: gmane.emacs.gnus.general Subject: nnir.el cleanup (was Re: nnir.el swish++ interface broken) Date: Sun, 20 Apr 2008 09:48:14 +0200 Message-ID: References: <87y77fiszu.fsf@ID-24456.user.uni-berlin.de> <87lk3fvw4l.fsf@ID-24456.user.uni-berlin.de> <873apmapq9.fsf_-_@ID-24456.user.uni-berlin.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1208713495 13720 80.91.229.12 (20 Apr 2008 17:44:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Apr 2008 17:44:55 +0000 (UTC) Cc: ding@gnus.org, Christoph Conrad To: Reiner Steib Original-X-From: ding-owner+M15338@lists.math.uh.edu Sun Apr 20 19:45:29 2008 connect(): Connection refused Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1JndbP-0006ma-AD for ding-account@gmane.org; Sun, 20 Apr 2008 19:45:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1JndaD-0004Sf-Vb; Sun, 20 Apr 2008 12:44:10 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1JnUI9-0002eR-UA for ding@lists.math.uh.edu; Sun, 20 Apr 2008 02:48:53 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1JnUI3-0000fT-Uj for ding@lists.math.uh.edu; Sun, 20 Apr 2008 02:48:53 -0500 Original-Received: from serv108.segi.ulg.ac.be ([139.165.32.111]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1JnUIE-0001Fb-00 for ; Sun, 20 Apr 2008 09:48:58 +0200 Original-Received: (qmail 28307 invoked from network); 20 Apr 2008 09:48:15 +0200 Original-Received: from unknown (HELO tool.montefiore.ulg.ac.be) (u193113@[83.182.241.154]) (envelope-sender ) by serv108.segi.ulg.ac.be (qmail-ldap-1.03) with SMTP for ; 20 Apr 2008 09:48:15 +0200 In-Reply-To: (Reiner Steib's message of "Sat, 19 Apr 2008 19:36:57 +0200") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux) X-Spam-Score: -1.5 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:66856 Archived-At: --=-=-= Content-Type: text/plain Reiner Steib 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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=nnir.el.diff 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:") --=-=-=--