comparison lisp/gnus/gnus-art.el @ 96654:0b339c48424c

Merge from gnus--devo--0 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1326
author Miles Bader <miles@gnu.org>
date Mon, 14 Jul 2008 06:56:18 +0000
parents 1f27a4bf06f5
children 51b8e9670c45
comparison
equal deleted inserted replaced
96653:5c9cdf4e586a 96654:0b339c48424c
3713 ;; Remove headers according to `gnus-saved-headers' or the value 3713 ;; Remove headers according to `gnus-saved-headers' or the value
3714 ;; of the `:headers' property that the saver function might have. 3714 ;; of the `:headers' property that the saver function might have.
3715 (let ((gnus-visible-headers 3715 (let ((gnus-visible-headers
3716 (or (symbol-value (get gnus-default-article-saver :headers)) 3716 (or (symbol-value (get gnus-default-article-saver :headers))
3717 gnus-saved-headers gnus-visible-headers)) 3717 gnus-saved-headers gnus-visible-headers))
3718 (gnus-article-buffer save-buffer)) 3718 ;; Ignore group parameter. See `article-hide-headers'.
3719 (gnus-summary-buffer nil))
3719 (with-current-buffer save-buffer 3720 (with-current-buffer save-buffer
3720 (article-hide-headers 1 t)))) 3721 (article-hide-headers 1 t))))
3721 (save-window-excursion 3722 (save-window-excursion
3722 (if (not gnus-default-article-saver) 3723 (if (not gnus-default-article-saver)
3723 (error "No default saver is defined") 3724 (error "No default saver is defined")
3941 3942
3942 (put 'gnus-summary-save-in-pipe :decode t) 3943 (put 'gnus-summary-save-in-pipe :decode t)
3943 (put 'gnus-summary-save-in-pipe :headers 'gnus-saved-headers) 3944 (put 'gnus-summary-save-in-pipe :headers 'gnus-saved-headers)
3944 (defun gnus-summary-save-in-pipe (&optional command) 3945 (defun gnus-summary-save-in-pipe (&optional command)
3945 "Pipe this article to subprocess." 3946 "Pipe this article to subprocess."
3946 (let ((default (or gnus-summary-pipe-output-default-command 3947 (let ((save-buffer gnus-save-article-buffer)
3948 (default (or gnus-summary-pipe-output-default-command
3947 gnus-last-shell-command))) 3949 gnus-last-shell-command)))
3950 ;; `gnus-save-article-buffer' should be a buffer containing the article
3951 ;; contents if this function is called by way of the command
3952 ;; `gnus-summary-pipe-output'. OTOH, that the buffer does not exist
3953 ;; means this function is called independently.
3954 (unless (gnus-buffer-live-p save-buffer)
3955 (let ((article (gnus-summary-article-number))
3956 (decode (get 'gnus-summary-save-in-pipe :decode)))
3957 (if article
3958 (if (vectorp (gnus-summary-article-header article))
3959 (save-window-excursion
3960 (let ((gnus-display-mime-function
3961 (when decode
3962 gnus-display-mime-function))
3963 (gnus-article-prepare-hook
3964 (when decode
3965 gnus-article-prepare-hook)))
3966 (gnus-summary-select-article t t nil article)
3967 (gnus-summary-goto-subject article))
3968 (insert-buffer-substring
3969 (prog1
3970 (if decode
3971 gnus-article-buffer
3972 gnus-original-article-buffer)
3973 (setq save-buffer
3974 (nnheader-set-temp-buffer " *Gnus Save*"))))
3975 ;; Remove unwanted headers.
3976 (let ((gnus-visible-headers
3977 (or (symbol-value (get gnus-default-article-saver
3978 :headers))
3979 gnus-saved-headers gnus-visible-headers))
3980 (gnus-summary-buffer nil))
3981 (article-hide-headers 1 t)))
3982 (error "%d is not a real article" article))
3983 (error "No article to pipe"))))
3948 (unless (stringp command) 3984 (unless (stringp command)
3949 (setq command 3985 (setq command
3950 (if (and (eq command 'default) default) 3986 (if (and (eq command 'default) default)
3951 default 3987 default
3952 (gnus-read-shell-command 3988 (gnus-read-shell-command
3959 "this article")) 3995 "this article"))
3960 default)))) 3996 default))))
3961 (when (string-equal command "") 3997 (when (string-equal command "")
3962 (if default 3998 (if default
3963 (setq command default) 3999 (setq command default)
3964 (error "A command is required")))) 4000 (error "A command is required")))
3965 (gnus-eval-in-buffer-window gnus-save-article-buffer 4001 (gnus-eval-in-buffer-window save-buffer
3966 (save-restriction 4002 (save-restriction
3967 (widen) 4003 (widen)
3968 (shell-command-on-region (point-min) (point-max) command nil))) 4004 (shell-command-on-region (point-min) (point-max) command nil)))
4005 (gnus-kill-buffer save-buffer))
3969 (setq gnus-summary-pipe-output-default-command command)) 4006 (setq gnus-summary-pipe-output-default-command command))
3970 4007
3971 (defun gnus-summary-pipe-to-muttprint (&optional command) 4008 (defun gnus-summary-pipe-to-muttprint (&optional command)
3972 "Pipe this article to muttprint." 4009 "Pipe this article to muttprint."
3973 (setq command (read-string 4010 (unless (stringp command)
3974 "Print using command: " gnus-summary-muttprint-program 4011 (setq command (read-string
3975 nil gnus-summary-muttprint-program)) 4012 "Print using command: " gnus-summary-muttprint-program
3976 (let ((gnus-last-shell-command gnus-last-shell-command)) 4013 nil gnus-summary-muttprint-program)))
3977 (gnus-summary-save-in-pipe command) 4014 (let ((gnus-summary-pipe-output-default-command
3978 (setq gnus-summary-muttprint-program gnus-last-shell-command))) 4015 gnus-summary-pipe-output-default-command))
4016 (gnus-summary-save-in-pipe command))
4017 (setq gnus-summary-muttprint-program command))
3979 4018
3980 ;;; Article file names when saving. 4019 ;;; Article file names when saving.
3981 4020
3982 (defun gnus-capitalize-newsgroup (newsgroup) 4021 (defun gnus-capitalize-newsgroup (newsgroup)
3983 "Capitalize NEWSGROUP name." 4022 "Capitalize NEWSGROUP name."