diff options
| author | Andrew Cohen | 2013-03-29 14:12:58 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2013-03-29 14:12:58 +0000 |
| commit | d406cffa8e82893802232f4eea8f6f1a478d263a (patch) | |
| tree | 68e89e8011add0189beea57684809dc26f5f2523 | |
| parent | 75a2f9811394920a246bd7f8402bfb60adf9a368 (diff) | |
| download | emacs-d406cffa8e82893802232f4eea8f6f1a478d263a.tar.gz emacs-d406cffa8e82893802232f4eea8f6f1a478d263a.zip | |
lisp/gnus/nnir.el: Allow nnir group creation based on an existing query
| -rw-r--r-- | lisp/gnus/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/gnus/nnir.el | 50 |
2 files changed, 44 insertions, 14 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index e42e7606313..3ea10f55df2 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-03-29 Andrew Cohen <cohen@bu.edu> | ||
| 2 | |||
| 3 | * nnir.el: Define 'number-sequence for xemacs. | ||
| 4 | (gnus-summary-create-nnir-group): New function to create an nnir group | ||
| 5 | from an nnir summary buffer based on the current query. | ||
| 6 | (nnir-request-create-group): Update to allow nnir group creation based | ||
| 7 | on the current query. | ||
| 8 | |||
| 1 | 2013-03-28 Katsumi Yamaoka <yamaoka@jpl.org> | 9 | 2013-03-28 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 10 | ||
| 3 | * nndraft.el (nndraft-request-expire-articles): | 11 | * nndraft.el (nndraft-request-expire-articles): |
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index a48c6043e82..cf9de09eaa2 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el | |||
| @@ -173,7 +173,15 @@ | |||
| 173 | 173 | ||
| 174 | ;; For Emacs <22.2 and XEmacs. | 174 | ;; For Emacs <22.2 and XEmacs. |
| 175 | (eval-and-compile | 175 | (eval-and-compile |
| 176 | (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) | 176 | (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))) |
| 177 | (unless (fboundp 'number-sequence) | ||
| 178 | (defun number-sequence (from to) | ||
| 179 | (let (seq (n 0) (next from)) | ||
| 180 | (while (<= next to) | ||
| 181 | (setq seq (cons next seq) | ||
| 182 | n (1+ n) | ||
| 183 | next (+ from n ))) | ||
| 184 | (nreverse seq))))) | ||
| 177 | 185 | ||
| 178 | (require 'nnoo) | 186 | (require 'nnoo) |
| 179 | (require 'gnus-group) | 187 | (require 'gnus-group) |
| @@ -1840,24 +1848,38 @@ article came from is also searched." | |||
| 1840 | (add-hook 'gnus-summary-article-expire-hook 'nnir-registry-action t t)))) | 1848 | (add-hook 'gnus-summary-article-expire-hook 'nnir-registry-action t t)))) |
| 1841 | 1849 | ||
| 1842 | 1850 | ||
| 1851 | (defun gnus-summary-create-nnir-group () | ||
| 1852 | (interactive) | ||
| 1853 | (let ((name (gnus-read-group "Group name: ")) | ||
| 1854 | (method "nnir") | ||
| 1855 | (pgroup (if (gnus-group-prefixed-p gnus-newsgroup-name) | ||
| 1856 | gnus-newsgroup-name | ||
| 1857 | (gnus-group-prefixed-name | ||
| 1858 | gnus-newsgroup-name '(nnir "nnir"))))) | ||
| 1859 | (with-current-buffer gnus-group-buffer | ||
| 1860 | (gnus-group-make-group | ||
| 1861 | name method nil | ||
| 1862 | (gnus-group-find-parameter pgroup))))) | ||
| 1863 | |||
| 1843 | 1864 | ||
| 1844 | (deffoo nnir-request-create-group (group &optional server args) | 1865 | (deffoo nnir-request-create-group (group &optional server args) |
| 1845 | (message "Creating nnir group %s" group) | 1866 | (message "Creating nnir group %s" group) |
| 1846 | (let ((group (gnus-group-prefixed-name group '(nnir "nnir"))) | 1867 | (let* ((group (gnus-group-prefixed-name group '(nnir "nnir"))) |
| 1847 | (query-spec | 1868 | (specs (assoc 'nnir-specs args)) |
| 1848 | (list (cons 'query | 1869 | (query-spec |
| 1849 | (read-string "Query: " nil 'nnir-search-history)))) | 1870 | (or (cdr (assoc 'nnir-query-spec specs)) |
| 1850 | (group-spec (list (list (read-string "Server: " nil nil))))) | 1871 | (list (cons 'query |
| 1851 | (gnus-group-set-parameter | 1872 | (read-string "Query: " nil 'nnir-search-history))))) |
| 1852 | group 'nnir-specs | 1873 | (group-spec |
| 1853 | (list (cons 'nnir-query-spec query-spec) | 1874 | (or (cdr (assoc 'nnir-group-spec specs)) |
| 1854 | (cons 'nnir-group-spec group-spec))) | 1875 | (list (list (read-string "Server: " nil nil))))) |
| 1876 | (nnir-specs (list (cons 'nnir-query-spec query-spec) | ||
| 1877 | (cons 'nnir-group-spec group-spec)))) | ||
| 1878 | (gnus-group-set-parameter group 'nnir-specs nnir-specs) | ||
| 1855 | (gnus-group-set-parameter | 1879 | (gnus-group-set-parameter |
| 1856 | group 'nnir-artlist | 1880 | group 'nnir-artlist |
| 1857 | (setq nnir-artlist | 1881 | (or (cdr (assoc 'nnir-artlist args)) |
| 1858 | (nnir-run-query | 1882 | (nnir-run-query nnir-specs))) |
| 1859 | (list (cons 'nnir-query-spec query-spec) | ||
| 1860 | (cons 'nnir-group-spec group-spec))))) | ||
| 1861 | (nnir-request-update-info group (gnus-get-info group))) | 1883 | (nnir-request-update-info group (gnus-get-info group))) |
| 1862 | t) | 1884 | t) |
| 1863 | 1885 | ||