diff options
| author | Gnus developers | 2010-12-13 22:29:12 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2010-12-13 22:29:12 +0000 |
| commit | 7410c2700a7c3256a117ce9d1d3dbcd934a57589 (patch) | |
| tree | fcc0cca3c89e1a46e5cfb8813403afd877612c82 | |
| parent | bc5576723b2ddaa0b4cb6a6ba368fa71bc5a8a0c (diff) | |
| download | emacs-7410c2700a7c3256a117ce9d1d3dbcd934a57589.tar.gz emacs-7410c2700a7c3256a117ce9d1d3dbcd934a57589.zip | |
Merge changes made in Gnus trunk.
nnir.el (nnir-run-imap): Return article list in UID order.
gnus-start.el (gnus-auto-subscribed-groups): Add nnimap to the list of automatically subscribed groups.
(gnus-auto-subscribed-categories): New variable.
(gnus-matches-options-n): Use it.
(gnus-default-subscribed-newsgroups): Remove unused variable.
(gnus-start-draft-setup): Message a bit less.
gnus-agent.el (gnus-agentize): Don't create the queue group automatically on startup. It'll be created later, if needed.
gnus-start.el (gnus-1): Clarify comment.
(gnus-matches-options-n): Fix typo in last change.
(gnus-1): Don't create the nndrafts group twice.
(gnus-setup-news): There's no need to read the active file here, since that's done again later on a per-backend basis.
(gnus-start-draft-setup): Make sure that the new group is started out empty.
netrc.el (netrc-point-at-eol): Remove the unused netrc-point-at-old and netrc-bound-and-true-p bindings.
(netrc-parse): Cache the netrc contents.
| -rw-r--r-- | doc/misc/ChangeLog | 7 | ||||
| -rw-r--r-- | doc/misc/gnus.texi | 44 | ||||
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/gnus/ChangeLog | 24 | ||||
| -rw-r--r-- | lisp/gnus/gnus-agent.el | 1 | ||||
| -rw-r--r-- | lisp/gnus/gnus-start.el | 56 | ||||
| -rw-r--r-- | lisp/gnus/nnir.el | 2 | ||||
| -rw-r--r-- | lisp/net/netrc.el | 26 |
8 files changed, 84 insertions, 82 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 9d3b578fc95..68895409743 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2010-12-13 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * gnus.texi (Filtering New Groups): Mention | ||
| 4 | gnus-auto-subscribed-categories. | ||
| 5 | (The First Time): Removed, since default-subscribed-newsgroups has been | ||
| 6 | removed. | ||
| 7 | |||
| 1 | 2010-12-13 Glenn Morris <rgm@gnu.org> | 8 | 2010-12-13 Glenn Morris <rgm@gnu.org> |
| 2 | 9 | ||
| 3 | * cl.texi (For Clauses): Small fixes for frames and windows. | 10 | * cl.texi (For Clauses): Small fixes for frames and windows. |
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 9f4d1f75ede..3ddfb1a6448 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi | |||
| @@ -428,7 +428,6 @@ Other related manuals | |||
| 428 | Starting Gnus | 428 | Starting Gnus |
| 429 | 429 | ||
| 430 | * Finding the News:: Choosing a method for getting news. | 430 | * Finding the News:: Choosing a method for getting news. |
| 431 | * The First Time:: What does Gnus do the first time you start it? | ||
| 432 | * The Server is Down:: How can I read my mail then? | 431 | * The Server is Down:: How can I read my mail then? |
| 433 | * Slave Gnusae:: You can have more than one Gnus active at a time. | 432 | * Slave Gnusae:: You can have more than one Gnus active at a time. |
| 434 | * Fetching a Group:: Starting Gnus just to read a group. | 433 | * Fetching a Group:: Starting Gnus just to read a group. |
| @@ -959,7 +958,6 @@ terminology section (@pxref{Terminology}). | |||
| 959 | 958 | ||
| 960 | @menu | 959 | @menu |
| 961 | * Finding the News:: Choosing a method for getting news. | 960 | * Finding the News:: Choosing a method for getting news. |
| 962 | * The First Time:: What does Gnus do the first time you start it? | ||
| 963 | * The Server is Down:: How can I read my mail then? | 961 | * The Server is Down:: How can I read my mail then? |
| 964 | * Slave Gnusae:: You can have more than one Gnus active at a time. | 962 | * Slave Gnusae:: You can have more than one Gnus active at a time. |
| 965 | * New Groups:: What is Gnus supposed to do with new groups? | 963 | * New Groups:: What is Gnus supposed to do with new groups? |
| @@ -1052,31 +1050,6 @@ several Gnus installations, but may slow down things a bit when fetching | |||
| 1052 | new articles. @xref{NNTP marks}, for more information. | 1050 | new articles. @xref{NNTP marks}, for more information. |
| 1053 | 1051 | ||
| 1054 | 1052 | ||
| 1055 | @node The First Time | ||
| 1056 | @section The First Time | ||
| 1057 | @cindex first time usage | ||
| 1058 | |||
| 1059 | If no startup files exist (@pxref{Startup Files}), Gnus will try to | ||
| 1060 | determine what groups should be subscribed by default. | ||
| 1061 | |||
| 1062 | @vindex gnus-default-subscribed-newsgroups | ||
| 1063 | If the variable @code{gnus-default-subscribed-newsgroups} is set, Gnus | ||
| 1064 | will subscribe you to just those groups in that list, leaving the rest | ||
| 1065 | killed. Your system administrator should have set this variable to | ||
| 1066 | something useful. | ||
| 1067 | |||
| 1068 | Since she hasn't, Gnus will just subscribe you to a few arbitrarily | ||
| 1069 | picked groups (i.e., @samp{*.newusers}). (@dfn{Arbitrary} is defined | ||
| 1070 | here as @dfn{whatever Lars thinks you should read}.) | ||
| 1071 | |||
| 1072 | You'll also be subscribed to the Gnus documentation group, which should | ||
| 1073 | help you with most common problems. | ||
| 1074 | |||
| 1075 | If @code{gnus-default-subscribed-newsgroups} is @code{t}, Gnus will just | ||
| 1076 | use the normal functions for handling new groups, and not do anything | ||
| 1077 | special. | ||
| 1078 | |||
| 1079 | |||
| 1080 | @node The Server is Down | 1053 | @node The Server is Down |
| 1081 | @section The Server is Down | 1054 | @section The Server is Down |
| 1082 | @cindex server errors | 1055 | @cindex server errors |
| @@ -1321,11 +1294,18 @@ but I thought it would be nice to have two of these. This variable is | |||
| 1321 | more meant for setting some ground rules, while the other variable is | 1294 | more meant for setting some ground rules, while the other variable is |
| 1322 | used more for user fiddling. By default this variable makes all new | 1295 | used more for user fiddling. By default this variable makes all new |
| 1323 | groups that come from mail back ends (@code{nnml}, @code{nnbabyl}, | 1296 | groups that come from mail back ends (@code{nnml}, @code{nnbabyl}, |
| 1324 | @code{nnfolder}, @code{nnmbox}, @code{nnmh}, and @code{nnmaildir}) | 1297 | @code{nnfolder}, @code{nnmbox}, @code{nnmh}, @code{nnimap}, and |
| 1325 | subscribed. If you don't like that, just set this variable to | 1298 | @code{nnmaildir}) subscribed. If you don't like that, just set this |
| 1326 | @code{nil}. | 1299 | variable to @code{nil}. |
| 1327 | 1300 | ||
| 1328 | New groups that match this regexp are subscribed using | 1301 | @vindex gnus-auto-subscribed-categories |
| 1302 | As if that wasn't enough, @code{gnus-auto-subscribed-categories} also | ||
| 1303 | allows you to specify that new groups should be subcribed based on the | ||
| 1304 | category their select methods belong to. The default is @samp{(mail | ||
| 1305 | post-mail)}, meaning that all new groups from mail-like backends | ||
| 1306 | should be subscribed automatically. | ||
| 1307 | |||
| 1308 | New groups that match these variables are subscribed using | ||
| 1329 | @code{gnus-subscribe-options-newsgroup-method}. | 1309 | @code{gnus-subscribe-options-newsgroup-method}. |
| 1330 | 1310 | ||
| 1331 | 1311 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 10db215a989..59ca93809bb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -2,6 +2,12 @@ | |||
| 2 | 2 | ||
| 3 | * net/gnutls.el (gnutls-negotiate): Fix setting of default trustfiles. | 3 | * net/gnutls.el (gnutls-negotiate): Fix setting of default trustfiles. |
| 4 | 4 | ||
| 5 | 2010-12-13 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 6 | |||
| 7 | * net/netrc.el (netrc-point-at-eol): Remove the unused | ||
| 8 | netrc-point-at-old and netrc-bound-and-true-p bindings. | ||
| 9 | (netrc-parse): Cache the netrc contents. | ||
| 10 | |||
| 5 | 2010-12-13 Eli Zaretskii <eliz@gnu.org> | 11 | 2010-12-13 Eli Zaretskii <eliz@gnu.org> |
| 6 | 12 | ||
| 7 | * subr.el (posn-col-row): Evaluate header-line-format in the | 13 | * subr.el (posn-col-row): Evaluate header-line-format in the |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index d39f5330fd3..47350b34bad 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,5 +1,29 @@ | |||
| 1 | 2010-12-13 Lars Magne Ingebrigtsen <larsi@gnus.org> | 1 | 2010-12-13 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 2 | ||
| 3 | * gnus-start.el (gnus-matches-options-n): Fix typo in last change. | ||
| 4 | (gnus-1): Don't create the nndrafts group twice. | ||
| 5 | (gnus-setup-news): There's no need to read the active file here, since | ||
| 6 | that's done again later on a per-backend basis. | ||
| 7 | (gnus-start-draft-setup): Make sure that the new group is started out | ||
| 8 | empty. | ||
| 9 | |||
| 10 | * gnus-agent.el (gnus-agentize): Don't create the queue group | ||
| 11 | automatically on startup. It'll be created later, if needed. | ||
| 12 | |||
| 13 | * gnus-start.el (gnus-auto-subscribed-groups): Add nnimap to the list | ||
| 14 | of automatically subscribed groups. | ||
| 15 | (gnus-auto-subscribed-categories): New variable. | ||
| 16 | (gnus-matches-options-n): Use it. | ||
| 17 | (gnus-default-subscribed-newsgroups): Remove unused variable. | ||
| 18 | (gnus-start-draft-setup): Message a bit less. | ||
| 19 | |||
| 20 | 2010-12-13 Andrew Cohen <cohen@andy.bu.edu> | ||
| 21 | |||
| 22 | * nnir.el (nnir-run-imap): Return article list in order of increasing | ||
| 23 | UID. | ||
| 24 | |||
| 25 | 2010-12-13 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 26 | |||
| 3 | * gnus-sum.el (gnus-summary-enter-digest-group): Mention | 27 | * gnus-sum.el (gnus-summary-enter-digest-group): Mention |
| 4 | gnus-auto-select-on-ephemeral-exit. | 28 | gnus-auto-select-on-ephemeral-exit. |
| 5 | 29 | ||
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 8edfecde152..fbd86f2e6f5 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el | |||
| @@ -685,7 +685,6 @@ This will modify the `gnus-setup-news-hook', and | |||
| 685 | minor mode in all Gnus buffers." | 685 | minor mode in all Gnus buffers." |
| 686 | (interactive) | 686 | (interactive) |
| 687 | (gnus-open-agent) | 687 | (gnus-open-agent) |
| 688 | (add-hook 'gnus-setup-news-hook 'gnus-agent-queue-setup) | ||
| 689 | (unless gnus-agent-send-mail-function | 688 | (unless gnus-agent-send-mail-function |
| 690 | (setq gnus-agent-send-mail-function | 689 | (setq gnus-agent-send-mail-function |
| 691 | (or message-send-mail-real-function | 690 | (or message-send-mail-real-function |
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 8663d67fd0a..d9e432736e2 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el | |||
| @@ -86,14 +86,6 @@ If a file with the `.el' or `.elc' suffixes exists, it will be read instead." | |||
| 86 | :group 'gnus-start | 86 | :group 'gnus-start |
| 87 | :type '(choice file (const nil))) | 87 | :type '(choice file (const nil))) |
| 88 | 88 | ||
| 89 | (defcustom gnus-default-subscribed-newsgroups nil | ||
| 90 | "List of newsgroups to subscribe, when a user runs Gnus the first time. | ||
| 91 | The value should be a list of strings. | ||
| 92 | If it is t, Gnus will not do anything special the first time it is | ||
| 93 | started; it'll just use the normal newsgroups subscription methods." | ||
| 94 | :group 'gnus-start | ||
| 95 | :type '(choice (repeat string) (const :tag "Nothing special" t))) | ||
| 96 | |||
| 97 | (defcustom gnus-use-dribble-file t | 89 | (defcustom gnus-use-dribble-file t |
| 98 | "*Non-nil means that Gnus will use a dribble file to store user updates. | 90 | "*Non-nil means that Gnus will use a dribble file to store user updates. |
| 99 | If Emacs should crash without saving the .newsrc files, complete | 91 | If Emacs should crash without saving the .newsrc files, complete |
| @@ -341,8 +333,17 @@ hierarchy in its entirety." | |||
| 341 | :group 'gnus-group-new | 333 | :group 'gnus-group-new |
| 342 | :type 'boolean) | 334 | :type 'boolean) |
| 343 | 335 | ||
| 336 | (defcustom gnus-auto-subscribed-categories '(mail post-mail) | ||
| 337 | "*New groups from methods of these categories will be subscribed automatically. | ||
| 338 | Note that this variable only deals with new groups. It has no | ||
| 339 | effect whatsoever on old groups. The default is to automatically | ||
| 340 | subscribe all groups from mail-like backends." | ||
| 341 | :version "24.1" | ||
| 342 | :group 'gnus-group-new | ||
| 343 | :type '(repeat symbol)) | ||
| 344 | |||
| 344 | (defcustom gnus-auto-subscribed-groups | 345 | (defcustom gnus-auto-subscribed-groups |
| 345 | "^nnml\\|^nnfolder\\|^nnmbox\\|^nnmh\\|^nnbabyl\\|^nnmaildir" | 346 | "^nnml\\|^nnfolder\\|^nnmbox\\|^nnmh\\|^nnbabyl\\|^nnmaildir\\|^nnimap" |
| 346 | "*All new groups that match this regexp will be subscribed automatically. | 347 | "*All new groups that match this regexp will be subscribed automatically. |
| 347 | Note that this variable only deals with new groups. It has no effect | 348 | Note that this variable only deals with new groups. It has no effect |
| 348 | whatsoever on old groups. | 349 | whatsoever on old groups. |
| @@ -784,10 +785,9 @@ prompt the user for the name of an NNTP server to use." | |||
| 784 | (gnus-start-news-server (and arg (not level)))))) | 785 | (gnus-start-news-server (and arg (not level)))))) |
| 785 | (if (and (not dont-connect) | 786 | (if (and (not dont-connect) |
| 786 | (not did-connect)) | 787 | (not did-connect)) |
| 788 | ;; Couldn't connect to the server, so bail out. | ||
| 787 | (gnus-group-quit) | 789 | (gnus-group-quit) |
| 788 | (gnus-run-hooks 'gnus-startup-hook) | 790 | (gnus-run-hooks 'gnus-startup-hook) |
| 789 | ;; NNTP server is successfully open. | ||
| 790 | |||
| 791 | ;; Find the current startup file name. | 791 | ;; Find the current startup file name. |
| 792 | (setq gnus-current-startup-file | 792 | (setq gnus-current-startup-file |
| 793 | (gnus-make-newsrc-file gnus-startup-file)) | 793 | (gnus-make-newsrc-file gnus-startup-file)) |
| @@ -797,11 +797,10 @@ prompt the user for the name of an NNTP server to use." | |||
| 797 | (gnus-dribble-read-file)) | 797 | (gnus-dribble-read-file)) |
| 798 | 798 | ||
| 799 | ;; Do the actual startup. | 799 | ;; Do the actual startup. |
| 800 | (if gnus-agent | ||
| 801 | (gnus-request-create-group "queue" '(nndraft ""))) | ||
| 802 | (gnus-request-create-group "drafts" '(nndraft "")) | ||
| 803 | (gnus-setup-news nil level dont-connect) | 800 | (gnus-setup-news nil level dont-connect) |
| 804 | (gnus-run-hooks 'gnus-setup-news-hook) | 801 | (gnus-run-hooks 'gnus-setup-news-hook) |
| 802 | (when gnus-agent | ||
| 803 | (gnus-request-create-group "queue" '(nndraft ""))) | ||
| 805 | (gnus-start-draft-setup) | 804 | (gnus-start-draft-setup) |
| 806 | ;; Generate the group buffer. | 805 | ;; Generate the group buffer. |
| 807 | (gnus-group-list-groups level) | 806 | (gnus-group-list-groups level) |
| @@ -816,10 +815,10 @@ prompt the user for the name of an NNTP server to use." | |||
| 816 | (gnus-request-create-group "drafts" '(nndraft "")) | 815 | (gnus-request-create-group "drafts" '(nndraft "")) |
| 817 | (unless (gnus-group-entry "nndraft:drafts") | 816 | (unless (gnus-group-entry "nndraft:drafts") |
| 818 | (let ((gnus-level-default-subscribed 1)) | 817 | (let ((gnus-level-default-subscribed 1)) |
| 819 | (gnus-subscribe-group "nndraft:drafts" nil '(nndraft "")))) | 818 | (gnus-subscribe-group "nndraft:drafts" nil '(nndraft ""))) |
| 819 | (setcar (gnus-group-entry "nndraft:drafts") 0)) | ||
| 820 | (unless (equal (gnus-group-get-parameter "nndraft:drafts" 'gnus-dummy t) | 820 | (unless (equal (gnus-group-get-parameter "nndraft:drafts" 'gnus-dummy t) |
| 821 | '((gnus-draft-mode))) | 821 | '((gnus-draft-mode))) |
| 822 | (gnus-message 3 "Setting up drafts group") | ||
| 823 | (gnus-group-set-parameter | 822 | (gnus-group-set-parameter |
| 824 | "nndraft:drafts" 'gnus-dummy '((gnus-draft-mode))))) | 823 | "nndraft:drafts" 'gnus-dummy '((gnus-draft-mode))))) |
| 825 | 824 | ||
| @@ -996,27 +995,8 @@ If LEVEL is non-nil, the news will be set up at level LEVEL." | |||
| 996 | (when (or (null gnus-read-active-file) | 995 | (when (or (null gnus-read-active-file) |
| 997 | (eq gnus-read-active-file 'some)) | 996 | (eq gnus-read-active-file 'some)) |
| 998 | (gnus-update-active-hashtb-from-killed)) | 997 | (gnus-update-active-hashtb-from-killed)) |
| 999 | |||
| 1000 | ;; Validate agent covered methods now that gnus-server-alist has | ||
| 1001 | ;; been initialized. | ||
| 1002 | ;; NOTE: This is here for one purpose only. By validating the | ||
| 1003 | ;; agentized server's, it converts the old 5.10.3, and earlier, | ||
| 1004 | ;; format to the current format. That enables the agent code | ||
| 1005 | ;; within gnus-read-active-file to function correctly. | ||
| 1006 | (if gnus-agent | ||
| 1007 | (gnus-agent-read-servers-validate)) | ||
| 1008 | |||
| 1009 | ;; Read the active file and create `gnus-active-hashtb'. | ||
| 1010 | ;; If `gnus-read-active-file' is nil, then we just create an empty | ||
| 1011 | ;; hash table. The partial filling out of the hash table will be | ||
| 1012 | ;; done in `gnus-get-unread-articles'. | ||
| 1013 | (and gnus-read-active-file | ||
| 1014 | (not level) | ||
| 1015 | (gnus-read-active-file nil dont-connect)) | ||
| 1016 | |||
| 1017 | (unless gnus-active-hashtb | 998 | (unless gnus-active-hashtb |
| 1018 | (setq gnus-active-hashtb (gnus-make-hashtable 4096))) | 999 | (setq gnus-active-hashtb (gnus-make-hashtable 4096))) |
| 1019 | |||
| 1020 | ;; Initialize the cache. | 1000 | ;; Initialize the cache. |
| 1021 | (when gnus-use-cache | 1001 | (when gnus-use-cache |
| 1022 | (gnus-cache-open)) | 1002 | (gnus-cache-open)) |
| @@ -1158,6 +1138,12 @@ for new groups, and subscribe the new groups as zombies." | |||
| 1158 | ((and gnus-options-subscribe | 1138 | ((and gnus-options-subscribe |
| 1159 | (string-match gnus-options-subscribe group)) | 1139 | (string-match gnus-options-subscribe group)) |
| 1160 | 'subscribe) | 1140 | 'subscribe) |
| 1141 | ((let ((do-subscribe nil)) | ||
| 1142 | (dolist (category gnus-auto-subscribed-categories) | ||
| 1143 | (when (gnus-member-of-valid category group) | ||
| 1144 | (setq do-subscribe t))) | ||
| 1145 | do-subscribe) | ||
| 1146 | 'subscribe) | ||
| 1161 | ((and gnus-auto-subscribed-groups | 1147 | ((and gnus-auto-subscribed-groups |
| 1162 | (string-match gnus-auto-subscribed-groups group)) | 1148 | (string-match gnus-auto-subscribed-groups group)) |
| 1163 | 'subscribe) | 1149 | 'subscribe) |
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 3b1d3246c01..d3ec3d24b58 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el | |||
| @@ -804,7 +804,7 @@ details on the language and supported extensions" | |||
| 804 | (message "Searching %s... %d matches" group arts))) | 804 | (message "Searching %s... %d matches" group arts))) |
| 805 | (message "Searching %s...done" group)) | 805 | (message "Searching %s...done" group)) |
| 806 | (quit nil)) | 806 | (quit nil)) |
| 807 | artlist)) | 807 | (nreverse artlist))) |
| 808 | groups))))) | 808 | groups))))) |
| 809 | 809 | ||
| 810 | (defun nnir-imap-make-query (criteria qstring) | 810 | (defun nnir-imap-make-query (criteria qstring) |
diff --git a/lisp/net/netrc.el b/lisp/net/netrc.el index ff0b52c2b96..989470becad 100644 --- a/lisp/net/netrc.el +++ b/lisp/net/netrc.el | |||
| @@ -34,18 +34,6 @@ | |||
| 34 | ;;; .netrc and .authinfo rc parsing | 34 | ;;; .netrc and .authinfo rc parsing |
| 35 | ;;; | 35 | ;;; |
| 36 | 36 | ||
| 37 | (defalias 'netrc-point-at-eol | ||
| 38 | (if (fboundp 'point-at-eol) | ||
| 39 | 'point-at-eol | ||
| 40 | 'line-end-position)) | ||
| 41 | (eval-when-compile | ||
| 42 | ;; This is unnecessary in the compiled version as it is a macro. | ||
| 43 | (if (fboundp 'bound-and-true-p) | ||
| 44 | (defalias 'netrc-bound-and-true-p 'bound-and-true-p) | ||
| 45 | (defmacro netrc-bound-and-true-p (var) | ||
| 46 | "Return the value of symbol VAR if it is bound, else nil." | ||
| 47 | `(and (boundp (quote ,var)) ,var)))) | ||
| 48 | |||
| 49 | (defgroup netrc nil | 37 | (defgroup netrc nil |
| 50 | "Netrc configuration." | 38 | "Netrc configuration." |
| 51 | :group 'comm) | 39 | :group 'comm) |
| @@ -58,12 +46,15 @@ | |||
| 58 | (defvar netrc-services-file "/etc/services" | 46 | (defvar netrc-services-file "/etc/services" |
| 59 | "The name of the services file.") | 47 | "The name of the services file.") |
| 60 | 48 | ||
| 49 | (defvar netrc-cache nil) | ||
| 50 | |||
| 61 | (defun netrc-parse (&optional file) | 51 | (defun netrc-parse (&optional file) |
| 62 | (interactive "fFile to Parse: ") | 52 | (interactive "fFile to Parse: ") |
| 63 | "Parse FILE and return a list of all entries in the file." | 53 | "Parse FILE and return a list of all entries in the file." |
| 64 | (unless file | 54 | (unless file |
| 65 | (setq file netrc-file)) | 55 | (setq file netrc-file)) |
| 66 | (if (listp file) | 56 | (if (listp file) |
| 57 | ;; We got already parsed contents; just return it. | ||
| 67 | file | 58 | file |
| 68 | (when (file-exists-p file) | 59 | (when (file-exists-p file) |
| 69 | (with-temp-buffer | 60 | (with-temp-buffer |
| @@ -71,7 +62,16 @@ | |||
| 71 | "password" "account" "macdef" "force" | 62 | "password" "account" "macdef" "force" |
| 72 | "port")) | 63 | "port")) |
| 73 | alist elem result pair) | 64 | alist elem result pair) |
| 74 | (insert-file-contents file) | 65 | (if (and netrc-cache |
| 66 | (equal (car netrc-cache) (nth 5 (file-attributes file)))) | ||
| 67 | ;; Store the contents of the file heavily encrypted in memory. | ||
| 68 | (insert (base64-decode-string (rot13-string (cdr netrc-cache)))) | ||
| 69 | (insert-file-contents file) | ||
| 70 | (when (string-match "\\.gpg\\'" file) | ||
| 71 | (setq netrc-cache (cons (nth 5 (file-attributes file)) | ||
| 72 | (rot13-string | ||
| 73 | (base64-encode-string | ||
| 74 | (buffer-string))))))) | ||
| 75 | (goto-char (point-min)) | 75 | (goto-char (point-min)) |
| 76 | ;; Go through the file, line by line. | 76 | ;; Go through the file, line by line. |
| 77 | (while (not (eobp)) | 77 | (while (not (eobp)) |