diff options
| author | Glenn Morris | 2009-08-25 07:03:49 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-08-25 07:03:49 +0000 |
| commit | ec179403bda056115aab41fea14b0dadcc9249d0 (patch) | |
| tree | 0df22c0c3a5a81f39a7d7d26e7eaa67d75ed7ef8 | |
| parent | 91677576624802ae3ada0277881ce65a47f8793e (diff) | |
| download | emacs-ec179403bda056115aab41fea14b0dadcc9249d0.tar.gz emacs-ec179403bda056115aab41fea14b0dadcc9249d0.zip | |
(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.
| -rw-r--r-- | lisp/gnus/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/gnus/nnir.el | 80 |
2 files changed, 56 insertions, 34 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 24500b64744..d0993d4aa88 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2009-08-25 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * nnir.el (top-level): Don't require cl at run-time. | ||
| 4 | (nnir-run-waissearch, nnir-run-swish-e, nnir-run-hyrex): | ||
| 5 | Replace cl-function substitute with gnus-replace-in-string. | ||
| 6 | (nnir-run-waissearch, nnir-run-swish++, nnir-run-swish-e) | ||
| 7 | (nnir-run-hyrex, nnir-run-namazu): Replace cl-function sort* with sort. | ||
| 8 | (nnir-run-find-grep): Replace cl-functions find-if and subseq with | ||
| 9 | simplified expansions. | ||
| 10 | |||
| 1 | 2009-08-22 Glenn Morris <rgm@gnu.org> | 11 | 2009-08-22 Glenn Morris <rgm@gnu.org> |
| 2 | 12 | ||
| 3 | * gnus-art.el (gnus-button-patch): Use forward-line rather than | 13 | * gnus-art.el (gnus-button-patch): Use forward-line rather than |
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 0658b1e2050..77fc6b6c7b7 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el | |||
| @@ -336,7 +336,7 @@ | |||
| 336 | (require 'gnus-sum) | 336 | (require 'gnus-sum) |
| 337 | (require 'message) | 337 | (require 'message) |
| 338 | (require 'gnus-util) | 338 | (require 'gnus-util) |
| 339 | (eval-and-compile | 339 | (eval-when-compile |
| 340 | (require 'cl)) | 340 | (require 'cl)) |
| 341 | 341 | ||
| 342 | (nnoo-declare nnir) | 342 | (nnoo-declare nnir) |
| @@ -916,17 +916,18 @@ pairs (also vectors, actually)." | |||
| 916 | (unless (string-match prefix dirnam) | 916 | (unless (string-match prefix dirnam) |
| 917 | (nnheader-report 'nnir "Dir name %s doesn't contain prefix %s" | 917 | (nnheader-report 'nnir "Dir name %s doesn't contain prefix %s" |
| 918 | dirnam prefix)) | 918 | dirnam prefix)) |
| 919 | (setq group (substitute ?. ?/ (replace-match "" t t dirnam))) | 919 | (setq group (gnus-replace-in-string |
| 920 | (replace-match "" t t dirnam) "/" ".")) | ||
| 920 | (push (vector (nnir-group-full-name group server) | 921 | (push (vector (nnir-group-full-name group server) |
| 921 | (string-to-number artno) | 922 | (string-to-number artno) |
| 922 | (string-to-number score)) | 923 | (string-to-number score)) |
| 923 | artlist)) | 924 | artlist)) |
| 924 | (message "Massaging waissearch output...done") | 925 | (message "Massaging waissearch output...done") |
| 925 | (apply 'vector | 926 | (apply 'vector |
| 926 | (sort* artlist | 927 | (sort artlist |
| 927 | (function (lambda (x y) | 928 | (function (lambda (x y) |
| 928 | (> (nnir-artitem-rsv x) | 929 | (> (nnir-artitem-rsv x) |
| 929 | (nnir-artitem-rsv y))))))))) | 930 | (nnir-artitem-rsv y))))))))) |
| 930 | 931 | ||
| 931 | ;; IMAP interface. | 932 | ;; IMAP interface. |
| 932 | ;; todo: | 933 | ;; todo: |
| @@ -1235,10 +1236,10 @@ Windows NT 4.0." | |||
| 1235 | 1236 | ||
| 1236 | ;; Sort by score | 1237 | ;; Sort by score |
| 1237 | (apply 'vector | 1238 | (apply 'vector |
| 1238 | (sort* artlist | 1239 | (sort artlist |
| 1239 | (function (lambda (x y) | 1240 | (function (lambda (x y) |
| 1240 | (> (nnir-artitem-rsv x) | 1241 | (> (nnir-artitem-rsv x) |
| 1241 | (nnir-artitem-rsv y))))))))) | 1242 | (nnir-artitem-rsv y))))))))) |
| 1242 | 1243 | ||
| 1243 | ;; Swish-E interface. | 1244 | ;; Swish-E interface. |
| 1244 | (defun nnir-run-swish-e (query server &optional group) | 1245 | (defun nnir-run-swish-e (query server &optional group) |
| @@ -1316,9 +1317,9 @@ Tested with swish-e-2.0.1 on Windows NT 4.0." | |||
| 1316 | ;; eliminate all ".", "/", "\" from beginning. Always matches. | 1317 | ;; eliminate all ".", "/", "\" from beginning. Always matches. |
| 1317 | (string-match "^[./\\]*\\(.*\\)$" dirnam) | 1318 | (string-match "^[./\\]*\\(.*\\)$" dirnam) |
| 1318 | ;; "/" -> "." | 1319 | ;; "/" -> "." |
| 1319 | (setq group (substitute ?. ?/ (match-string 1 dirnam))) | 1320 | (setq group (gnus-replace-in-string (match-string 1 dirnam) "/" ".")) |
| 1320 | ;; Windows "\\" -> "." | 1321 | ;; Windows "\\" -> "." |
| 1321 | (setq group (substitute ?. ?\\ group)) | 1322 | (setq group (gnus-replace-in-string group "\\\\" ".")) |
| 1322 | 1323 | ||
| 1323 | (push (vector (nnir-group-full-name group server) | 1324 | (push (vector (nnir-group-full-name group server) |
| 1324 | (string-to-number artno) | 1325 | (string-to-number artno) |
| @@ -1329,10 +1330,10 @@ Tested with swish-e-2.0.1 on Windows NT 4.0." | |||
| 1329 | 1330 | ||
| 1330 | ;; Sort by score | 1331 | ;; Sort by score |
| 1331 | (apply 'vector | 1332 | (apply 'vector |
| 1332 | (sort* artlist | 1333 | (sort artlist |
| 1333 | (function (lambda (x y) | 1334 | (function (lambda (x y) |
| 1334 | (> (nnir-artitem-rsv x) | 1335 | (> (nnir-artitem-rsv x) |
| 1335 | (nnir-artitem-rsv y))))))))) | 1336 | (nnir-artitem-rsv y))))))))) |
| 1336 | 1337 | ||
| 1337 | ;; HyREX interface | 1338 | ;; HyREX interface |
| 1338 | (defun nnir-run-hyrex (query server &optional group) | 1339 | (defun nnir-run-hyrex (query server &optional group) |
| @@ -1397,19 +1398,20 @@ Tested with swish-e-2.0.1 on Windows NT 4.0." | |||
| 1397 | score (match-string 3)) | 1398 | score (match-string 3)) |
| 1398 | (when (string-match prefix dirnam) | 1399 | (when (string-match prefix dirnam) |
| 1399 | (setq dirnam (replace-match "" t t dirnam))) | 1400 | (setq dirnam (replace-match "" t t dirnam))) |
| 1400 | (push (vector (nnir-group-full-name (substitute ?. ?/ dirnam) server) | 1401 | (push (vector (nnir-group-full-name |
| 1402 | (gnus-replace-in-string dirnam "/" ".") server) | ||
| 1401 | (string-to-number artno) | 1403 | (string-to-number artno) |
| 1402 | (string-to-number score)) | 1404 | (string-to-number score)) |
| 1403 | artlist)) | 1405 | artlist)) |
| 1404 | (message "Massaging hyrex-search output...done.") | 1406 | (message "Massaging hyrex-search output...done.") |
| 1405 | (apply 'vector | 1407 | (apply 'vector |
| 1406 | (sort* artlist | 1408 | (sort artlist |
| 1407 | (function (lambda (x y) | 1409 | (function (lambda (x y) |
| 1408 | (if (string-lessp (nnir-artitem-group x) | 1410 | (if (string-lessp (nnir-artitem-group x) |
| 1409 | (nnir-artitem-group y)) | 1411 | (nnir-artitem-group y)) |
| 1410 | t | 1412 | t |
| 1411 | (< (nnir-artitem-number x) | 1413 | (< (nnir-artitem-number x) |
| 1412 | (nnir-artitem-number y))))))) | 1414 | (nnir-artitem-number y))))))) |
| 1413 | ))) | 1415 | ))) |
| 1414 | 1416 | ||
| 1415 | ;; Namazu interface | 1417 | ;; Namazu interface |
| @@ -1476,10 +1478,10 @@ Tested with Namazu 2.0.6 on a GNU/Linux system." | |||
| 1476 | 1478 | ||
| 1477 | ;; sort artlist by score | 1479 | ;; sort artlist by score |
| 1478 | (apply 'vector | 1480 | (apply 'vector |
| 1479 | (sort* artlist | 1481 | (sort artlist |
| 1480 | (function (lambda (x y) | 1482 | (function (lambda (x y) |
| 1481 | (> (nnir-artitem-rsv x) | 1483 | (> (nnir-artitem-rsv x) |
| 1482 | (nnir-artitem-rsv y))))))))) | 1484 | (nnir-artitem-rsv y))))))))) |
| 1483 | 1485 | ||
| 1484 | (defun nnir-run-find-grep (query server &optional group) | 1486 | (defun nnir-run-find-grep (query server &optional group) |
| 1485 | "Run find and grep to obtain matching articles." | 1487 | "Run find and grep to obtain matching articles." |
| @@ -1505,11 +1507,14 @@ Tested with Namazu 2.0.6 on a GNU/Linux system." | |||
| 1505 | "." | 1507 | "." |
| 1506 | ;; Try accessing the group literally as well as | 1508 | ;; Try accessing the group literally as well as |
| 1507 | ;; interpreting dots as directory separators so the | 1509 | ;; interpreting dots as directory separators so the |
| 1508 | ;; engine works with plain nnml as well as the Gnus | 1510 | ;; engine works with plain nnml as well as the Gnus Cache. |
| 1509 | ;; Cache. | 1511 | (let ((group (gnus-group-real-name group))) |
| 1510 | (find-if 'file-directory-p | 1512 | ;; Replace cl-func find-if. |
| 1511 | (let ((group (gnus-group-real-name group))) | 1513 | (if (file-directory-p group) |
| 1512 | (list group (gnus-replace-in-string group "\\." "/" t))))))) | 1514 | group |
| 1515 | (if (file-directory-p | ||
| 1516 | (setq group (gnus-replace-in-string group "\\." "/" t))) | ||
| 1517 | group)))))) | ||
| 1513 | (unless group | 1518 | (unless group |
| 1514 | (error "Cannot locate directory for group")) | 1519 | (error "Cannot locate directory for group")) |
| 1515 | (save-excursion | 1520 | (save-excursion |
| @@ -1532,7 +1537,14 @@ Tested with Namazu 2.0.6 on a GNU/Linux system." | |||
| 1532 | (art (string-to-number (car (last path))))) | 1537 | (art (string-to-number (car (last path))))) |
| 1533 | (while (string= "." (car path)) | 1538 | (while (string= "." (car path)) |
| 1534 | (setq path (cdr path))) | 1539 | (setq path (cdr path))) |
| 1535 | (let ((group (mapconcat 'identity (subseq path 0 -1) "."))) | 1540 | (let ((group (mapconcat 'identity |
| 1541 | ;; Replace cl-func: (subseq path 0 -1) | ||
| 1542 | (let ((end (1- (length path))) | ||
| 1543 | res) | ||
| 1544 | (while (>= (setq end (1- end)) 0) | ||
| 1545 | (push (pop path) res)) | ||
| 1546 | (nreverse res)) | ||
| 1547 | "."))) | ||
| 1536 | (push (vector (nnir-group-full-name group server) art 0) | 1548 | (push (vector (nnir-group-full-name group server) art 0) |
| 1537 | artlist)) | 1549 | artlist)) |
| 1538 | (forward-line 1))) | 1550 | (forward-line 1))) |