From b0b63450dc77a67c017123bdfb7f079f27f0ef2a Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Sat, 29 Aug 2009 00:27:12 +0000 Subject: [PATCH] Merge from gnus--devo--0 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1629 --- doc/misc/ChangeLog | 16 ++++++ doc/misc/auth.texi | 114 ++++++++++++++++++++++++++++----------- doc/misc/emacs-mime.texi | 4 +- doc/misc/gnus-news.texi | 9 ++++ doc/misc/gnus.texi | 26 +++++++++ etc/GNUS-NEWS | 8 +++ lisp/gnus/ChangeLog | 20 +++++++ lisp/gnus/gnus-art.el | 27 ++++++++-- lisp/gnus/gnus-group.el | 12 +++++ lisp/gnus/gnus-sum.el | 33 ++++++++++-- lisp/gnus/mml.el | 33 ++++++------ 11 files changed, 242 insertions(+), 60 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 87efed613e..dc39384e34 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,19 @@ +2009-08-29 Teodor Zlatanov + + * auth.texi: Rewritten for coverage and clarity. + +2009-08-29 Katsumi Yamaoka + + * gnus.texi (Expiring Mail): Mention + gnus-mark-copied-or-moved-articles-as-expirable. + (Various Various): Mention gnus-safe-html-newsgroups. + + * gnus-news.texi: Mention + gnus-mark-copied-or-moved-articles-as-expirable. + + * emacs-mime.texi (Display Customization): Add xref to + gnus-safe-html-newsgroups. + 2009-08-28 Michael Albinus * tramp.texi (Version Control): Remove. diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi index e4eaedbbc7..0cdb0df21d 100644 --- a/doc/misc/auth.texi +++ b/doc/misc/auth.texi @@ -2,7 +2,7 @@ @setfilename ../../info/auth @settitle Emacs auth-source Library @value{VERSION} -@set VERSION 0.1 +@set VERSION 0.2 @copying This file describes the Emacs auth-source library. @@ -67,19 +67,53 @@ It is a way for multiple applications to share a single configuration @node Overview @chapter Overview -To be done. +The auth-source library is a modern, extensible, enterprise-class +authentication library. It uses the latest design patterns, has 1800 +unit tests, and has been featured in 21 industry conference keynote +talks. It's future-proof, mathematically proven to be bug-free, and +has 6 internal XML parsers just in case you ever need to eat up some +memory. + +Just kidding. The auth-source library is simply a way for Emacs and +Gnus, among others, to find the answer to the old burning question ``I +have a server name and a port, what are my user name and password?'' + +The auth-source library actually supports more than just the user name +(known as the login) or the password, but only those two are in use +today in Emacs or Gnus. Similarly, the auth-source library can in +theory support multiple storage formats, but currently it only +understands the classic ``netrc'' format, examples of which you can +see later in this document. @node Help for users @chapter Help for users -If you have problems with the port, turn up @code{gnus-verbose} and -see what port the library is checking. Ditto for any other -problems, your first step is to see what's being checked. +``Netrc'' files are a de facto standard. They look like this: +@example +machine mymachine login myloginname password mypassword port myport +@end example -Setup: +The port is optional. If it's missing, auth-source will assume any +port is OK. Actually the port is a protocol name or a port number so +you can have separate entries for port 143 and for protocol ``imap'' +if you fancy that. Anyway, you can just omit the port if you don't +need it. ``Netrc'' files are usually called @code{.authinfo} or +@code{.netrc}; nowadays @code{.authinfo} seems to be more popular and +the auth-source library encourages this confusion by making it the +default, as you'll see later. + +If you have problems with the port, set @var{auth-source-debug} to t +and see what port the library is checking in the @code{*Messages*} +buffer. Ditto for any other problems, your first step is always to +see what's being checked. The second step, of course, is to write a +blog entry about it and wait for the answer in the comments. + +You can customize the variable @var{auth-sources}. The following may +be needed if you are using an older version of Emacs or if the +auth-source library is not loaded for some other reason. @lisp -(require 'auth-source) +(require 'auth-source) ;; probably not necessary (customize-variable 'auth-sources) ;; optional, do it once @end lisp @@ -93,21 +127,18 @@ can get fancy, the default and simplest configuration is: (setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t))) @end lisp -By adding multiple entries to that list with a particular host or -protocol, you can have specific netrc files for that host or protocol. - -@end defvar +This says ``for any host and any protocol, use just that one file.'' +Sweet simplicity. In fact, this is already the default, so unless you +want to move your netrc file, it will just work if you have that +file. You may not, though, so make sure it exists. +By adding multiple entries to @var{auth-sources} with a particular +host or protocol, you can have specific netrc files for that host or +protocol. Usually this is unnecessary but may make sense if you have +shared netrc files or some other unusual setup (90% of Emacs users +have unusual setups and the remaining 10% are @emph{really} unusual). -``Netrc'' files are a de facto standard. They look like this: -@example -machine mymachine login myloginname password mypassword port myport -@end example - -The port is optional. If it's missing, auth-source will assume any -port is OK. Actually the port is a protocol name or a port number so -you can have separate entries for port 143 and for protocol ``imap'' -if you fancy that. +@end defvar If you don't customize @var{auth-sources}, you'll have to live with the defaults: any host and any port are looked up in the netrc @@ -117,9 +148,26 @@ you set up EPA, which is strongly recommended. @lisp (require 'epa-file) (epa-file-enable) -(setq epa-file-cache-passphrase-for-symmetric-encryption t) ; VERY important +;;; VERY important if you want symmetric encryption +;;; irrelevant if you don't +(setq epa-file-cache-passphrase-for-symmetric-encryption t) @end lisp +The simplest working netrc line example is one without a port. + +@example +machine YOURMACHINE login YOU password YOURPASSWORD +@end example + +This will match any authentication port. Simple, right? But what if +there's a SMTP server on port 433 of that machine that needs a +different password from the IMAP server? + +@example +machine YOURMACHINE login YOU password SMTPPASSWORD port 433 +machine YOURMACHINE login YOU password GENERALPASSWORD +@end example + For url-auth authentication (HTTP/HTTPS), you need to put this in your netrc file: @@ -127,9 +175,9 @@ netrc file: machine yourmachine.com:80 port http login testuser password testpass @end example -This will match any realm and authentication method (basic or -digest). If you want finer controls, explore the url-auth source -code and variables. +This will match any realm and authentication method (basic or digest) +over HTTP. HTTPS is set up similarly. If you want finer controls, +explore the url-auth source code and variables. For Tramp authentication, use: @@ -139,7 +187,8 @@ machine yourmachine.com port scp login testuser password testpass Note that the port denotes the Tramp connection method. When you don't use a port entry, you match any Tramp method, as explained -earlier. +earlier. Since Tramp has about 88 connection methods, this may be +necessary if you have an unusual (see earlier comment on those) setup. @node Help for developers @chapter Help for developers @@ -149,14 +198,17 @@ The auth-source library only has one function for external use. @defun auth-source-user-or-password mode host port Retrieve appropriate authentication tokens, determined by @var{mode}, -for host @var{host} and @var{port}. If @code{gnus-verbose} is 9 or -higher, debugging messages will be printed. +for host @var{host} and @var{port}. If @var{auth-source-debug} is t, +debugging messages will be printed. Set @var{auth-source-debug} to a +function to use that function for logging. The parameters passed will +be the same that the @code{message} function takes, that is, a string +formatting spec and optional parameters. If @var{mode} is a list of strings, the function will return a list of -strings or @code{nil} objects. If it's a string, the function will -return a string or a @code{nil} object. Currently only the modes -``login'' and ``password'' are recognized but more may be added in the -future. +strings or @code{nil} objects (thus you can avoid parsing the netrc +file more than once). If it's a string, the function will return a +string or a @code{nil} object. Currently only the modes ``login'' and +``password'' are recognized but more may be added in the future. @var{host} is a string containing the host name. diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index e9a0359550..a49ccf62cd 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi @@ -418,7 +418,9 @@ or @kbd{I} instead.} A regular expression that matches safe URL names, i.e. URLs that are unlikely to leak personal information when rendering @acronym{HTML} email (the default value is @samp{\\`cid:}). If @code{nil} consider -all URLs safe. +all URLs safe. In Gnus, this will be overridden according to the value +of the variable @code{gnus-safe-html-newsgroups}, @xref{Various +Various, ,Various Various, gnus, Gnus Manual}. @item mm-inline-text-html-with-w3m-keymap @vindex mm-inline-text-html-with-w3m-keymap diff --git a/doc/misc/gnus-news.texi b/doc/misc/gnus-news.texi index 09d7be56a7..cf6d80862d 100644 --- a/doc/misc/gnus-news.texi +++ b/doc/misc/gnus-news.texi @@ -311,6 +311,15 @@ intermediate host @samp{bar.example.com} from next time. @item The @file{all.SCORE} file can be edited from the group buffer using @kbd{W e}. +@item You can set @code{gnus-mark-copied-or-moved-articles-as-expirable} +to a non-@code{nil} value so that articles that have been read may be +marked as expirable automatically when copying or moving them to a group +that has auto-expire turned on. The default is @code{nil} and copying +and moving of articles behave as before; i.e., the expirable marks will +be unchanged except that the marks will be removed when copying or +moving articles to a group that has not turned auto-expire on. +@xref{Expiring Mail}. + @end itemize @end itemize diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index a7eb08101a..91ce322823 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -16299,6 +16299,23 @@ If @code{gnus-inhibit-user-auto-expire} is non-@code{nil}, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on. +@vindex gnus-mark-copied-or-moved-articles-as-expirable +The expirable marks of articles will be removed when copying or moving +them to a group in which auto-expire is not turned on. This is for +preventing articles from being expired unintentionally. On the other +hand, to a group that has turned auto-expire on, the expirable marks of +articles that are copied or moved will not be changed by default. I.e., +when copying or moving to such a group, articles that were expirable +will be left expirable and ones that were not expirable will not be +marked as expirable. So, even though in auto-expire groups, some +articles will never get expired (unless you read them again). If you +don't side with that behavior that unexpirable articles may be mixed +into auto-expire groups, you can set +@code{gnus-mark-copied-or-moved-articles-as-expirable} to a +non-@code{nil} value. In that case, articles that have been read will +be marked as expirable automatically when being copied or moved to a +group that has auto-expire turned on. The default value is @code{nil}. + @node Washing Mail @subsection Washing Mail @@ -26926,6 +26943,15 @@ group). @acronym{IMAP} users might want to allow @samp{/} in group names though. +@item gnus-safe-html-newsgroups +@vindex gnus-safe-html-newsgroups +Groups in which links in html articles are considered all safe. The +value may be a regexp matching those groups, a list of group names, or +@code{nil}. This overrides @code{mm-w3m-safe-url-regexp}. The default +value is @code{"\\`nnrss[+:]"}. This is effective only when emacs-w3m +renders html articles, i.e., in the case @code{mm-text-html-renderer} is +set to @code{w3m}. @xref{Display Customization, ,Display Customization, +emacs-mime, The Emacs MIME Manual}. @end table diff --git a/etc/GNUS-NEWS b/etc/GNUS-NEWS index 808db0de7b..6bb90d87a0 100644 --- a/etc/GNUS-NEWS +++ b/etc/GNUS-NEWS @@ -249,6 +249,14 @@ will connect to the news host by way of the intermediate host ** The `all.SCORE' file can be edited from the group buffer using `W e'. +** You can set `gnus-mark-copied-or-moved-articles-as-expirable' to a +non-`nil' value so that articles that have been read may be marked as +expirable automatically when copying or moving them to a group that has +auto-expire turned on. The default is `nil' and copying and moving of +articles behave as before; i.e., the expirable marks will be unchanged +except that the marks will be removed when copying or moving articles to +a group that has not turned auto-expire on. *Note Expiring Mail::. + * For older news, see Gnus info node "New Features". diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 2bdd3dfa91..b11a7295d4 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2009-08-28 Katsumi Yamaoka + + * mml.el (mml-attach-file, mml-attach-buffer, mml-attach-external): + Don't save excursion. + 2009-08-28 Stefan Monnier * nnheader.el (nnheader-find-file-noselect): @@ -23,6 +28,21 @@ * gnus-art.el (gnus-button-patch): Use forward-line rather than goto-line. +2009-08-12 Katsumi Yamaoka + + * gnus-group.el (gnus-safe-html-newsgroups): New user option. + + * gnus-art.el (gnus-bind-safe-url-regexp): New macro. + (gnus-mime-view-all-parts, gnus-mime-view-part-internally) + (gnus-mm-display-part, gnus-mime-display-single) + (gnus-mime-display-alternative): Use gnus-bind-safe-url-regexp to + override mm-w3m-safe-url-regexp according to gnus-safe-html-newsgroups. + + * gnus-sum.el + (gnus-mark-copied-or-moved-articles-as-expirable): New user option. + (gnus-summary-move-article): Add expirable mark to articles copied or + moved to group that has auto-expire turned on if the option is non-nil. + 2009-07-24 Glenn Morris * gnus-demon.el (gnus-demon-add-nntp-close-connection): diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index cedfff0421..087ad68c53 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -4740,6 +4740,23 @@ General format specifiers can also be used. See Info node (vector (caddr c) (car c) :active t)) gnus-mime-button-commands))) +(defmacro gnus-bind-safe-url-regexp (&rest body) + "Bind `mm-w3m-safe-url-regexp' according to `gnus-safe-html-newsgroups'." + `(let ((mm-w3m-safe-url-regexp + (let ((group (if (and (eq major-mode 'gnus-article-mode) + (gnus-buffer-live-p + gnus-article-current-summary)) + (with-current-buffer gnus-article-current-summary + gnus-newsgroup-name) + gnus-newsgroup-name))) + (if (cond ((stringp gnus-safe-html-newsgroups) + (string-match gnus-safe-html-newsgroups group)) + ((consp gnus-safe-html-newsgroups) + (member group gnus-safe-html-newsgroups))) + nil + mm-w3m-safe-url-regexp)))) + ,@body)) + (defun gnus-mime-button-menu (event prefix) "Construct a context-sensitive menu of MIME commands." (interactive "e\nP") @@ -4765,7 +4782,7 @@ General format specifiers can also be used. See Info node (or (search-forward "\n\n") (goto-char (point-max))) (let ((inhibit-read-only t)) (delete-region (point) (point-max)) - (mm-display-parts handles)))))) + (gnus-bind-safe-url-regexp (mm-display-parts handles))))))) (defun gnus-article-jump-to-part (n) "Jump to MIME part N." @@ -5267,7 +5284,7 @@ If no internal viewer is available, use an external viewer." (when handle (if (mm-handle-undisplayer handle) (mm-remove-part handle) - (mm-display-part handle)))))) + (gnus-bind-safe-url-regexp (mm-display-part handle))))))) (defun gnus-mime-action-on-part (&optional action) "Do something with the MIME attachment at \(point\)." @@ -5488,7 +5505,7 @@ N is the numerical prefix." (save-restriction (narrow-to-region (point) (if (eobp) (point) (1+ (point)))) - (mm-display-part handle) + (gnus-bind-safe-url-regexp (mm-display-part handle)) ;; We narrow to the part itself and ;; then call the treatment functions. (goto-char (point-min)) @@ -5767,7 +5784,7 @@ If displaying \"text/html\" is discouraged \(see (set-buffer gnus-summary-buffer) (error)) gnus-newsgroup-ignored-charsets))) - (mm-display-part handle t)) + (gnus-bind-safe-url-regexp (mm-display-part handle t))) (goto-char (point-max))) ((and text not-attachment) (when move @@ -5903,7 +5920,7 @@ If displaying \"text/html\" is discouraged \(see (mail-parse-ignored-charsets (with-current-buffer gnus-summary-buffer gnus-newsgroup-ignored-charsets))) - (mm-display-part preferred) + (gnus-bind-safe-url-regexp (mm-display-part preferred)) ;; Do highlighting. (save-excursion (save-restriction diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 602ee31944..4a7f06833a 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -110,6 +110,18 @@ If nil, no groups are permanently visible." :group 'gnus-group-listing :type '(choice regexp (const nil))) +(defcustom gnus-safe-html-newsgroups "\\`nnrss[+:]" + "Groups in which links in html articles are considered all safe. +The value may be a regexp matching those groups, a list of group names, +or nil. This overrides `mm-w3m-safe-url-regexp' (which see). This is +effective only when emacs-w3m renders html articles, i.e., in the case +`mm-text-html-renderer' is set to `w3m'." + :version "23.2" + :group 'gnus-group-various + :type '(choice regexp + (repeat :tag "List of group names" (string :tag "Group")) + (const nil))) + (defcustom gnus-list-groups-with-ticked-articles t "*If non-nil, list groups that have only ticked articles. If nil, only list groups that have unread articles." diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 0624418f5e..c77e3fcd9e 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -668,6 +668,17 @@ string with the suggested prefix." :group 'gnus-summary :type 'boolean) +(defcustom gnus-mark-copied-or-moved-articles-as-expirable nil + "If non-nil, mark articles copied or moved to auto-expire group as expirable. +If nil, the expirable marks will be unchanged except that the marks +will be removed when copying or moving articles to a group that has +not turned auto-expire on. If non-nil, articles that have been read +will be marked as expirable when being copied or moved to a group in +which auto-expire is turned on." + :version "23.2" + :type 'boolean + :group 'gnus-summary-marks) + (defcustom gnus-view-pseudos nil "*If `automatic', pseudo-articles will be viewed automatically. If `not-confirm', pseudos will be viewed automatically, and the user @@ -9753,11 +9764,12 @@ ACTION can be either `move' (the default), `crosspost' or `copy'." (list (cdr art-group))))) ;; See whether the article is to be put in the cache. - (let ((marks (if (gnus-group-auto-expirable-p to-group) - gnus-article-mark-lists - (delete '(expirable . expire) - (copy-sequence gnus-article-mark-lists)))) - (to-article (cdr art-group))) + (let* ((expirable (gnus-group-auto-expirable-p to-group)) + (marks (if expirable + gnus-article-mark-lists + (delete '(expirable . expire) + (copy-sequence gnus-article-mark-lists)))) + (to-article (cdr art-group))) ;; Enter the article into the cache in the new group, ;; if that is required. @@ -9796,6 +9808,17 @@ ACTION can be either `move' (the default), `crosspost' or `copy'." to-group (cdar marks) (list to-article) info))) (setq marks (cdr marks))) + (when (and expirable + gnus-mark-copied-or-moved-articles-as-expirable + (not (memq 'expire to-marks))) + ;; Mark this article as expirable. + (push 'expire to-marks) + (when (equal to-group gnus-newsgroup-name) + (push to-article gnus-newsgroup-expirable)) + ;; Copy the expirable mark to other group. + (gnus-add-marked-articles + to-group 'expire (list to-article) info)) + (gnus-request-set-mark to-group (list (list (list to-article) 'add to-marks)))) diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index 6028ce8b20..796470bd17 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -1292,15 +1292,14 @@ body) or \"attachment\" (separate from the body)." (description (mml-minibuffer-read-description)) (disposition (mml-minibuffer-read-disposition type nil file))) (list file type description disposition))) - (save-excursion - (unless (message-in-body-p) (goto-char (point-max))) - (mml-insert-empty-tag 'part - 'type type - ;; icicles redefines read-file-name and returns a - ;; string w/ text properties :-/ - 'filename (mm-substring-no-properties file) - 'disposition (or disposition "attachment") - 'description description))) + (unless (message-in-body-p) (goto-char (point-max))) + (mml-insert-empty-tag 'part + 'type type + ;; icicles redefines read-file-name and returns a + ;; string w/ text properties :-/ + 'filename (mm-substring-no-properties file) + 'disposition (or disposition "attachment") + 'description description)) (defun mml-dnd-attach-file (uri action) "Attach a drag and drop file. @@ -1336,11 +1335,10 @@ BUFFER is the name of the buffer to attach. See (description (mml-minibuffer-read-description)) (disposition (mml-minibuffer-read-disposition type nil))) (list buffer type description disposition))) - (save-excursion - (unless (message-in-body-p) (goto-char (point-max))) - (mml-insert-empty-tag 'part 'type type 'buffer buffer - 'disposition disposition - 'description description))) + (unless (message-in-body-p) (goto-char (point-max))) + (mml-insert-empty-tag 'part 'type type 'buffer buffer + 'disposition disposition + 'description description)) (defun mml-attach-external (file &optional type description) "Attach an external file into the buffer. @@ -1351,10 +1349,9 @@ TYPE is the MIME type to use." (type (mml-minibuffer-read-type file)) (description (mml-minibuffer-read-description))) (list file type description))) - (save-excursion - (unless (message-in-body-p) (goto-char (point-max))) - (mml-insert-empty-tag 'external 'type type 'name file - 'disposition "attachment" 'description description))) + (unless (message-in-body-p) (goto-char (point-max))) + (mml-insert-empty-tag 'external 'type type 'name file + 'disposition "attachment" 'description description)) (defun mml-insert-multipart (&optional type) (interactive (list (completing-read "Multipart type (default mixed): " -- 2.20.1