Merge changes made in Gnus trunk.
authorGnus developers <ding@gnus.org>
Tue, 15 Mar 2011 22:38:41 +0000 (22:38 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 15 Mar 2011 22:38:41 +0000 (22:38 +0000)
message.texi (Insertion Variables): Document message-cite-style.
nnimap.el (nnimap-open-connection-1): Allow `network-only', too.
gssapi.el: New file separated out from imap.el to provide a general Kerberos 5 connection facility for Emacs.
message.el (message-elide-ellipsis): Document the format spec ellipsis.
message.el (message-elide-region): Allow the ellipsis to say how many lines were removed.
gnus-win.el (gnus-configure-frame): Protect against trying to restore window configurations containing buffers that are now dead.
nnimap.el (nnimap-parse-flags): Remove all MODSEQ entries before parsing to avoid integer overflows.
 (nnimap-parse-flags): Simplify the last change.
 (nnimap-parse-flags): Store HIGHESTMODSEQ as a string, since it may be too large for 32-bit Emacsen.
gnus-art.el (gnus-article-treat-body-boundary): Fix boundary width on XEmacs, which was one character too wide.
gnus-sum.el (gnus-articles-to-read): Use gnus-large-newsgroup as default number of articles to display.
 (gnus-articles-to-read): Use pretty names for prompt.
gnus-int.el (gnus-open-server): Ditto.
gnus-start.el (gnus-activate-group): Give a backtrace if debug-on-quit is set and the user hits `C-g'.
 (gnus-read-active-file): Ditto.
gnus-group.el (gnus-group-read-ephemeral-group): Ditto.

12 files changed:
doc/misc/ChangeLog
doc/misc/message.texi
lisp/gnus/ChangeLog
lisp/gnus/gnus-art.el
lisp/gnus/gnus-group.el
lisp/gnus/gnus-int.el
lisp/gnus/gnus-start.el
lisp/gnus/gnus-sum.el
lisp/gnus/gnus-win.el
lisp/gnus/gssapi.el [new file with mode: 0644]
lisp/gnus/message.el
lisp/gnus/nnimap.el

index ecb6cce..be1b4c4 100644 (file)
@@ -1,4 +1,8 @@
-2011-03-14  Michael Albinus <michael.albinus@gmx.de>
+2011-03-15  Antoine Levitt  <antoine.levitt@gmail.com>
+
+       * message.texi (Insertion Variables): Document message-cite-style.
+
+2011-03-14  Michael Albinus  <michael.albinus@gmx.de>
 
        * tramp.texi (Remote processes): New subsection "Running shell on
        a remote host".
index 2937037..7d61ffd 100644 (file)
@@ -1930,6 +1930,25 @@ posting a prepared news message.
 @section Insertion Variables
 
 @table @code
+@item message-cite-style
+@vindex message-cite-style
+The overall style to be used when replying to messages. This controls
+things like where the reply should be put relative to the original,
+how the citation is formatted, where the signature goes, etc.
+
+Value is either @code{nil} (no variable overrides) or a let-style list
+of pairs @code{(VARIABLE VALUE)} to override default values.
+
+See @code{gnus-posting-styles} to set this variable for specific
+groups. Presets to impersonate popular mail agents are available in the
+@code{message-cite-style-*} variables.
+
+@item message-cite-reply-position
+@vindex message-cite-reply-position
+Where the reply should be positioned. Available styles are
+@code{traditional} to reply inline, @code{above} for top-posting, and
+@code{below} for bottom-posting
+
 @item message-ignored-cited-headers
 @vindex message-ignored-cited-headers
 All headers that match this regexp will be removed from yanked
index d806f0a..1b4cd18 100644 (file)
@@ -1,8 +1,55 @@
+2011-03-15  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * nnimap.el (nnimap-open-connection-1): Allow `network-only', too.
+
+       * gssapi.el: New file separated out from imap.el to provide a general
+       Kerberos 5 connection facility for Emacs.
+
+       * message.el (message-elide-ellipsis): Document the format spec
+       ellipsis.
+
+2011-03-15  Reiner Steib  <Reiner.Steib@gmx.de>
+
+       * message.el (message-elide-region): Allow the ellipsis to say how many
+       lines were removed.
+
+2011-03-15  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-win.el (gnus-configure-frame): Protect against trying to restore
+       window configurations containing buffers that are now dead.
+
+       * nnimap.el (nnimap-parse-flags): Remove all MODSEQ entries before
+       parsing to avoid integer overflows.
+       (nnimap-parse-flags): Simplify the last change.
+       (nnimap-parse-flags): Store HIGHESTMODSEQ as a string, since it may be
+       too large for 32-bit Emacsen.
+
 2011-03-15  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * auth-source.el (auth-source-netrc-create):
        * message.el (message-yank-original): Fix use of `case'.
 
+2011-03-15  Nelson Ferreira  <nelson.ferreira@ieee.org>  (tiny change)
+
+       * gnus-art.el (gnus-article-treat-body-boundary): Fix boundary width on
+       XEmacs, which was one character too wide.
+
+2011-03-09  Antoine Levitt  <antoine.levitt@gmail.com>
+
+       * gnus-sum.el (gnus-articles-to-read): Use gnus-large-newsgroup as
+       default number of articles to display.
+       (gnus-articles-to-read): Use pretty names for prompt.
+
+2011-03-15  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-int.el (gnus-open-server): Ditto.
+
+       * gnus-start.el (gnus-activate-group): Give a backtrace if
+       debug-on-quit is set and the user hits `C-g'.
+       (gnus-read-active-file): Ditto.
+
+       * gnus-group.el (gnus-group-read-ephemeral-group): Ditto.
+
 2011-03-15  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * message.el (message-yank-original): Use cond instead of CL case.
index c64138b..20ffa8e 100644 (file)
@@ -2337,10 +2337,12 @@ long lines if and only if arg is positive."
       (let ((start (point)))
        (insert "X-Boundary: ")
        (gnus-add-text-properties start (point) '(invisible t intangible t))
-       (insert (let (str)
-                 (while (>= (window-width) (length str))
+       (insert (let (str (max (window-width)))
+                 (if (featurep 'xemacs)
+                     (setq max (1- max)))
+                 (while (>= max (length str))
                    (setq str (concat str gnus-body-boundary-delimiter)))
-                 (substring str 0 (window-width)))
+                 (substring str 0 max))
                "\n")
        (gnus-put-text-property start (point) 'gnus-decoration 'header)))))
 
index 9ed3cf0..e928811 100644 (file)
@@ -2313,9 +2313,10 @@ Return the name of the group if selection was successful."
                       gnus-fetch-old-ephemeral-headers))
                  (gnus-group-read-group (or number t) t group select-articles))
            group)
-       ;;(error nil)
        (quit
-        (message "Quit reading the ephemeral group")
+        (if debug-on-quit
+            (debug "Quit")
+          (message "Quit reading the ephemeral group"))
         nil)))))
 
 (defcustom gnus-gmane-group-download-format
index a67063b..ef15a47 100644 (file)
@@ -270,7 +270,9 @@ If it is down, start it up (again)."
                               server (error-message-string err))
                 nil)
                (quit
-                (gnus-message 1 "Quit trying to open server %s" server)
+                (if debug-on-quit
+                    (debug "Quit")
+                  (gnus-message 1 "Quit trying to open server %s" server))
                 nil)))
             open-offline)
        ;; If this hasn't been opened before, we add it to the list.
index c6ff604..afded87 100644 (file)
@@ -1462,9 +1462,10 @@ If SCAN, request a scan of that group as well."
               (inline (gnus-request-group group (or dont-sub-check dont-check)
                                           method
                                           (gnus-get-info group)))
-            ;;(error nil)
             (quit
-             (message "Quit activating %s" group)
+             (if debug-on-quit
+                 (debug "Quit")
+               (message "Quit activating %s" group))
              nil)))
         (unless dont-check
           (setq active (gnus-parse-active))
@@ -2004,7 +2005,9 @@ If SCAN, request a scan of that group as well."
              ;; We catch C-g so that we can continue past servers
              ;; that do not respond.
              (quit
-              (message "Quit reading the active file")
+              (if debug-on-quit
+                  (debug "Quit")
+                (message "Quit reading the active file"))
               nil))))))))
 
 (defun gnus-read-active-file-1 (method force)
index a8786e3..bc572f2 100644 (file)
@@ -5848,13 +5848,13 @@ If SELECT-ARTICLES, only select those articles from GROUP."
                         (input
                          (read-string
                           (format
-                           "How many articles from %s (%s %d): "
-                           (gnus-group-decoded-name gnus-newsgroup-name)
-                           (if initial "max" "default")
-                           number)
-                          (if initial
-                              (cons (number-to-string initial)
-                                    0)))))
+                           "How many articles from %s (available %d, default %d): "
+                           (gnus-group-decoded-name (gnus-group-real-name gnus-newsgroup-name))
+                           number
+                           (or initial gnus-large-newsgroup))
+                          nil
+                          nil
+                          (number-to-string (or initial gnus-large-newsgroup)))))
                    (if (string-match "^[ \t]*$" input) number input)))
                 ((and (> scored marked) (< scored number)
                       (> (- scored number) 20))
@@ -5862,7 +5862,7 @@ If SELECT-ARTICLES, only select those articles from GROUP."
                         (read-string
                          (format "%s %s (%d scored, %d total): "
                                  "How many articles from"
-                                 (gnus-group-decoded-name group)
+                                 (gnus-group-decoded-name (gnus-group-real-name gnus-newsgroup-name))
                                  scored number))))
                    (if (string-match "^[ \t]*$" input)
                        number input)))
index 156f9a0..c38f57d 100644 (file)
@@ -268,8 +268,10 @@ See the Gnus manual for an explanation of the syntax used.")
            (error "Invalid buffer type: %s" type))
          (let ((buf (gnus-get-buffer-create
                      (gnus-window-to-buffer-helper buffer))))
-           (if (eq buf (window-buffer (selected-window))) (set-buffer buf)
-             (switch-to-buffer buf)))
+           (when (buffer-name buf)
+             (if (eq buf (window-buffer (selected-window)))
+                 (set-buffer buf)
+               (switch-to-buffer buf))))
          (when (memq 'frame-focus split)
            (setq gnus-window-frame-focus window))
          ;; We return the window if it has the `point' spec.
diff --git a/lisp/gnus/gssapi.el b/lisp/gnus/gssapi.el
new file mode 100644 (file)
index 0000000..3765fb8
--- /dev/null
@@ -0,0 +1,105 @@
+;;; gssapi.el --- GSSAPI/Kerberos 5 interface for Emacs
+
+;; Copyright (C) 2011 Free Software Foundation, Inc.
+
+;; Author: Simon Josefsson <simon@josefsson.org>
+;;         Lars Magne Ingebrigtsen <larsi@gnus.org>
+;; Keywords: network
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'format-spec)
+
+(defcustom gssapi-program (list
+                          (concat "gsasl %s %p "
+                                  "--mechanism GSSAPI "
+                                  "--authentication-id %l")
+                          "imtest -m gssapi -u %l -p %p %s")
+  "List of strings containing commands for GSSAPI (krb5) authentication.
+%s is replaced with server hostname, %p with port to connect to, and
+%l with the value of `imap-default-user'.  The program should accept
+IMAP commands on stdin and return responses to stdout.  Each entry in
+the list is tried until a successful connection is made."
+  :group 'network
+  :type '(repeat string))
+
+(defun open-gssapi-stream (name buffer server port)
+  (let ((cmds gssapi-program)
+       cmd done)
+    (with-current-buffer buffer
+      (while (and (not done)
+                 (setq cmd (pop cmds)))
+       (message "Opening GSSAPI connection with `%s'..." cmd)
+       (erase-buffer)
+       (let* ((coding-system-for-read 'binary)
+              (coding-system-for-write 'binary)
+              (process (start-process
+                        name buffer shell-file-name shell-command-switch
+                        (format-spec
+                         cmd
+                         (format-spec-make
+                          ?s server
+                          ?p (number-to-string port)
+                          ?l imap-default-user))))
+              response)
+         (when process
+           (while (and (memq (process-status process) '(open run))
+                       (goto-char (point-min))
+                       ;; Athena IMTEST can output SSL verify errors
+                       (or (while (looking-at "^verify error:num=")
+                             (forward-line))
+                           t)
+                       (or (while (looking-at "^TLS connection established")
+                             (forward-line))
+                           t)
+                       ;; cyrus 1.6.x (13? < x <= 22) queries capabilities
+                       (or (while (looking-at "^C:")
+                             (forward-line))
+                           t)
+                       ;; cyrus 1.6 imtest print "S: " before server greeting
+                       (or (not (looking-at "S: "))
+                           (forward-char 3)
+                           t)
+                       ;; GNU SASL may print 'Trying ...' first.
+                       (or (not (looking-at "Trying "))
+                           (forward-line)
+                           t)
+                       (not (and (looking-at "\\* \\(OK\\|PREAUTH\\|BYE\\) ")
+                                 ;; success in imtest 1.6:
+                                 (re-search-forward
+                                  (concat "^\\(\\(Authenticat.*\\)\\|\\("
+                                          "Client authentication "
+                                          "finished.*\\)\\)")
+                                  nil t)
+                                 (setq response (match-string 1)))))
+             (accept-process-output process 1)
+             (sit-for 1))
+           (erase-buffer)
+           (message "GSSAPI IMAP connection: %s" (or response "failed"))
+           (if (and response (let ((case-fold-search nil))
+                               (not (string-match "failed" response))))
+               (setq done process)
+             (delete-process process)
+             nil))))
+      done)))
+
+(provide 'gssapi)
+
+;;; gssapi.el ends here
index 1d0aaff..bb9215a 100644 (file)
@@ -49,6 +49,7 @@
 (require 'mail-parse)
 (require 'mml)
 (require 'rfc822)
+(require 'format-spec)
 
 (autoload 'mailclient-send-it "mailclient") ;; Emacs 22 or contrib/
 
@@ -438,7 +439,10 @@ whitespace)."
   :group 'message-various)
 
 (defcustom message-elide-ellipsis "\n[...]\n\n"
-  "*The string which is inserted for elided text."
+  "*The string which is inserted for elided text.
+This is a format-spec string, and you can use %l to say how many
+lines were removed, and %c to say how many characters were
+removed."
   :type 'string
   :link '(custom-manual "(message)Various Commands")
   :group 'message-various)
@@ -3535,8 +3539,12 @@ Note that this should not be used in newsgroups."
 An ellipsis (from `message-elide-ellipsis') will be inserted where the
 text was killed."
   (interactive "r")
-  (kill-region b e)
-  (insert message-elide-ellipsis))
+  (let ((lines (count-lines b e))
+        (chars (- e b)))
+    (kill-region b e)
+    (insert (format-spec message-elide-ellipsis
+                         `((?l . ,lines)
+                           (?c . ,chars))))))
 
 (defvar message-caesar-translation-table nil)
 
index e76ead5..e0804f8 100644 (file)
@@ -340,6 +340,7 @@ textual parts.")
           (ports
            (cond
             ((or (eq nnimap-stream 'network)
+                 (eq nnimap-stream 'network-only)
                  (eq nnimap-stream 'starttls))
              (nnheader-message 7 "Opening connection to %s..."
                                nnimap-address)
@@ -1452,6 +1453,11 @@ textual parts.")
   ;; Change \Delete etc to %Delete, so that the reader can read it.
   (subst-char-in-region (point-min) (point-max)
                        ?\\ ?% t)
+  ;; Remove any MODSEQ entries in the buffer, because they may contain
+  ;; numbers that are too large for 32-bit Emacsen.
+  (while (re-search-forward " MODSEQ ([0-9]+)" nil t)
+    (replace-match "" t t))
+  (goto-char (point-min))
   (let (start end articles groups uidnext elems permanent-flags
              uidvalidity vanished highestmodseq)
     (dolist (elem sequences)
@@ -1491,9 +1497,9 @@ textual parts.")
                            (match-string 1)))
                 (goto-char start)
                 (setq highestmodseq
-                      (and (search-forward "HIGHESTMODSEQ "
+                      (and (re-search-forward "HIGHESTMODSEQ \\([0-9]+\\)"
                                            (or end (point-min)) t)
-                           (read (current-buffer))))
+                           (match-string 1)))
                 (goto-char end)
                 (forward-line -1))
               ;; The UID FETCH FLAGS was successful.
@@ -1507,18 +1513,7 @@ textual parts.")
            (goto-char end))
          (while (re-search-forward "^\\* [0-9]+ FETCH " start t)
            (let ((p (point)))
-             ;; FIXME: For FETCH lines like "* 2971 FETCH (FLAGS (%Recent) UID
-             ;; 12509 MODSEQ (13419098521433281274))" we get an
-             ;; overflow-error.  The handler simply deletes that large number
-             ;; and reads again.  But maybe there's a better fix...
-             (setq elems (condition-case nil (read (current-buffer))
-                           (overflow-error
-                            ;; After an overflow-error, point is just after
-                            ;; the too large number.  So delete it and try
-                            ;; again.
-                            (delete-region (point) (progn (backward-word) (point)))
-                            (goto-char p)
-                            (read (current-buffer)))))
+             (setq elems (read (current-buffer)))
              (push (cons (cadr (memq 'UID elems))
                          (cadr (memq 'FLAGS elems)))
                    articles)))
@@ -1674,6 +1669,8 @@ textual parts.")
            (goto-char (point-max)))
           openp)
       (quit
+       (when debug-on-quit
+        (debug "Quit"))
        ;; The user hit C-g while we were waiting: kill the process, in case
        ;; it's a gnutls-cli process that's stuck (tends to happen a lot behind
        ;; NAT routers).