changeset 104692:b99b3dda298b

Merge from gnus--devo--0 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1629
author Miles Bader <miles@gnu.org>
date Sat, 29 Aug 2009 00:27:12 +0000
parents 669c6df8c8b9
children eee42a220506
files doc/misc/ChangeLog doc/misc/auth.texi doc/misc/emacs-mime.texi doc/misc/gnus-news.texi doc/misc/gnus.texi etc/GNUS-NEWS lisp/gnus/ChangeLog lisp/gnus/gnus-art.el lisp/gnus/gnus-group.el lisp/gnus/gnus-sum.el lisp/gnus/mml.el
diffstat 11 files changed, 242 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/doc/misc/ChangeLog	Fri Aug 28 23:49:32 2009 +0000
+++ b/doc/misc/ChangeLog	Sat Aug 29 00:27:12 2009 +0000
@@ -1,3 +1,19 @@
+2009-08-29  Teodor Zlatanov  <tzz@lifelogs.com>
+
+	* auth.texi: Rewritten for coverage and clarity.
+
+2009-08-29  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* 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  <michael.albinus@gmx.de>
 
 	* tramp.texi (Version Control): Remove.
--- a/doc/misc/auth.texi	Fri Aug 28 23:49:32 2009 +0000
+++ b/doc/misc/auth.texi	Sat Aug 29 00:27:12 2009 +0000
@@ -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 @@
 @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,22 +127,19 @@
 (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.
+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).
 
 @end defvar
 
-
-``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.
-
 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
 file @code{~/.authinfo.gpg}.  This is an encrypted file if and only if
@@ -117,9 +148,26 @@
 @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 @@
 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 @@
 
 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 @@
 @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.
 
--- a/doc/misc/emacs-mime.texi	Fri Aug 28 23:49:32 2009 +0000
+++ b/doc/misc/emacs-mime.texi	Sat Aug 29 00:27:12 2009 +0000
@@ -418,7 +418,9 @@
 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
--- a/doc/misc/gnus-news.texi	Fri Aug 28 23:49:32 2009 +0000
+++ b/doc/misc/gnus-news.texi	Sat Aug 29 00:27:12 2009 +0000
@@ -311,6 +311,15 @@
 @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
--- a/doc/misc/gnus.texi	Fri Aug 28 23:49:32 2009 +0000
+++ b/doc/misc/gnus.texi	Sat Aug 29 00:27:12 2009 +0000
@@ -16299,6 +16299,23 @@
 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 @@
 
 @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
 
--- a/etc/GNUS-NEWS	Fri Aug 28 23:49:32 2009 +0000
+++ b/etc/GNUS-NEWS	Sat Aug 29 00:27:12 2009 +0000
@@ -249,6 +249,14 @@
 
 ** 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".
--- a/lisp/gnus/ChangeLog	Fri Aug 28 23:49:32 2009 +0000
+++ b/lisp/gnus/ChangeLog	Sat Aug 29 00:27:12 2009 +0000
@@ -1,3 +1,8 @@
+2009-08-28  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* mml.el (mml-attach-file, mml-attach-buffer, mml-attach-external):
+	Don't save excursion.
+
 2009-08-28  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* 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  <yamaoka@jpl.org>
+
+	* 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  <rgm@gnu.org>
 
 	* gnus-demon.el (gnus-demon-add-nntp-close-connection):
--- a/lisp/gnus/gnus-art.el	Fri Aug 28 23:49:32 2009 +0000
+++ b/lisp/gnus/gnus-art.el	Sat Aug 29 00:27:12 2009 +0000
@@ -4740,6 +4740,23 @@
 		(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 @@
 	(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 @@
       (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 @@
 		    (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 @@
 				       (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 @@
 		  (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
--- a/lisp/gnus/gnus-group.el	Fri Aug 28 23:49:32 2009 +0000
+++ b/lisp/gnus/gnus-group.el	Sat Aug 29 00:27:12 2009 +0000
@@ -110,6 +110,18 @@
   :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."
--- a/lisp/gnus/gnus-sum.el	Fri Aug 28 23:49:32 2009 +0000
+++ b/lisp/gnus/gnus-sum.el	Sat Aug 29 00:27:12 2009 +0000
@@ -668,6 +668,17 @@
   :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 @@
 				       (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 @@
 		       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))))
 
--- a/lisp/gnus/mml.el	Fri Aug 28 23:49:32 2009 +0000
+++ b/lisp/gnus/mml.el	Sat Aug 29 00:27:12 2009 +0000
@@ -1292,15 +1292,14 @@
 	  (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 @@
 	  (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 (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): "