Mercurial > emacs
changeset 104584:f540e84a920d
(top-level): Don't require cl at run-time.
(nnir-run-waissearch, nnir-run-swish-e, nnir-run-hyrex):
Replace cl-function substitute with gnus-replace-in-string.
(nnir-run-waissearch, nnir-run-swish++, nnir-run-swish-e)
(nnir-run-hyrex, nnir-run-namazu): Replace cl-function sort* with sort.
(nnir-run-find-grep): Replace cl-functions find-if and subseq with
simplified expansions.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 25 Aug 2009 07:03:49 +0000 |
parents | e491887d0944 |
children | dc1af63f6b73 |
files | lisp/gnus/ChangeLog lisp/gnus/nnir.el |
diffstat | 2 files changed, 56 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog Tue Aug 25 06:52:09 2009 +0000 +++ b/lisp/gnus/ChangeLog Tue Aug 25 07:03:49 2009 +0000 @@ -1,3 +1,13 @@ +2009-08-25 Glenn Morris <rgm@gnu.org> + + * nnir.el (top-level): Don't require cl at run-time. + (nnir-run-waissearch, nnir-run-swish-e, nnir-run-hyrex): + Replace cl-function substitute with gnus-replace-in-string. + (nnir-run-waissearch, nnir-run-swish++, nnir-run-swish-e) + (nnir-run-hyrex, nnir-run-namazu): Replace cl-function sort* with sort. + (nnir-run-find-grep): Replace cl-functions find-if and subseq with + simplified expansions. + 2009-08-22 Glenn Morris <rgm@gnu.org> * gnus-art.el (gnus-button-patch): Use forward-line rather than
--- a/lisp/gnus/nnir.el Tue Aug 25 06:52:09 2009 +0000 +++ b/lisp/gnus/nnir.el Tue Aug 25 07:03:49 2009 +0000 @@ -336,7 +336,7 @@ (require 'gnus-sum) (require 'message) (require 'gnus-util) -(eval-and-compile +(eval-when-compile (require 'cl)) (nnoo-declare nnir) @@ -916,17 +916,18 @@ (unless (string-match prefix dirnam) (nnheader-report 'nnir "Dir name %s doesn't contain prefix %s" dirnam prefix)) - (setq group (substitute ?. ?/ (replace-match "" t t dirnam))) + (setq group (gnus-replace-in-string + (replace-match "" t t dirnam) "/" ".")) (push (vector (nnir-group-full-name group server) (string-to-number artno) (string-to-number score)) artlist)) (message "Massaging waissearch output...done") (apply 'vector - (sort* artlist - (function (lambda (x y) - (> (nnir-artitem-rsv x) - (nnir-artitem-rsv y))))))))) + (sort artlist + (function (lambda (x y) + (> (nnir-artitem-rsv x) + (nnir-artitem-rsv y))))))))) ;; IMAP interface. ;; todo: @@ -1235,10 +1236,10 @@ ;; Sort by score (apply 'vector - (sort* artlist - (function (lambda (x y) - (> (nnir-artitem-rsv x) - (nnir-artitem-rsv y))))))))) + (sort artlist + (function (lambda (x y) + (> (nnir-artitem-rsv x) + (nnir-artitem-rsv y))))))))) ;; Swish-E interface. (defun nnir-run-swish-e (query server &optional group) @@ -1316,9 +1317,9 @@ ;; eliminate all ".", "/", "\" from beginning. Always matches. (string-match "^[./\\]*\\(.*\\)$" dirnam) ;; "/" -> "." - (setq group (substitute ?. ?/ (match-string 1 dirnam))) + (setq group (gnus-replace-in-string (match-string 1 dirnam) "/" ".")) ;; Windows "\\" -> "." - (setq group (substitute ?. ?\\ group)) + (setq group (gnus-replace-in-string group "\\\\" ".")) (push (vector (nnir-group-full-name group server) (string-to-number artno) @@ -1329,10 +1330,10 @@ ;; Sort by score (apply 'vector - (sort* artlist - (function (lambda (x y) - (> (nnir-artitem-rsv x) - (nnir-artitem-rsv y))))))))) + (sort artlist + (function (lambda (x y) + (> (nnir-artitem-rsv x) + (nnir-artitem-rsv y))))))))) ;; HyREX interface (defun nnir-run-hyrex (query server &optional group) @@ -1397,19 +1398,20 @@ score (match-string 3)) (when (string-match prefix dirnam) (setq dirnam (replace-match "" t t dirnam))) - (push (vector (nnir-group-full-name (substitute ?. ?/ dirnam) server) + (push (vector (nnir-group-full-name + (gnus-replace-in-string dirnam "/" ".") server) (string-to-number artno) (string-to-number score)) artlist)) (message "Massaging hyrex-search output...done.") (apply 'vector - (sort* artlist - (function (lambda (x y) - (if (string-lessp (nnir-artitem-group x) - (nnir-artitem-group y)) - t - (< (nnir-artitem-number x) - (nnir-artitem-number y))))))) + (sort artlist + (function (lambda (x y) + (if (string-lessp (nnir-artitem-group x) + (nnir-artitem-group y)) + t + (< (nnir-artitem-number x) + (nnir-artitem-number y))))))) ))) ;; Namazu interface @@ -1476,10 +1478,10 @@ ;; sort artlist by score (apply 'vector - (sort* artlist - (function (lambda (x y) - (> (nnir-artitem-rsv x) - (nnir-artitem-rsv y))))))))) + (sort artlist + (function (lambda (x y) + (> (nnir-artitem-rsv x) + (nnir-artitem-rsv y))))))))) (defun nnir-run-find-grep (query server &optional group) "Run find and grep to obtain matching articles." @@ -1505,11 +1507,14 @@ "." ;; Try accessing the group literally as well as ;; interpreting dots as directory separators so the - ;; engine works with plain nnml as well as the Gnus - ;; Cache. - (find-if 'file-directory-p - (let ((group (gnus-group-real-name group))) - (list group (gnus-replace-in-string group "\\." "/" t))))))) + ;; engine works with plain nnml as well as the Gnus Cache. + (let ((group (gnus-group-real-name group))) + ;; Replace cl-func find-if. + (if (file-directory-p group) + group + (if (file-directory-p + (setq group (gnus-replace-in-string group "\\." "/" t))) + group)))))) (unless group (error "Cannot locate directory for group")) (save-excursion @@ -1532,7 +1537,14 @@ (art (string-to-number (car (last path))))) (while (string= "." (car path)) (setq path (cdr path))) - (let ((group (mapconcat 'identity (subseq path 0 -1) "."))) + (let ((group (mapconcat 'identity + ;; Replace cl-func: (subseq path 0 -1) + (let ((end (1- (length path))) + res) + (while (>= (setq end (1- end)) 0) + (push (pop path) res)) + (nreverse res)) + "."))) (push (vector (nnir-group-full-name group server) art 0) artlist)) (forward-line 1)))