From: Reiner Steib <4uce.02.r.steib@gmx.net>
Subject: [Patch] printing articles differently than displaying them
Date: Fri, 09 Aug 2002 20:52:37 +0200 [thread overview]
Message-ID: <v91y97q2yy.fsf@marauder.physik.uni-ulm.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 1623 bytes --]
I use normally use (setq gnus-treat-hide-citation t). But when I print
some process marked articles I'd like to see the cited text in the
printed version. Well, I could change `gnus-treat-hide-citation'
before (and after) printing manually, but I think there should be a
hook to do this job. `gnus-ps-print-hook' comes too late.
I'm quite new to elisp, so I'd appreciate comments. Maybe my patch is
nonsense. ;-)
I added a hook that is run from `gnus-summary-print-article'
(whereas `gnus-ps-print-hook' is run from `gnus-print-buffer').
But even if I toggle `gnus-treat-hide-citation' I have to re-display
the current article again, because `gnus-summary-select-article' is
called with FORCE (2nd optional arg) set to nil. Therefore I added a
variable to customize this: `gnus-ps-print-refetch-selected-article'.
Inside `gnus-summary-print-article' I made `gnus-treat-hide-citation'
and `gnus-treat-hide-citation-maybe' local variables.
Now I'm able to print w/o hidden citations:
(setq gnus-ps-print-refetch-selected-article t)
(add-hook 'gnus-ps-print-select-article-hook
'(lambda ()
(setq gnus-treat-hide-citation nil)))
The patch may also be useful if someone wants to read with citations
and print without citations.
The current behavior of `gnus-summary-print-article' is not changed
(`gnus-ps-print-select-article-hook' and
`gnus-ps-print-refetch-selected-article' are nil by default).
In case the patch will be accepted, I could write some lines for
<info://gnus/Article+Commands> too. There's the documentation for
`gnus-summary-print-article' and `gnus-ps-print-hook'.
So, here's the patch:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch for gnus-summary-print-article --]
[-- Type: text/x-patch, Size: 1773 bytes --]
--- gnus-sum.el 2002/08/03 23:06:05 6.220
+++ gnus-sum.el 2002/08/08 21:16:50
@@ -833,6 +833,11 @@
:group 'gnus-summary
:type 'hook)
+(defcustom gnus-ps-print-select-article-hook nil
+ "*A hook run before selecting an article for ps-printing."
+ :group 'gnus-summary
+ :type 'hook)
+
(defcustom gnus-summary-display-arrow
(and (fboundp 'display-graphic-p)
(display-graphic-p))
@@ -1016,6 +1021,12 @@
:group 'gnus-summary
:type '(choice boolean regexp))
+(defcustom gnus-ps-print-refetch-selected-article nil
+ "Whether Gnus should re-fetch articles before printing."
+ :version "21.3"
+ :type 'boolean
+ :group 'gnus-article)
+
(defcustom gnus-summary-muttprint-program "muttprint"
"Command (and optional arguments) used to run Muttprint."
:version "21.3"
@@ -8182,12 +8193,16 @@
that name. If FILENAME is a number, prompt the user for the name of the file
to save in."
(interactive (list (ps-print-preprint current-prefix-arg)))
- (dolist (article (gnus-summary-work-articles n))
- (gnus-summary-select-article nil nil 'pseudo article)
- (gnus-eval-in-buffer-window gnus-article-buffer
- (gnus-print-buffer))
- (gnus-summary-remove-process-mark article))
- (ps-despool filename))
+ (let ((gnus-treat-hide-citation)
+ (gnus-treat-hide-citation-maybe))
+ (gnus-run-hooks 'gnus-ps-print-select-article-hook)
+ (dolist (article (gnus-summary-work-articles n))
+ (gnus-summary-select-article nil gnus-ps-print-refetch-selected-article
+ 'pseudo article)
+ (gnus-eval-in-buffer-window gnus-article-buffer
+ (gnus-print-buffer))
+ (gnus-summary-remove-process-mark article))
+ (ps-despool filename)))
(defun gnus-print-buffer ()
(let ((buffer (generate-new-buffer " *print*")))
[-- Attachment #3: Type: text/plain, Size: 116 bytes --]
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- PGP key available via WWW http://rsteib.home.pages.de/
next reply other threads:[~2002-08-09 18:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-09 18:52 Reiner Steib [this message]
2002-08-09 19:30 ` Simon Josefsson
2002-08-09 21:53 ` Reiner Steib
2002-08-12 20:48 ` Toby Speight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=v91y97q2yy.fsf@marauder.physik.uni-ulm.de \
--to=4uce.02.r.steib@gmx.net \
--cc=reiner.steib@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).