Changes committed gnus/contrib (ChangeLog nnir.el)
"Reiner Steib" <[email protected]>
| Newsgroups | gmane.emacs.gnus.commits |
|---|---|
| Message-ID | <[email protected]> |
Modified: ChangeLog nnir.el (nnir-add-result): New helper macro. (nnir-compose-result): Use it. Fix inexistent file check for maildir. Index: ChangeLog diff -u gnus/contrib/ChangeLog:7.62 gnus/contrib/ChangeLog:7.63 --- ChangeLog:7.62 Tue Apr 15 23:19:53 2008 +++ ChangeLog Sat Apr 19 19:07:23 2008 @@ -1,3 +1,8 @@ +2008-04-19 Justus Piater <[email protected]> + + * nnir.el (nnir-add-result): New helper macro. + (nnir-compose-result): Use it. Fix inexistent file check for maildir. + 2008-04-15 Christoph Conrad <[email protected]> * nnir.el (nnir-run-swish++): Fix inexistent file check for nnml. Index: nnir.el diff -u gnus/contrib/nnir.el:7.26 gnus/contrib/nnir.el:7.27 --- nnir.el:7.26 Tue Apr 15 23:16:28 2008 +++ nnir.el Sat Apr 19 19:07:23 2008 @@ -859,6 +859,14 @@ (nnoo-define-skeleton nnir) +(defmacro nnir-add-result (dirnam artno score prefix server artlist) + "Ask `nnir-compose-result' to construct a result vector, +and if it is non-nil, add it to artlist." + `(let ((result (nnir-compose-result dirnam artno score prefix server))) + (when (not (null result)) + (push result artlist)))) + + ;; Helper function currently used by the Swish++ and Namazu backends; ;; perhaps useful for other backends as well (defun nnir-compose-result (dirnam article score prefix server) @@ -869,21 +877,24 @@ (when (string-match (concat "^" prefix) dirnam) (setq dirnam (replace-match "" t t dirnam))) - ;; remove trailing slash and, for nnmaildir, cur/new/tmp - (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)) ;; "\\" -> "." - - (vector (nnir-group-full-name group server) - (if (string= server "nnmaildir:") - (nnmaildir-base-name-to-article-number - (substring article 0 (string-match ":" article)) - group nil) - (string-to-int article)) - (string-to-int score))) + (if (not (file-readable-p (concat prefix dirnam article))) + nil + ;; remove trailing slash and, for nnmaildir, cur/new/tmp + (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)) ;; "\\" -> "." + + (vector (nnir-group-full-name group server) + (if (string= server "nnmaildir:") + (nnmaildir-base-name-to-article-number + (substring article 0 (string-match ":" article)) + group nil) + (string-to-int article)) + (string-to-int score)))) ;;; Search Engine Interfaces: @@ -1223,16 +1234,14 @@ artno (file-name-nondirectory filenam) dirnam (file-name-directory filenam)) - ;; don't match directories or inexistent/unreadable files - (when (and (string-match article-pattern artno) - (file-readable-p (concat prefix filenam))) + ;; don't match directories + (when (string-match article-pattern artno) (when (not (null dirnam)) ;; maybe limit results to matching groups. (when (or (not groupspec) (string-match groupspec dirnam)) - (push (nnir-compose-result dirnam artno score prefix server) - artlist))))) + (nnir-add-result dirnam artno score prefix server artlist))))) (message "Massaging swish++ output...done") @@ -1480,8 +1489,7 @@ ;; make sure article and group is sane (when (and (string-match article-pattern article) (not (null group))) - (push (nnir-compose-result group article score prefix server) - artlist))) + (nnir-add-result group article score prefix server artlist))) ;; sort artlist by score (apply 'vector