diff options
Diffstat (limited to 'lisp/gnus')
-rw-r--r-- | lisp/gnus/ChangeLog | 47 | ||||
-rw-r--r-- | lisp/gnus/gnus-art.el | 8 | ||||
-rw-r--r-- | lisp/gnus/gnus-group.el | 5 | ||||
-rw-r--r-- | lisp/gnus/gnus-int.el | 4 | ||||
-rw-r--r-- | lisp/gnus/gnus-start.el | 9 | ||||
-rw-r--r-- | lisp/gnus/gnus-sum.el | 16 | ||||
-rw-r--r-- | lisp/gnus/gnus-win.el | 6 | ||||
-rw-r--r-- | lisp/gnus/gssapi.el | 105 | ||||
-rw-r--r-- | lisp/gnus/message.el | 14 | ||||
-rw-r--r-- | lisp/gnus/nnimap.el | 25 |
10 files changed, 203 insertions, 36 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index d806f0ac342..1b4cd186951 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -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. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index c64138b43d7..20ffa8eed6b 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -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))))) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 9ed3cf02a49..e928811b558 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -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 diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el index a67063bb970..ef15a479892 100644 --- a/lisp/gnus/gnus-int.el +++ b/lisp/gnus/gnus-int.el @@ -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. diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index c6ff6044b92..afded87fe37 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -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) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index a8786e39c7b..bc572f2f429 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -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))) diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el index 156f9a020fd..c38f57d96cb 100644 --- a/lisp/gnus/gnus-win.el +++ b/lisp/gnus/gnus-win.el @@ -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 index 00000000000..3765fb84ee8 --- /dev/null +++ b/lisp/gnus/gssapi.el @@ -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 diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 1d0aaffa426..bb9215aca7c 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -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) diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index e76ead515c5..e0804f81e2e 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -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). |