aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGnus developers2011-07-05 22:27:16 +0000
committerKatsumi Yamaoka2011-07-05 22:27:16 +0000
commitd30dd079c92097ac9eee48d574ce609da778b50f (patch)
treecac68c7b7f6811d28ccd8257459c2ca50ea6a7a7 /lisp
parent0e4260bf5d321e16e1a0261b10a6305ac06819ff (diff)
downloademacs-d30dd079c92097ac9eee48d574ce609da778b50f.tar.gz
emacs-d30dd079c92097ac9eee48d574ce609da778b50f.zip
Merge changes made in Gnus trunk.
gnus.texi (Expiring Mail): Document gnus-auto-expirable-marks. nnir.el (nnir-notmuch-program, nnir-notmuch-additional-switches, nnir-notmuch-remove-prefix, nnir-engines, nnir-run-notmuch): New nnir `notmuch' backend. mm-decode.el (mm-text-html-renderer): Doc fix. gnus-msg.el (gnus-bug): Fix the MML tag. pop3.el (pop3-open-server): -ERR is a valid response to CAPA. gnus-start.el (gnus-get-unread-articles): Don't connect to the secondary methods if started with `gnus-no-server'. gnus-group.el (gnus-read-ephemeral-bug-group): Allow fetching several bug reports at once.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/gnus/ChangeLog19
-rw-r--r--lisp/gnus/gnus-group.el23
-rw-r--r--lisp/gnus/gnus-msg.el8
-rw-r--r--lisp/gnus/gnus-start.el17
-rw-r--r--lisp/gnus/mm-decode.el14
-rw-r--r--lisp/gnus/nnir.el101
-rw-r--r--lisp/gnus/pop3.el2
7 files changed, 155 insertions, 29 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index f8d1a74ead0..439d51fdce5 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -3,6 +3,25 @@
3 * gnus.el (gnus-refer-article-method): Remove mention of nnspool, which 3 * gnus.el (gnus-refer-article-method): Remove mention of nnspool, which
4 no longer is much used. 4 no longer is much used.
5 5
62011-04-03 Kan-Ru Chen <kanru@kanru.info>
7
8 * nnir.el (nnir-notmuch-program, nnir-notmuch-additional-switches)
9 (nnir-notmuch-remove-prefix, nnir-engines, nnir-run-notmuch): New nnir
10 `notmuch' backend.
11
122011-07-05 Lars Magne Ingebrigtsen <larsi@gnus.org>
13
14 * mm-decode.el (mm-text-html-renderer): Doc fix.
15
16 * gnus-msg.el (gnus-bug): Fix the MML tag.
17
18 * pop3.el (pop3-open-server): -ERR is a valid response to CAPA.
19
202011-07-05 Daiki Ueno <ueno@unixuser.org>
21
22 * gnus-start.el (gnus-get-unread-articles): Don't connect to the
23 secondary methods if started with `gnus-no-server'.
24
62011-07-05 Juanma Barranquero <lekktu@gmail.com> 252011-07-05 Juanma Barranquero <lekktu@gmail.com>
7 26
8 * message.el (message-return-action): Fix typo in docstring. 27 * message.el (message-return-action): Fix typo in docstring.
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 83383186ca9..da6550c1680 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -2428,25 +2428,28 @@ the bug number, and browsing the URL must return mbox output."
2428 :version "24.1" 2428 :version "24.1"
2429 :type '(repeat (cons (symbol) (string :tag "URL format string")))) 2429 :type '(repeat (cons (symbol) (string :tag "URL format string"))))
2430 2430
2431(defun gnus-read-ephemeral-bug-group (number mbox-url &optional window-conf) 2431(defun gnus-read-ephemeral-bug-group (ids mbox-url &optional window-conf)
2432 "Browse bug NUMBER as ephemeral group." 2432 "Browse bug NUMBER as ephemeral group."
2433 (interactive (list (read-string "Enter bug number: " 2433 (interactive (list (read-string "Enter bug number: "
2434 (thing-at-point 'word) nil) 2434 (thing-at-point 'word) nil)
2435 ;; FIXME: Add completing-read from 2435 ;; FIXME: Add completing-read from
2436 ;; `gnus-emacs-bug-group-download-format' ... 2436 ;; `gnus-emacs-bug-group-download-format' ...
2437 (cdr (assoc 'emacs gnus-bug-group-download-format-alist)))) 2437 (cdr (assoc 'emacs gnus-bug-group-download-format-alist))))
2438 (when (stringp number) 2438 (when (stringp ids)
2439 (setq number (string-to-number number))) 2439 (setq ids (string-to-number ids)))
2440 (unless (listp ids)
2441 (setq ids (list ids)))
2440 (let ((tmpfile (mm-make-temp-file "gnus-temp-group-")) 2442 (let ((tmpfile (mm-make-temp-file "gnus-temp-group-"))
2441 (coding-system-for-write 'binary) 2443 (coding-system-for-write 'binary)
2442 (coding-system-for-read 'binary)) 2444 (coding-system-for-read 'binary))
2443 (with-temp-file tmpfile 2445 (with-temp-file tmpfile
2444 (url-insert-file-contents (format mbox-url number)) 2446 (dolist (id ids)
2447 (url-insert-file-contents (format mbox-url id)))
2445 (goto-char (point-min)) 2448 (goto-char (point-min))
2446 ;; Add the debbugs address so that we can respond to reports easily. 2449 ;; Add the debbugs address so that we can respond to reports easily.
2447 (while (re-search-forward "^To: " nil t) 2450 (while (re-search-forward "^To: " nil t)
2448 (end-of-line) 2451 (end-of-line)
2449 (insert (format ", %s@%s" number 2452 (insert (format ", %s@%s" (car ids)
2450 (gnus-replace-in-string 2453 (gnus-replace-in-string
2451 (gnus-replace-in-string mbox-url "^http://" "") 2454 (gnus-replace-in-string mbox-url "^http://" "")
2452 "/.*$" "")))) 2455 "/.*$" ""))))
@@ -2466,19 +2469,21 @@ the bug number, and browsing the URL must return mbox output."
2466 number 2469 number
2467 (cdr (assoc 'debian gnus-bug-group-download-format-alist)))) 2470 (cdr (assoc 'debian gnus-bug-group-download-format-alist))))
2468 2471
2469(defun gnus-read-ephemeral-emacs-bug-group (number &optional window-conf) 2472(defun gnus-read-ephemeral-emacs-bug-group (ids &optional window-conf)
2470 "Browse Emacs bug NUMBER as ephemeral group." 2473 "Browse Emacs bugs IDS as an ephemeral group."
2471 (interactive (list (string-to-number 2474 (interactive (list (string-to-number
2472 (read-string "Enter bug number: " 2475 (read-string "Enter bug number: "
2473 (thing-at-point 'word) nil)))) 2476 (thing-at-point 'word) nil))))
2477 (unless (listp ids)
2478 (setq ids (list ids)))
2474 (gnus-read-ephemeral-bug-group 2479 (gnus-read-ephemeral-bug-group
2475 number 2480 ids
2476 (cdr (assoc 'emacs gnus-bug-group-download-format-alist)) 2481 (cdr (assoc 'emacs gnus-bug-group-download-format-alist))
2477 window-conf) 2482 window-conf)
2478 (when (boundp 'debbugs-summary-mode) 2483 (when (boundp 'debbugs-summary-mode)
2479 (with-current-buffer (window-buffer (selected-window)) 2484 (with-current-buffer (window-buffer (selected-window))
2480 (debbugs-summary-mode 1) 2485 (debbugs-summary-mode 1)
2481 (set (make-local-variable 'debbugs-bug-number) number)))) 2486 (set (make-local-variable 'debbugs-bug-number) (car ids)))))
2482 2487
2483(defun gnus-group-jump-to-group (group &optional prompt) 2488(defun gnus-group-jump-to-group (group &optional prompt)
2484 "Jump to newsgroup GROUP. 2489 "Jump to newsgroup GROUP.
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index b265a681eb8..bad474b4057 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -1480,10 +1480,10 @@ If YANK is non-nil, include the original article."
1480 (erase-buffer) 1480 (erase-buffer)
1481 (gnus-debug) 1481 (gnus-debug)
1482 (setq text (buffer-string))) 1482 (setq text (buffer-string)))
1483 (insert (concat "<#part type=application/emacs-lisp" 1483 (insert "<#part type=application/emacs-lisp "
1484 "disposition=inline description=\"User settings\">\n" 1484 "disposition=inline description=\"User settings\">\n"
1485 text 1485 text
1486 "\n<#/part>"))) 1486 "\n<#/part>"))
1487 (goto-char (point-min)) 1487 (goto-char (point-min))
1488 (search-forward "Subject: " nil t) 1488 (search-forward "Subject: " nil t)
1489 (message ""))) 1489 (message "")))
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index aa9af012a1c..7c63d5e2653 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -1043,7 +1043,7 @@ If LEVEL is non-nil, the news will be set up at level LEVEL."
1043 1043
1044 ;; Find the number of unread articles in each non-dead group. 1044 ;; Find the number of unread articles in each non-dead group.
1045 (let ((gnus-read-active-file (and (not level) gnus-read-active-file))) 1045 (let ((gnus-read-active-file (and (not level) gnus-read-active-file)))
1046 (gnus-get-unread-articles level)))) 1046 (gnus-get-unread-articles level dont-connect))))
1047 1047
1048(defun gnus-call-subscribe-functions (method group) 1048(defun gnus-call-subscribe-functions (method group)
1049 "Call METHOD to subscribe GROUP. 1049 "Call METHOD to subscribe GROUP.
@@ -1606,7 +1606,7 @@ If SCAN, request a scan of that group as well."
1606 1606
1607;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb' 1607;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb'
1608;; and compute how many unread articles there are in each group. 1608;; and compute how many unread articles there are in each group.
1609(defun gnus-get-unread-articles (&optional level) 1609(defun gnus-get-unread-articles (&optional level dont-connect)
1610 (setq gnus-server-method-cache nil) 1610 (setq gnus-server-method-cache nil)
1611 (require 'gnus-agent) 1611 (require 'gnus-agent)
1612 (let* ((newsrc (cdr gnus-newsrc-alist)) 1612 (let* ((newsrc (cdr gnus-newsrc-alist))
@@ -1702,12 +1702,13 @@ If SCAN, request a scan of that group as well."
1702 1702
1703 ;; If we have primary/secondary select methods, but no groups from 1703 ;; If we have primary/secondary select methods, but no groups from
1704 ;; them, we still want to issue a retrieval request from them. 1704 ;; them, we still want to issue a retrieval request from them.
1705 (dolist (method (cons gnus-select-method 1705 (unless dont-connect
1706 gnus-secondary-select-methods)) 1706 (dolist (method (cons gnus-select-method
1707 (when (and (not (assoc method type-cache)) 1707 gnus-secondary-select-methods))
1708 (gnus-check-backend-function 'request-list (car method))) 1708 (when (and (not (assoc method type-cache))
1709 (with-current-buffer nntp-server-buffer 1709 (gnus-check-backend-function 'request-list (car method)))
1710 (gnus-read-active-file-1 method nil)))) 1710 (with-current-buffer nntp-server-buffer
1711 (gnus-read-active-file-1 method nil)))))
1711 1712
1712 ;; Start early async retrieval of data. 1713 ;; Start early async retrieval of data.
1713 (let ((done-methods nil) 1714 (let ((done-methods nil)
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index f543920446b..a51c6630ac5 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -114,14 +114,14 @@
114 "Render of HTML contents. 114 "Render of HTML contents.
115It is one of defined renderer types, or a rendering function. 115It is one of defined renderer types, or a rendering function.
116The defined renderer types are: 116The defined renderer types are:
117`shr': use Gnus simple HTML renderer; 117`shr': use the built-in Gnus HTML renderer;
118`gnus-w3m' : use Gnus renderer based on w3m; 118`gnus-w3m': use Gnus renderer based on w3m;
119`w3m' : use emacs-w3m; 119`w3m': use emacs-w3m;
120`w3m-standalone': use w3m; 120`w3m-standalone': use plain w3m;
121`links': use links; 121`links': use links;
122`lynx' : use lynx; 122`lynx': use lynx;
123`w3' : use Emacs/W3; 123`w3': use Emacs/W3;
124`html2text' : use html2text; 124`html2text': use html2text;
125nil : use external viewer (default web browser)." 125nil : use external viewer (default web browser)."
126 :version "24.1" 126 :version "24.1"
127 :type '(choice (const shr) 127 :type '(choice (const shr)
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el
index 71b85183e0f..8099cc2a7cc 100644
--- a/lisp/gnus/nnir.el
+++ b/lisp/gnus/nnir.el
@@ -499,6 +499,31 @@ arrive at the correct group name, \"mail.misc\"."
499 :type '(directory) 499 :type '(directory)
500 :group 'nnir) 500 :group 'nnir)
501 501
502(defcustom nnir-notmuch-program "notmuch"
503 "*Name of notmuch search executable."
504 :type '(string)
505 :group 'nnir)
506
507(defcustom nnir-notmuch-additional-switches '()
508 "*A list of strings, to be given as additional arguments to notmuch.
509
510Note that this should be a list. Ie, do NOT use the following:
511 (setq nnir-notmuch-additional-switches \"-i -w\") ; wrong
512Instead, use this:
513 (setq nnir-notmuch-additional-switches '(\"-i\" \"-w\"))"
514 :type '(repeat (string))
515 :group 'nnir)
516
517(defcustom nnir-notmuch-remove-prefix (concat (getenv "HOME") "/Mail/")
518 "*The prefix to remove from each file name returned by notmuch
519in order to get a group name (albeit with / instead of .). This is a
520regular expression.
521
522This variable is very similar to `nnir-namazu-remove-prefix', except
523that it is for notmuch, not Namazu."
524 :type '(regexp)
525 :group 'nnir)
526
502;;; Developer Extension Variable: 527;;; Developer Extension Variable:
503 528
504(defvar nnir-engines 529(defvar nnir-engines
@@ -519,6 +544,8 @@ arrive at the correct group name, \"mail.misc\"."
519 ((group . "Swish-e Group spec: "))) 544 ((group . "Swish-e Group spec: ")))
520 (namazu nnir-run-namazu 545 (namazu nnir-run-namazu
521 ()) 546 ())
547 (notmuch nnir-run-notmuch
548 ())
522 (hyrex nnir-run-hyrex 549 (hyrex nnir-run-hyrex
523 ((group . "Hyrex Group spec: "))) 550 ((group . "Hyrex Group spec: ")))
524 (find-grep nnir-run-find-grep 551 (find-grep nnir-run-find-grep
@@ -1338,6 +1365,80 @@ Tested with Namazu 2.0.6 on a GNU/Linux system."
1338 (> (nnir-artitem-rsv x) 1365 (> (nnir-artitem-rsv x)
1339 (nnir-artitem-rsv y))))))))) 1366 (nnir-artitem-rsv y)))))))))
1340 1367
1368(defun nnir-run-notmuch (query server &optional group)
1369 "Run QUERY against notmuch.
1370Returns a vector of (group name, file name) pairs (also vectors,
1371actually)."
1372
1373 ;; (when group
1374 ;; (error "The notmuch backend cannot search specific groups"))
1375
1376 (save-excursion
1377 (let ( (qstring (cdr (assq 'query query)))
1378 (groupspec (cdr (assq 'group query)))
1379 (prefix (nnir-read-server-parm 'nnir-notmuch-remove-prefix server))
1380 artlist
1381 (article-pattern (if (string= (gnus-group-server server) "nnmaildir")
1382 ":[0-9]+"
1383 "^[0-9]+$"))
1384 artno dirnam filenam)
1385
1386 (when (equal "" qstring)
1387 (error "notmuch: You didn't enter anything"))
1388
1389 (set-buffer (get-buffer-create nnir-tmp-buffer))
1390 (erase-buffer)
1391
1392 (if groupspec
1393 (message "Doing notmuch query %s on %s..." qstring groupspec)
1394 (message "Doing notmuch query %s..." qstring))
1395
1396 (let* ((cp-list `( ,nnir-notmuch-program
1397 nil ; input from /dev/null
1398 t ; output
1399 nil ; don't redisplay
1400 "search"
1401 "--format=text"
1402 "--output=files"
1403 ,@(nnir-read-server-parm 'nnir-notmuch-additional-switches server)
1404 ,qstring ; the query, in notmuch format
1405 ))
1406 (exitstatus
1407 (progn
1408 (message "%s args: %s" nnir-notmuch-program
1409 (mapconcat 'identity (cddddr cp-list) " ")) ;; ???
1410 (apply 'call-process cp-list))))
1411 (unless (or (null exitstatus)
1412 (zerop exitstatus))
1413 (nnheader-report 'nnir "Couldn't run notmuch: %s" exitstatus)
1414 ;; notmuch failure reason is in this buffer, show it if
1415 ;; the user wants it.
1416 (when (> gnus-verbose 6)
1417 (display-buffer nnir-tmp-buffer))))
1418
1419 ;; The results are output in the format of:
1420 ;; absolute-path-name
1421 (goto-char (point-min))
1422 (while (not (eobp))
1423 (setq filenam (buffer-substring-no-properties (line-beginning-position)
1424 (line-end-position))
1425 artno (file-name-nondirectory filenam)
1426 dirnam (file-name-directory filenam))
1427 (forward-line 1)
1428
1429 ;; don't match directories
1430 (when (string-match article-pattern artno)
1431 (when (not (null dirnam))
1432
1433 ;; maybe limit results to matching groups.
1434 (when (or (not groupspec)
1435 (string-match groupspec dirnam))
1436 (nnir-add-result dirnam artno "" prefix server artlist)))))
1437
1438 (message "Massaging notmuch output...done")
1439
1440 artlist)))
1441
1341(defun nnir-run-find-grep (query server &optional grouplist) 1442(defun nnir-run-find-grep (query server &optional grouplist)
1342 "Run find and grep to obtain matching articles." 1443 "Run find and grep to obtain matching articles."
1343 (let* ((method (gnus-server-to-method server)) 1444 (let* ((method (gnus-server-to-method server))
diff --git a/lisp/gnus/pop3.el b/lisp/gnus/pop3.el
index b485ac39f60..e29ddb0d44e 100644
--- a/lisp/gnus/pop3.el
+++ b/lisp/gnus/pop3.el
@@ -307,7 +307,7 @@ Returns the process associated with the connection."
307 (or pop3-stream-type 'network))) 307 (or pop3-stream-type 'network)))
308 :capability-command "CAPA\r\n" 308 :capability-command "CAPA\r\n"
309 :end-of-command "^\\(-ERR\\|+OK \\).*\n" 309 :end-of-command "^\\(-ERR\\|+OK \\).*\n"
310 :end-of-capability "^\\.\r?\n" 310 :end-of-capability "^\\.\r?\n\\|^-ERR"
311 :success "^\\+OK.*\n" 311 :success "^\\+OK.*\n"
312 :return-list t 312 :return-list t
313 :starttls-function 313 :starttls-function