From: tsuchiya Date: Sun, 2 May 2004 01:29:29 +0000 (+0000) Subject: (gnus-namazu-imap-group-prefix): Abolished. X-Git-Tag: t-gnus-6_17_4-quimby-~951 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fabb2b5947ffa87ee67e1fa80854eee3db46e97;p=elisp%2Fgnus.git- (gnus-namazu-imap-group-prefix): Abolished. (gnus-namazu-imap-maildir): Abolished. (gnus-namazu-remote-groups): New option. (gnus-namazu/call-namazu): Simplified. (gnus-namazu/make-directory-table): Refer the above option. (gnus-namazu/search): Cancel the last change to support IMAP. (gnus-namazu-update-index): Ditto. (gnus-namazu-update-indices): Ditto. --- diff --git a/ChangeLog b/ChangeLog index 8abacae..5a4d1a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-05-02 TSUCHIYA Masatoshi + + * gnus-namazu.el (gnus-namazu-imap-group-prefix): Abolished. + (gnus-namazu-imap-maildir): Abolished. + (gnus-namazu-remote-groups): New option. + (gnus-namazu/call-namazu): Simplified. + (gnus-namazu/make-directory-table): Refer the above option. + (gnus-namazu/search): Cancel the last change to support IMAP. + (gnus-namazu-update-index): Ditto. + (gnus-namazu-update-indices): Ditto. + 2004-04-27 Katsumi Yamaoka * lisp/dgnushack.el (describe-key-briefly): Remove compiler macro. diff --git a/lisp/gnus-namazu.el b/lisp/gnus-namazu.el index 836fbdc..f6ab885 100644 --- a/lisp/gnus-namazu.el +++ b/lisp/gnus-namazu.el @@ -139,6 +139,18 @@ :type 'string :group 'gnus-namazu) +(defcustom gnus-namazu-command-prefix nil + "*Prefix commands to execute Namazu. +If you put your index on a remote server, set this option as follows: + + (setq gnus-namazu-command-prefix + '(\"ssh\" \"-x\" \"remote-server\")) + +This makes gnus-namazu execute \"ssh -x remote-server namazu ...\" +instead of executing \"namazu\" directly." + :type '(repeat string) + :group 'gnus-namazu) + (defcustom gnus-namazu-additional-arguments nil "*Additional arguments of Namazu. The options `-q', `-a', and `-l' are always used, very few other @@ -211,23 +223,23 @@ options make any sense in this context." "Face used for namazu query matching words." :group 'gnus-namazu) -(defcustom gnus-namazu-command-prefix nil - "*Prefix command, -if set '(\"ssh\" \"-x\" \"host\"), -then execute \"ssh -x host namazu ...\"" - :type '(repeat string) - :group 'gnus-namazu) +(defcustom gnus-namazu-remote-groups nil + "*Alist of regular expressions matching remote groups and their base paths. +If you use an IMAP server and have a apecial index, set this option as +follows: -(defcustom gnus-namazu-imap-group-prefix nil - "*Prefix of imap group name. -ex. nnimap+server:INBOX." - :type 'string - :group 'gnus-namazu) + (setq gnus-namazu-remote-groups + '((\"^nnimap\\\\+server:INBOX\\\\.\" . \"~/Maildir/.\"))) -(defcustom gnus-namazu-imap-maildir nil - "*Maildir directory name." - :type 'string - :group 'gnus-namazu) +This means that the group \"nnimap+server:INBOX.group\" is placed in +\"~/Maildir/.group\"." + :group 'gnus-namazu + :type '(repeat + (cons (regexp :tag "Regexp of group name") + (string :tag "Base path of groups"))) + :set (lambda (symbol value) + (prog1 (set-default symbol value) + (gnus-namazu/make-directory-table)))) ;;; Internal Variable: (defconst gnus-namazu/group-name-regexp "\\`nnvirtual:namazu-search\\?") @@ -312,31 +324,17 @@ ex. nnimap+server:INBOX." (default-process-coding-system (cons gnus-namazu-coding-system gnus-namazu-coding-system)) program-coding-system-alist - (file-name-coding-system gnus-namazu-coding-system)) - (if gnus-namazu-command-prefix - (apply 'call-process - (append - (list (car gnus-namazu-command-prefix)) - '(nil t nil) - (cdr gnus-namazu-command-prefix) - `(,gnus-namazu-command - "-q" ; don't be verbose - "-a" ; show all matches - "-l" ; use list format - ,@gnus-namazu-additional-arguments - ,query - ,@gnus-namazu-index-directories))) - (apply 'call-process - `(,gnus-namazu-command - nil ; input from /dev/null - t ; output - nil ; don't redisplay - "-q" ; don't be verbose - "-a" ; show all matches - "-l" ; use list format - ,@gnus-namazu-additional-arguments - ,query - ,@gnus-namazu-index-directories))))) + (file-name-coding-system gnus-namazu-coding-system) + (commands + (append gnus-namazu-command-prefix + (list gnus-namazu-command + "-q" ; don't be verbose + "-a" ; show all matches + "-l") ; use list format + gnus-namazu-additional-arguments + (list query) + gnus-namazu-index-directories))) + (apply 'call-process (car commands) nil t nil (cdr commands)))) (defvar gnus-namazu/directory-table nil) (defun gnus-namazu/make-directory-table (&optional force) @@ -363,7 +361,14 @@ ex. nnimap+server:INBOX." (setq dir (nnmail-group-pathname (gnus-group-short-name group) (gnus-namazu/server-directory method)))) - (push (cons dir group) alist))))) + (push (cons dir group) alist))) + (dolist (pair gnus-namazu-remote-groups) + (when (string-match (car pair) group) + (setq dir (nnmail-group-pathname + (substring group (match-end 0)) + "/")) + (push (cons (concat (cdr dir) (substring dir 1)) group) + alist))))) gnus-newsrc-hashtb) (dolist (pair (nconc agent cache alist)) (set (intern (if gnus-namazu-case-sensitive-filesystem @@ -392,22 +397,12 @@ ex. nnimap+server:INBOX." ;; as file names of articles. (skip-chars-backward "0-9") (point)))) - (and (if (not gnus-namazu-imap-maildir) - (setq group - (symbol-value - (intern-soft (if gnus-namazu-case-sensitive-filesystem - group - (downcase group)) - (cdr gnus-namazu/directory-table)))) - ;; FIXME: - ;; gnus-select-method is '(nnimap "server") - ;; nnimap+server:INBOX.group = ~/Maildir/.group - ;; Namazu resault: ~/Maildir/.group/123 - (setq group (and (string-match - (concat gnus-namazu-imap-maildir - "/\\.\\(.*\\)/") group) - (concat gnus-namazu-imap-group-prefix - (match-string 1 group))))) + (and (setq group + (symbol-value + (intern-soft (if gnus-namazu-case-sensitive-filesystem + group + (downcase group)) + (cdr gnus-namazu/directory-table)))) (or (not groups) (member group groups)) (push (gnus-namazu/make-article @@ -794,8 +789,7 @@ than the period that is set to `gnus-namazu-index-update-interval'" (mapcar 'list gnus-namazu-index-directories) nil t) (gnus-namazu/default-index-directory)) t)) - (when (and (not gnus-namazu-imap-maildir) - (setq directory (gnus-namazu/update-p directory force))) + (when (setq directory (gnus-namazu/update-p directory force)) (with-current-buffer (get-buffer-create (concat " *mknmz*" directory)) (buffer-disable-undo) (erase-buffer) @@ -830,11 +824,10 @@ than the period that is set to `gnus-namazu-index-update-interval'" (gnus-namazu-update-indices gnus-namazu-index-directories force)) (defun gnus-namazu-update-indices (&optional directories force) - (when (and (not gnus-namazu-imap-maildir) - (setq directories - (delq nil (mapcar (lambda (d) - (gnus-namazu/update-p d force)) - directories)))) + (when (setq directories + (delq nil (mapcar (lambda (d) + (gnus-namazu/update-p d force)) + directories))) (setq gnus-namazu/update-directories (cons force (cdr directories))) (gnus-namazu-update-index (car directories) force)))