unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Doc-view at specific page number
@ 2019-09-17  6:22 Jean Louis
  2019-09-17 19:16 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Jean Louis @ 2019-09-17  6:22 UTC (permalink / raw)
  To: Help GNU Emacs


Is there any way to use doc-view to open PDF at specific page number?

I know there is function doc-view-goto-page, I would like to open PDF
file at specific page number.

Jean



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

* Re: Doc-view at specific page number
  2019-09-17  6:22 Doc-view at specific page number Jean Louis
@ 2019-09-17 19:16 ` Nick Dokos
  2019-09-17 23:28   ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2019-09-17 19:16 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis <bugs@gnu.support> writes:

> Is there any way to use doc-view to open PDF at specific page number?
>
> I know there is function doc-view-goto-page, I would like to open PDF
> file at specific page number.
>

(add-hook 'doc-view-mode-hook (lambda () (doc-view-goto-page 10)))

will open *every* PDF file at page 10 (not sure what happens if
there is no page 10), but I presume you will want to make it
interactive. So you can write a function that asks for the page
number, and adds something like this to the doc-view-mode-hook,
after cleaning up any previous such setting. Then add it as a -before
advice to find-file.

I tested the hook setting but not the rest of it: caveat emptor.
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




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

* Re: Doc-view at specific page number
  2019-09-17 19:16 ` Nick Dokos
@ 2019-09-17 23:28   ` Nick Dokos
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Dokos @ 2019-09-17 23:28 UTC (permalink / raw)
  To: help-gnu-emacs

Nick Dokos <ndokos@gmail.com> writes:

> Jean Louis <bugs@gnu.support> writes:
>
>> Is there any way to use doc-view to open PDF at specific page number?
>>
>> I know there is function doc-view-goto-page, I would like to open PDF
>> file at specific page number.
>>
>
> (add-hook 'doc-view-mode-hook (lambda () (doc-view-goto-page 10)))
>
> will open *every* PDF file at page 10 (not sure what happens if
> there is no page 10), but I presume you will want to make it
> interactive. So you can write a function that asks for the page
> number, and adds something like this to the doc-view-mode-hook,
> after cleaning up any previous such setting.

>Then add it as a -before  advice to find-file.

Scratch that - you'd hardly want to be asked another question every
time you call find-file. Maybe the thing to do is to add the function
to find-file-hook, but I thiink by that time the mode function has
been executed already, so the doc-view-mode-hook will not be run. But
maybe you can call doc-view-goto-page directly.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




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

end of thread, other threads:[~2019-09-17 23:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-17  6:22 Doc-view at specific page number Jean Louis
2019-09-17 19:16 ` Nick Dokos
2019-09-17 23:28   ` Nick Dokos

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).