unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* strange "feature"
@ 2012-10-13 14:58 immanuel litzroth
  2012-10-13 16:20 ` danny
  0 siblings, 1 reply; 10+ messages in thread
From: immanuel litzroth @ 2012-10-13 14:58 UTC (permalink / raw)
  To: emacs-devel

Opening a pdf file in emacs works really well. If you then try to
print it it will happily
print out a gazilion of text pages -- the pdf code. This behaviour
seems strange in that is
is almost certainly not what the user wants (he can
find-file-literally and print that).
I'm on emacs 23.3.1.
Is there a way to print the pdf directly from emacs (as a pdf)?
Immanuel



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strange "feature"
  2012-10-13 14:58 strange "feature" immanuel litzroth
@ 2012-10-13 16:20 ` danny
  2012-10-13 17:02   ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: danny @ 2012-10-13 16:20 UTC (permalink / raw)
  To: emacs-devel

On Sat, Oct 13, 2012 at 04:58:27PM +0200, immanuel litzroth wrote:
> Opening a pdf file in emacs works really well. If you then try to
> print it it will happily
> print out a gazilion of text pages -- the pdf code. This behaviour
> seems strange in that is
> is almost certainly not what the user wants (he can
> find-file-literally and print that).
> I'm on emacs 23.3.1.
> Is there a way to print the pdf directly from emacs (as a pdf)?
> Immanuel
> 
I've had issues with this "feature" as well, they keep me from printing most things in emacs. Does anyone at least know of a fix for this?(I think it's to do with docview not actually overriding the default print function)




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strange "feature"
  2012-10-13 16:20 ` danny
@ 2012-10-13 17:02   ` Eli Zaretskii
  2012-10-13 19:47     ` Tekk
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2012-10-13 17:02 UTC (permalink / raw)
  To: danny; +Cc: emacs-devel

> Date: Sat, 13 Oct 2012 12:20:16 -0400
> From: danny <danny@Wes.ec.rr.com>
> 
> On Sat, Oct 13, 2012 at 04:58:27PM +0200, immanuel litzroth wrote:
> > Opening a pdf file in emacs works really well. If you then try to
> > print it it will happily
> > print out a gazilion of text pages -- the pdf code. This behaviour
> > seems strange in that is
> > is almost certainly not what the user wants (he can
> > find-file-literally and print that).
> > I'm on emacs 23.3.1.
> > Is there a way to print the pdf directly from emacs (as a pdf)?
> > Immanuel
> > 
> I've had issues with this "feature" as well, they keep me from printing most things in emacs. Does anyone at least know of a fix for this?(I think it's to do with docview not actually overriding the default print function)

If this is on MS-Windows, you should be able to print a PDF file with
this Lisp one-liner:

  (w32-shell-execute "print" "/path/to/file.pdf")

This will work assuming that you have some program installed that can
display and print PDF files, and that this program is associated with
the .PDF extension.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strange "feature"
  2012-10-13 17:02   ` Eli Zaretskii
@ 2012-10-13 19:47     ` Tekk
  2012-10-14  5:59       ` Mathias Dahl
  2012-10-15  4:25       ` Stephen J. Turnbull
  0 siblings, 2 replies; 10+ messages in thread
From: Tekk @ 2012-10-13 19:47 UTC (permalink / raw)
  To: emacs-devel

On Sat, Oct 13, 2012 at 07:02:24PM +0200, Eli Zaretskii wrote:
> > Date: Sat, 13 Oct 2012 12:20:16 -0400
> > From: danny <danny@Wes.ec.rr.com>
> > 
> > On Sat, Oct 13, 2012 at 04:58:27PM +0200, immanuel litzroth wrote:
> > > Opening a pdf file in emacs works really well. If you then try to
> > > print it it will happily
> > > print out a gazilion of text pages -- the pdf code. This behaviour
> > > seems strange in that is
> > > is almost certainly not what the user wants (he can
> > > find-file-literally and print that).
> > > I'm on emacs 23.3.1.
> > > Is there a way to print the pdf directly from emacs (as a pdf)?
> > > Immanuel
> > > 
> > I've had issues with this "feature" as well, they keep me from printing most things in emacs. Does anyone at least know of a fix for this?(I think it's to do with docview not actually overriding the default print function)
> 
> If this is on MS-Windows, you should be able to print a PDF file with
> this Lisp one-liner:
> 
>   (w32-shell-execute "print" "/path/to/file.pdf")
> 
> This will work assuming that you have some program installed that can
> display and print PDF files, and that this program is associated with
> the .PDF extension.
> 
No, sorry; I'm on debian. Also sorry for the bad from: line before, I thought that mutt would automatically pick up my smtp stuff but apparently not :)




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strange "feature"
  2012-10-13 19:47     ` Tekk
@ 2012-10-14  5:59       ` Mathias Dahl
  2012-10-14 15:30         ` Stefan Monnier
  2012-10-15  4:25       ` Stephen J. Turnbull
  1 sibling, 1 reply; 10+ messages in thread
From: Mathias Dahl @ 2012-10-14  5:59 UTC (permalink / raw)
  To: Tekk; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2107 bytes --]

Maybe you can use something like this:

(defun xdg-open (file)
 "Open FILE in its default application."
  (interactive "fSelect file: ")
  (shell-command
   (format
    "xdg-open %s"
    (shell-quote-argument (expand-file-name file)))))

When you have the PDF file open in Emacs, do M-x xdg-open RET. Then just
arrow down to get the file name of the PDF open in Emacs, and RET. Then
print from the default PDF application that opens. I'm sure one could make
a more advanced command that checks for some common PDF applications and
sends them the correct Print command, if available. An exercise for the
reader :)

/Mathias

On Sat, Oct 13, 2012 at 9:47 PM, Tekk <tekk@parlementum.net> wrote:

> On Sat, Oct 13, 2012 at 07:02:24PM +0200, Eli Zaretskii wrote:
> > > Date: Sat, 13 Oct 2012 12:20:16 -0400
> > > From: danny <danny@Wes.ec.rr.com>
> > >
> > > On Sat, Oct 13, 2012 at 04:58:27PM +0200, immanuel litzroth wrote:
> > > > Opening a pdf file in emacs works really well. If you then try to
> > > > print it it will happily
> > > > print out a gazilion of text pages -- the pdf code. This behaviour
> > > > seems strange in that is
> > > > is almost certainly not what the user wants (he can
> > > > find-file-literally and print that).
> > > > I'm on emacs 23.3.1.
> > > > Is there a way to print the pdf directly from emacs (as a pdf)?
> > > > Immanuel
> > > >
> > > I've had issues with this "feature" as well, they keep me from
> printing most things in emacs. Does anyone at least know of a fix for
> this?(I think it's to do with docview not actually overriding the default
> print function)
> >
> > If this is on MS-Windows, you should be able to print a PDF file with
> > this Lisp one-liner:
> >
> >   (w32-shell-execute "print" "/path/to/file.pdf")
> >
> > This will work assuming that you have some program installed that can
> > display and print PDF files, and that this program is associated with
> > the .PDF extension.
> >
> No, sorry; I'm on debian. Also sorry for the bad from: line before, I
> thought that mutt would automatically pick up my smtp stuff but apparently
> not :)
>
>
>

[-- Attachment #2: Type: text/html, Size: 2914 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strange "feature"
  2012-10-14  5:59       ` Mathias Dahl
@ 2012-10-14 15:30         ` Stefan Monnier
  2012-10-14 22:03           ` Mathias Dahl
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2012-10-14 15:30 UTC (permalink / raw)
  To: Mathias Dahl; +Cc: Tekk, emacs-devel

> When you have the PDF file open in Emacs, do M-x xdg-open RET. Then just
> arrow down to get the file name of the PDF open in Emacs, and RET. Then
> print from the default PDF application that opens. I'm sure one could make
> a more advanced command that checks for some common PDF applications and
> sends them the correct Print command, if available. An exercise for the
> reader :)

If we want a command to print the whole PDF, then we can just pass it to
"lpr" without any further ado.


        Stefan



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strange "feature"
  2012-10-14 15:30         ` Stefan Monnier
@ 2012-10-14 22:03           ` Mathias Dahl
  0 siblings, 0 replies; 10+ messages in thread
From: Mathias Dahl @ 2012-10-14 22:03 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Tekk, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

>
>
> If we want a command to print the whole PDF, then we can just pass it to
> "lpr" without any further ado.
>

Ah, didn't know that. Even though I'm a long time GNU/Linux user I seldom
print stuff.

/Mathias

[-- Attachment #2: Type: text/html, Size: 511 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strange "feature"
  2012-10-13 19:47     ` Tekk
  2012-10-14  5:59       ` Mathias Dahl
@ 2012-10-15  4:25       ` Stephen J. Turnbull
  2012-10-15  5:34         ` Tekk
  1 sibling, 1 reply; 10+ messages in thread
From: Stephen J. Turnbull @ 2012-10-15  4:25 UTC (permalink / raw)
  To: Tekk; +Cc: emacs-devel

Tekk writes:

 > No, sorry; I'm on debian. Also sorry for the bad from: line before,
 > I thought that mutt would automatically pick up my smtp stuff but
 > apparently not :)

The basic print functions in Emacs are for printing buffer contents,
not formatted documents.

Presumably view could be configured to DTRT, but I have no trouble
with just "M-! lp foo.pdf RET" (using CUPS, which is a sad excuse for
a print spooler, but that's a completely different story).





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strange "feature"
  2012-10-15  4:25       ` Stephen J. Turnbull
@ 2012-10-15  5:34         ` Tekk
  2012-10-15  7:14           ` Stephen J. Turnbull
  0 siblings, 1 reply; 10+ messages in thread
From: Tekk @ 2012-10-15  5:34 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: emacs-devel

On Mon, Oct 15, 2012 at 01:25:41PM +0900, Stephen J. Turnbull wrote:
> Tekk writes:
> 
>  > No, sorry; I'm on debian. Also sorry for the bad from: line before,
>  > I thought that mutt would automatically pick up my smtp stuff but
>  > apparently not :)
> 
> The basic print functions in Emacs are for printing buffer contents,
> not formatted documents.
> 
> Presumably view could be configured to DTRT, but I have no trouble
> with just "M-! lp foo.pdf RET" (using CUPS, which is a sad excuse for
> a print spooler, but that's a completely different story).
> 
> 
> 
It's certainly possible, but I in general I think it'd be preferable for emacs to dtrt, especially if your printer apparently doesn't
like when you cancel jobs(as mine does,) and you aren't aware of it.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strange "feature"
  2012-10-15  5:34         ` Tekk
@ 2012-10-15  7:14           ` Stephen J. Turnbull
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen J. Turnbull @ 2012-10-15  7:14 UTC (permalink / raw)
  To: Tekk; +Cc: emacs-devel

Tekk writes:

 > It's certainly possible, but I in general I think it'd be
 > preferable for emacs to dtrt,

Patches welcome, I'm sure.

Personally I use

(defun sjt/print-file-of-buffer ()
  (let ((cmd (format "lp %s" (buffer-file-name))))
    (when (y-or-n-p (format "%s?" cmd))
      (shell-command cmd))))
(global-set-key [(control c) p] #'sjt/print-file-of-buffer)



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-10-15  7:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-13 14:58 strange "feature" immanuel litzroth
2012-10-13 16:20 ` danny
2012-10-13 17:02   ` Eli Zaretskii
2012-10-13 19:47     ` Tekk
2012-10-14  5:59       ` Mathias Dahl
2012-10-14 15:30         ` Stefan Monnier
2012-10-14 22:03           ` Mathias Dahl
2012-10-15  4:25       ` Stephen J. Turnbull
2012-10-15  5:34         ` Tekk
2012-10-15  7:14           ` Stephen J. Turnbull

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).