From 6ecfe5c26e45a5d4da6cdf4b27f3e38b86998870 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 7 Aug 2008 07:18:07 +0000 Subject: [PATCH] Merge from gnus--devo--0 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1372 --- doc/misc/ChangeLog | 12 ++++++ doc/misc/gnus.texi | 23 +++++++++-- lisp/gnus/ChangeLog | 22 +++++++++++ lisp/gnus/gnus-art.el | 81 +++++++++++++++------------------------ lisp/gnus/gnus-sum.el | 88 +++++++++++++++++++++++++++++++++++-------- lisp/gnus/rfc2104.el | 13 ++++++- 6 files changed, 168 insertions(+), 71 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index b80aeb1abd..3c15191db9 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,15 @@ +2008-08-07 Reiner Steib + + * gnus.texi (Sorting the Summary Buffer, Summary Sorting): Add + gnus-summary-sort-by-most-recent-number and + gnus-summary-sort-by-most-recent-date. + (Summary Sorting): Explain prefix argument. + +2008-08-07 Katsumi Yamaoka + + * gnus.texi (Saving Articles): Mention symbolic prefix `r' for + gnus-summary-pipe-output. + 2008-08-03 Michael Albinus * dbus.texi (Receiving Method Calls): Document error handling of own diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 15a0109d94..ebede96711 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -8111,11 +8111,13 @@ tickles your fancy. @findex gnus-article-sort-functions @findex gnus-article-sort-by-date +@findex gnus-article-sort-by-most-recent-date @findex gnus-article-sort-by-score @findex gnus-article-sort-by-subject @findex gnus-article-sort-by-author @findex gnus-article-sort-by-random @findex gnus-article-sort-by-number +@findex gnus-article-sort-by-most-recent-number If you are using an unthreaded display for some strange reason or other, you have to fiddle with the @code{gnus-article-sort-functions} variable. It is very similar to the @@ -8518,9 +8520,11 @@ Save the current article in a VM folder Save the current article in a pipe. Uhm, like, what I mean is---Pipe the current article to a process (@code{gnus-summary-pipe-output}). If given a symbolic prefix (@pxref{Symbolic Prefixes}), include the -complete headers in the piped output. The -@code{gnus-summary-pipe-output-default-command} variable can be set to a -string containing the default command and options (default @code{nil}). +complete headers in the piped output. The symbolic prefix @code{r} is +special; it lets this command pipe a raw article including all headers. +The @code{gnus-summary-pipe-output-default-command} variable can be set +to a string containing the default command and options (default +@code{nil}). @item O P @kindex O P (Summary) @@ -10793,6 +10797,12 @@ can't really see why you'd want that. @findex gnus-summary-sort-by-number Sort by article number (@code{gnus-summary-sort-by-number}). +@item C-c C-s C-m C-n +@kindex C-c C-s C-n (Summary) +@findex gnus-summary-sort-by-most-recent-number +Sort by most recent article number +(@code{gnus-summary-sort-by-most-recent-number}). + @item C-c C-s C-a @kindex C-c C-s C-a (Summary) @findex gnus-summary-sort-by-author @@ -10813,6 +10823,11 @@ Sort by subject (@code{gnus-summary-sort-by-subject}). @findex gnus-summary-sort-by-date Sort by date (@code{gnus-summary-sort-by-date}). +@item C-c C-s C-m C-d +@kindex C-c C-s C-m C-d (Summary) +@findex gnus-summary-sort-by-most-recent-date +Sort by most recent date (@code{gnus-summary-sort-by-most-recent-date}). + @item C-c C-s C-l @kindex C-c C-s C-l (Summary) @findex gnus-summary-sort-by-lines @@ -10847,6 +10862,8 @@ root-by-root basis, which might not be what you were looking for. To toggle whether to use threading, type @kbd{T T} (@pxref{Thread Commands}). +If a prefix argument if given, the sort order is reversed. + @node Finding the Parent @section Finding the Parent diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 19b98a088c..23477cc631 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -4,6 +4,28 @@ * gnus-start.el: * gnus-registry.el: Remove VMS support. +2008-07-30 Katsumi Yamaoka + + * rfc2104.el (rfc2104-string-make-unibyte): Define it as a compiler + macro. + (rfc2104-hash): Use it. + +2008-07-30 Reiner Steib + + * gnus-sum.el (gnus-summary-sort-by-most-recent-number) + (gnus-summary-sort-by-most-recent-date): New commands. + (gnus-summary-mode-map, gnus-summary-make-menu-bar): Add key bindings + and menu entries. + +2008-07-29 Katsumi Yamaoka + + * gnus-art.el (gnus-summary-save-in-pipe): Generate work buffer always; + don't redisplay article for raw contents; remove plural articles stuff. + + * gnus-sum.el (gnus-summary-pipe-output): Pipe raw articles by symbolic + prefix `r'; use gnus-summary-save-in-pipe directly instead of relying + on gnus-summary-save-article; display results properly. + 2008-07-24 Katsumi Yamaoka * gnus-art.el (gnus-summary-save-in-pipe): Add optional argument `raw'. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 16e65a63e2..3d5ce9b39c 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -3955,60 +3955,41 @@ Valid values for COMMAND include: last used for saving. Non-nil value for RAW overrides `:decode' and `:headers' properties and the raw article including all headers will be piped." - (let ((save-buffer gnus-save-article-buffer) - (default (or gnus-summary-pipe-output-default-command - gnus-last-shell-command))) - ;; `gnus-save-article-buffer' should be a buffer containing the article - ;; contents if this function is called by way of the command - ;; `gnus-summary-pipe-output'. OTOH, that the buffer does not exist - ;; means this function is called independently. - (unless (gnus-buffer-live-p save-buffer) - (let ((article (gnus-summary-article-number)) - (decode (unless raw - (get 'gnus-summary-save-in-pipe :decode)))) - (if article - (if (vectorp (gnus-summary-article-header article)) - (save-window-excursion - (let ((gnus-display-mime-function - (when decode - gnus-display-mime-function)) - (gnus-article-prepare-hook - (when decode - gnus-article-prepare-hook))) - (gnus-summary-select-article t t nil article) - (gnus-summary-goto-subject article)) - (insert-buffer-substring - (prog1 - (if decode - gnus-article-buffer - gnus-original-article-buffer) - (setq save-buffer - (nnheader-set-temp-buffer " *Gnus Save*")))) - ;; Remove unwanted headers. - (when (and (not raw) - (or (get 'gnus-summary-save-in-pipe :headers) - (not gnus-save-all-headers))) - (let ((gnus-visible-headers - (or (symbol-value (get 'gnus-summary-save-in-pipe - :headers)) - gnus-saved-headers gnus-visible-headers)) - (gnus-summary-buffer nil)) - (article-hide-headers 1 t)))) - (error "%d is not a real article" article)) - (error "No article to pipe")))) + (let ((article (gnus-summary-article-number)) + (decode (unless raw + (get 'gnus-summary-save-in-pipe :decode))) + save-buffer default) + (if article + (if (vectorp (gnus-summary-article-header article)) + (save-current-buffer + (gnus-summary-select-article decode decode nil article) + (insert-buffer-substring + (prog1 + (if decode + gnus-article-buffer + gnus-original-article-buffer) + (setq save-buffer + (nnheader-set-temp-buffer " *Gnus Save*")))) + ;; Remove unwanted headers. + (when (and (not raw) + (or (get 'gnus-summary-save-in-pipe :headers) + (not gnus-save-all-headers))) + (let ((gnus-visible-headers + (or (symbol-value (get 'gnus-summary-save-in-pipe + :headers)) + gnus-saved-headers gnus-visible-headers)) + (gnus-summary-buffer nil)) + (article-hide-headers 1 t)))) + (error "%d is not a real article" article)) + (error "No article to pipe")) + (setq default (or gnus-summary-pipe-output-default-command + gnus-last-shell-command)) (unless (stringp command) (setq command (if (and (eq command 'default) default) default - (gnus-read-shell-command - (format - "Shell command on %s: " - (if (and gnus-number-of-articles-to-be-saved - (> gnus-number-of-articles-to-be-saved 1)) - (format "these %d articles" - gnus-number-of-articles-to-be-saved) - "this article")) - default)))) + (gnus-read-shell-command "Shell command on this article: " + default)))) (when (string-equal command "") (if default (setq command default) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 7efd9d7595..edec081f2c 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -1825,12 +1825,14 @@ increase the score of each group you read." "?" gnus-summary-mark-as-dormant "\C-c\M-\C-s" gnus-summary-limit-include-expunged "\C-c\C-s\C-n" gnus-summary-sort-by-number + "\C-c\C-s\C-m\C-n" gnus-summary-sort-by-most-recent-number "\C-c\C-s\C-l" gnus-summary-sort-by-lines "\C-c\C-s\C-c" gnus-summary-sort-by-chars "\C-c\C-s\C-a" gnus-summary-sort-by-author "\C-c\C-s\C-t" gnus-summary-sort-by-recipient "\C-c\C-s\C-s" gnus-summary-sort-by-subject "\C-c\C-s\C-d" gnus-summary-sort-by-date + "\C-c\C-s\C-m\C-d" gnus-summary-sort-by-most-recent-date "\C-c\C-s\C-i" gnus-summary-sort-by-score "\C-c\C-s\C-o" gnus-summary-sort-by-original "\C-c\C-s\C-r" gnus-summary-sort-by-random @@ -2703,10 +2705,12 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs)))) ["Pop article off history" gnus-summary-pop-article t]) ("Sort" ["Sort by number" gnus-summary-sort-by-number t] + ["Sort by most recent number" gnus-summary-sort-by-most-recent-number t] ["Sort by author" gnus-summary-sort-by-author t] ["Sort by recipient" gnus-summary-sort-by-recipient t] ["Sort by subject" gnus-summary-sort-by-subject t] ["Sort by date" gnus-summary-sort-by-date t] + ["Sort by most recent date" gnus-summary-sort-by-most-recent-date t] ["Sort by score" gnus-summary-sort-by-score t] ["Sort by lines" gnus-summary-sort-by-lines t] ["Sort by characters" gnus-summary-sort-by-chars t] @@ -11467,6 +11471,12 @@ Argument REVERSE means reverse order." (interactive "P") (gnus-summary-sort 'number reverse)) +(defun gnus-summary-sort-by-most-recent-number (&optional reverse) + "Sort the summary buffer by most recent article number. +Argument REVERSE means reverse order." + (interactive "P") + (gnus-summary-sort 'most-recent-number reverse)) + (defun gnus-summary-sort-by-random (&optional reverse) "Randomize the order in the summary buffer. Argument REVERSE means to randomize in reverse order." @@ -11500,6 +11510,12 @@ Argument REVERSE means reverse order." (interactive "P") (gnus-summary-sort 'date reverse)) +(defun gnus-summary-sort-by-most-recent-date (&optional reverse) + "Sort the summary buffer by most recent date. +Argument REVERSE means reverse order." + (interactive "P") + (gnus-summary-sort 'most-recent-date reverse)) + (defun gnus-summary-sort-by-score (&optional reverse) "Sort the summary buffer by score. Argument REVERSE means reverse order." @@ -11613,29 +11629,69 @@ will not be marked as saved." (gnus-set-mode-line 'summary) n)) -(defun gnus-summary-pipe-output (&optional arg headers) +(defun gnus-summary-pipe-output (&optional n sym) "Pipe the current article to a subprocess. If N is a positive number, pipe the N next articles. If N is a negative number, pipe the N previous articles. If N is nil and any articles have been marked with the process mark, pipe those articles instead. -If HEADERS (the symbolic prefix) is given, force including all headers." +The default command to which articles are piped is specified by the +variable `gnus-summary-pipe-output-default-command'; if it is nil, you +will be prompted for the command. + +The properties `:decode' and `:headers' that are put to the function +symbol `gnus-summary-save-in-pipe' control whether this function +decodes articles and what headers to keep (see the doc string for the +`gnus-default-article-saver' variable). If SYM (the symbolic prefix) +is neither omitted nor the symbol `r', force including all headers +regardless of the `:headers' property. If it is the symbol `r', +articles that are not decoded and include all headers will be piped +no matter what the properties `:decode' and `:headers' are." (interactive (gnus-interactive "P\ny")) (require 'gnus-art) - (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)) - (if headers - (let ((gnus-save-all-headers t) - (headers (get gnus-default-article-saver :headers))) - (unwind-protect - (progn - (put gnus-default-article-saver :headers nil) - (gnus-summary-save-article arg t)) - (put gnus-default-article-saver :headers headers))) - (gnus-summary-save-article arg t))) - (let ((buffer (get-buffer "*Shell Command Output*"))) - (when (and buffer - (not (zerop (buffer-size buffer)))) - (gnus-configure-windows 'pipe)))) + (let* ((articles (gnus-summary-work-articles n)) + (result-buffer "*Shell Command Output*") + (all-headers (not (memq sym '(nil r)))) + (gnus-save-all-headers (or all-headers gnus-save-all-headers)) + (raw (eq sym 'r)) + (headers (get 'gnus-summary-save-in-pipe :headers)) + command result) + (unless (numberp (car articles)) + (error "No article to pipe")) + (setq command (gnus-read-shell-command + (concat "Shell command on " + (if (cdr articles) + (format "these %d articles" (length articles)) + "this article") + ": ") + gnus-summary-pipe-output-default-command)) + (when (string-equal command "") + (error "A command is required")) + (when all-headers + (put 'gnus-summary-save-in-pipe :headers nil)) + (unwind-protect + (while articles + (gnus-summary-goto-subject (pop articles)) + (save-window-excursion (gnus-summary-save-in-pipe command raw)) + (when (and (get-buffer result-buffer) + (not (zerop (buffer-size (get-buffer result-buffer))))) + (setq result (concat result (with-current-buffer result-buffer + (buffer-string)))))) + (put 'gnus-summary-save-in-pipe :headers headers)) + (unless (zerop (length result)) + (if (with-current-buffer (get-buffer-create result-buffer) + (erase-buffer) + (insert result) + (prog1 + (and (= (count-lines (point-min) (point)) 1) + (progn + (end-of-line 0) + (<= (current-column) + (window-width (minibuffer-window))))) + (goto-char (point-min)))) + (message "%s" (substring result 0 -1)) + (message nil) + (gnus-configure-windows 'pipe))))) (defun gnus-summary-save-article-mail (&optional arg) "Append the current article to a Unix mail box file. diff --git a/lisp/gnus/rfc2104.el b/lisp/gnus/rfc2104.el index af6ebd5a80..0339d5983a 100644 --- a/lisp/gnus/rfc2104.el +++ b/lisp/gnus/rfc2104.el @@ -85,6 +85,14 @@ (setq ls (cdr ls))) v)) +(eval-when-compile + (defmacro rfc2104-string-make-unibyte (string) + "Return the unibyte equivalent of STRING. +In XEmacs return just STRING." + (if (featurep 'xemacs) + string + `(string-make-unibyte ,string)))) + (defun rfc2104-hash (hash block-length hash-length key text) (let* (;; if key is longer than B, reset it to HASH(key) (key (if (> (length key) block-length) @@ -100,7 +108,8 @@ (aset ipad i (logxor rfc2104-ipad c)) (aset opad i (logxor rfc2104-opad c))) ;; Perform inner hash. - (setq partial (string-make-unibyte (funcall hash (concat ipad text)))) + (setq partial (rfc2104-string-make-unibyte + (funcall hash (concat ipad text)))) ;; Pack latter part of opad. (do ((r 0 (+ 2 r)) (w block-length (1+ w))) @@ -109,7 +118,7 @@ (+ (* 16 (aref rfc2104-nybbles (aref partial r))) ( aref rfc2104-nybbles (aref partial (1+ r)))))) ;; Perform outer hash. - (string-make-unibyte (funcall hash opad)))) + (rfc2104-string-make-unibyte (funcall hash opad)))) (provide 'rfc2104) -- 2.20.1