Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs

146 views
Skip to first unread message

Reiner Steib

unread,
Aug 22, 2007, 4:28:38 PM8/22/07
to
[ Crosspost & Followup-To: gnu.emacs.help ]

On Wed, Aug 22 2007, Tassilo Horn wrote:

> (defcustom doc-view-cache-directory "/tmp/doc-view"

Maybe use `temporary-file-directory' or `make-temp-name'.

> "The base directory, where the PNG imoges will be saved."
  images


> (defun doc-view-file-name-to-directory-name (file)
> "Return the directory where the png files of FILE should be saved.
>
> It'a a subdirectory of `doc-view-cache-directory'."
> (concat (directory-file-name doc-view-cache-directory)
> "/"
> (replace-regexp-in-string "/" "!" file)))

Probably not portable, I think. Windows users may set the directory
to "c:\foo\bar". Maybe you could do like the package formerly knows
as `tumme.el' does it. Ah, it's `image-dired.el' now:
`image-dired-thumb-name'.

> (defun doc-view-convert-file (file)
[...]
> (let* ((dir (doc-view-file-name-to-directory-name file))
> (png-file (concat dir "/" "page.png")))

,----[ (info "(elisp)Directory Names") ]
| If you want to use a directory file name in making such a
| combination, you must first convert it to a directory name using
| `file-name-as-directory':
|
| (concat (file-name-as-directory DIRFILE) RELFILE)
|
| Don't try concatenating a slash by hand, as in
|
| ;;; Wrong!
| (concat DIRFILE "/" RELFILE)
|
| because this is not portable. Always use `file-name-as-directory'.
`----

Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/

Stefan Monnier

unread,
Aug 26, 2007, 1:18:29 AM8/26/07
to
[ Please guys, this is a sources-only newsgroup. ]

>> Well, why do you think you have to wait? Go on with your work and
>> eventually the *DocView* buffer pops up. (That's much better in the
>> current version now.)

> The convert process seems very resource hungry as my Powerbook G4
> slows to a crawl (and is basically unusable) when I'm converting a
> large (2MB) PDF file. On small PDF's, it's still usable (but slow). I
> thought that a batch option would provide an alternative that might
> not be as intrusive.

Think about it hard: since you can do other things in Emacs in the mean
time, it's already running "in the background". If your G4 becomes
basically unusable, the best guess is that the conversion process uses up
all disk and memory resources, in which case there's not much you can do:
even lowering its CPU-priority will not buy you much responsiveness.


Stefan

Bill Clementson

unread,
Aug 26, 2007, 2:34:57 AM8/26/07
to help-gn...@gnu.org
Stefan Monnier <mon...@iro.umontreal.ca> writes:

I was thinking more in terms of kicking off a process that wasn't tied
to the Emacs calling process in any way (at present, there is a
process sentinel that notifies the doc-view caller that the conversion
has completed) and thus could be either reduced in priority or
scheduled for a different time.

- Bill

Martin Rubey

unread,
Aug 26, 2007, 9:49:50 AM8/26/07
to
Dear all,

I saw doc-view.el this week and was hoping that it would be the thing I was
looking for since years. Well, unfortunately, it doesn't *quite* do what I
want: I'd really like to have a (reasonably fast,) full-featured dvi/ps/pdf
viewer that I can control from within emacs.

In particular, I'd like to be able to search and copy text as in kdvi / kpdf.
Furthermore, rendering should be fast, so that modifying the LaTeX and pressing
C-c C-c Ret should update the buffer quickly.

I wonder why this is appears so difficult to achieve. Wouldn't it be possible
to have an X application running inside an emacs buffer? The standard
application for me would be to have my LaTeX source in one buffer, kdvi in
another, and C-x b gets me to that buffer. Using the window-managers
keybinding for switching to another application really does only half the job,
it's just not "as nice"...

I saw the xwem project a while ago, but it looks roughly dead, does more than I
need and moreover it doesn't work for gnu emacs...

Well, still, doc-view is quite nice,

Martin

Tassilo Horn

unread,
Aug 26, 2007, 12:55:55 PM8/26/07
to
Martin Rubey <axio...@yahoo.de> writes:

Hi Martin,

> In particular, I'd like to be able to search and copy text as in kdvi
> / kpdf.

The problem is that you can only embed images like jpeg or png is emacs
buffers and then it's hard if not impossible to extract any text.

> Furthermore, rendering should be fast, so that modifying the LaTeX and
> pressing C-c C-c Ret should update the buffer quickly.

Did you try AUCTeX with its preview-latex? That will to what you want.

> I wonder why this is appears so difficult to achieve. Wouldn't it be
> possible to have an X application running inside an emacs buffer?

As far as I know that's not possible.

> The standard application for me would be to have my LaTeX source in
> one buffer, kdvi in another, and C-x b gets me to that buffer. Using
> the window-managers keybinding for switching to another application
> really does only half the job, it's just not "as nice"...
>
> I saw the xwem project a while ago, but it looks roughly dead,

Well, I think it's not dead but finished. It seems to do everything its
users want.

> does more than I need and moreover it doesn't work for gnu emacs...

Yeah. Somebody should write a foreign function interface for GNU
Emacs...

> Well, still, doc-view is quite nice,

Thanks.

Bye,
Tassilo
--
People sometimes ask me if it is a sin in the Church of Emacs to use
vi. Using a free version of vi is not a sin; it is a penance. So happy
hacking. (Richard M. Stallman)

Bill Clementson

unread,
Aug 27, 2007, 12:07:00 PM8/27/07
to help-gn...@gnu.org
Hi Tassilo,

Tassilo Horn <tas...@member.fsf.org> writes:
> Bill Clementson <bill...@gmail.com> writes:
>> Just another small point - you use process-file-shell-command in
>> doc-view.el but that command is only available in recent CVS emacs and
>> not in 22.1. You might want to consider using process-file instead.
>
> No, that's not possible. `process-file' wants a PROGRAM whereas
> `process-file-shell-command' accepts a whole command line. Because the
> somewhat strange order dvipdfm accepts its aruments it seems to be not
> doable with `process-file' and its arguments.
>
> But I can use `shell-command' (and I do it now).

In the conversion of doc-view-convert-doc, you made a typo:
doc-view-conversion-buffed should be doc-view-conversion-buffer

Also, I suggested using C-n and C-p to scroll the image. You changed
the bindings of C-v and M-v to scroll the image and added C-n and M-p
to do next/previous page. I think my suggested bindings are closer to
what people would expect (e.g. - C-v would move to the next page while
C-n would move down in the current page). In any case, if you decide
to keep the existing bindings, you should probably at least change M-p
to C-p.

> BTW: We really should move the discussion to gnu.emacs.help now.

I've sent this followup to the emacs help newsgroup.

> Bye,
> Tassilo
> --
> My software never has bugs. It just develops random features.

The random feature this time was breaking on dvi generation. ;-)

- Bill

Peter Dyballa

unread,
Aug 27, 2007, 5:31:40 PM8/27/07
to Bill Clementson, help-gn...@gnu.org

Am 27.08.2007 um 18:07 schrieb Bill Clementson:

> Also, I suggested using C-n and C-p to scroll the image. You changed
> the bindings of C-v and M-v to scroll the image and added C-n and M-p
> to do next/previous page. I think my suggested bindings are closer to
> what people would expect (e.g. - C-v would move to the next page while
> C-n would move down in the current page). In any case, if you decide
> to keep the existing bindings, you should probably at least change M-p
> to C-p.

This does not look right. The well-known scroll-up and scroll-down
move an object in a window. A window is a view to some object. With
doc-view the object is the PNG representation of a page in PDF.
Scroll-up and scroll-down move the view over the picture. Some next-
or previous-thingy is right for changing the object in the view – or
turning the page.

--
Greetings

Pete

Government is actually the worst failure of civilized man. There has
never been a really good one, and even those that are most tolerable
are arbitrary, cruel, grasping and unintelligent.
-- H. L. Mencken


Tassilo Horn

unread,
Aug 28, 2007, 3:39:42 AM8/28/07
to
Bill Clementson <bill...@gmail.com> writes:

Hi Bill,

>> But I can use `shell-command' (and I do it now).
>
> In the conversion of doc-view-convert-doc, you made a typo:
> doc-view-conversion-buffed should be doc-view-conversion-buffer

Yes, I've fixed that. And I've sent it to emacs-devel for inclusion.
There's the new slicing-feature you're going to love! Trust me!

> Also, I suggested using C-n and C-p to scroll the image. You changed
> the bindings of C-v and M-v to scroll the image and added C-n and M-p
> to do next/previous page.

That was a typo and it's fixed now.

> I think my suggested bindings are closer to what people would expect
> (e.g. - C-v would move to the next page while C-n would move down in
> the current page). In any case, if you decide to keep the existing
> bindings, you should probably at least change M-p to C-p.

That's what I did, because C-v/M-v are always bound to scroll-up/down.

>> --
>> My software never has bugs. It just develops random features.
>
> The random feature this time was breaking on dvi generation. ;-)

That was the buffed-thing, right?

Anyway, get the new version and try slicing with the mouse. :-)

Bye,
Tassilo
--
If programmers deserve to be rewarded for creating innovative programs,
by the same token they deserve to be punished if they restrict the use
of these programs. (Richard M. Stallman)

Tim X

unread,
Aug 28, 2007, 5:15:09 AM8/28/07
to
Martin Rubey <axio...@yahoo.de> writes:

> Dear all,
>
> I saw doc-view.el this week and was hoping that it would be the thing I was
> looking for since years. Well, unfortunately, it doesn't *quite* do what I
> want: I'd really like to have a (reasonably fast,) full-featured dvi/ps/pdf
> viewer that I can control from within emacs.
>
> In particular, I'd like to be able to search and copy text as in kdvi / kpdf.
> Furthermore, rendering should be fast, so that modifying the LaTeX and pressing
> C-c C-c Ret should update the buffer quickly.
>
> I wonder why this is appears so difficult to achieve. Wouldn't it be possible
> to have an X application running inside an emacs buffer? The standard
> application for me would be to have my LaTeX source in one buffer, kdvi in
> another, and C-x b gets me to that buffer. Using the window-managers
> keybinding for switching to another application really does only half the job,
> it's just not "as nice"...
>

This would be very difficult, if not impossible. Firstly, if you wanted to
run an X application *within* emacs (not call an external process), then
emacs would need to implement an X server. Secondly, although emacs can
display graphics, it isn't really setup/designed as a true graphical
environment i.e. fast low level rendoring at the pixel level. thirdly, how
would you handle the different architectures (such as platforms like MS
that don't support X.


> I saw the xwem project a while ago, but it looks roughly dead, does more than I
> need and moreover it doesn't work for gnu emacs...
>

xwem is a window manager - thats a fairly simple role compared to the whole
rendering process which the X server takes care of - essentially, the
window manager just puts some frills around the edges. You can actually run
under X without any window manager, you just don't have higher level
functionality, such as the ability to iconify windows etc.

Writing a program that will render dvi or ps/pdf files is not a trivial
task. doing one AND writing or the rendering libraries etc is even more
work. I think you will only ever see three solutions, all of which are
already available -

1. Display via a call to an external program
2. Conversion to a png image a la doc-view.el
3. Conversion to a text representation and displayed in a buffer.

each have advantages and disadvantages, but anything else is really pushing
emacs as a text editor past its design goals and way too much effort for
the return you get.

Tim

--
tcross (at) rapttech dot com dot au

Peter Dyballa

unread,
Aug 28, 2007, 5:24:43 AM8/28/07
to Bill Clementson, help-gn...@gnu.org

Am 27.08.2007 um 23:43 schrieb Bill Clementson:

> Tassilo's bindings are:
> C-n/M-p = scroll to next/previous PDF page
> C-v/M-v = scroll image

These are in my understanding more "intuitive." I know that M-p was
meant to be C-p.

--
Greetings

Pete

There is no national science just as there is no national
multiplication table; what is national is no longer science.
-- Anton Checov


Joost Kremers

unread,
Aug 28, 2007, 6:08:17 AM8/28/07
to
Tassilo Horn wrote:
> Anyway, get the new version

i've just downloaded it and tried to compile, but my emacs chokes on
'defparameter'. the elisp manual doesn't mention defparameter, (require
'cl) also doesn't help, the emacs wiki site nor the source code mention any
requirements that i don't have, and i haven't been able to find any
relevant info on google... so please tell me, how do i get this elusive
defparameter?

TIA

--
Joost Kremers joostk...@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)

Bill Clementson

unread,
Aug 27, 2007, 5:43:41 PM8/27/07
to Peter Dyballa, help-gn...@gnu.org
Hi Peter,

Peter Dyballa <Peter_...@Web.DE> writes:

> Am 27.08.2007 um 18:07 schrieb Bill Clementson:
>

>> Also, I suggested using C-n and C-p to scroll the image. You changed
>> the bindings of C-v and M-v to scroll the image and added C-n and M-p

>> to do next/previous page. I think my suggested bindings are closer to


>> what people would expect (e.g. - C-v would move to the next page while
>> C-n would move down in the current page). In any case, if you decide
>> to keep the existing bindings, you should probably at least change M-p
>> to C-p.
>

> This does not look right. The well-known scroll-up and scroll-down
> move an object in a window. A window is a view to some object. With
> doc-view the object is the PNG representation of a page in PDF.
> Scroll-up and scroll-down move the view over the picture. Some next-
> or previous-thingy is right for changing the object in the view – or
> turning the page.

I'm not sure whether you're agreeing with me or Tassilo.

My suggested bindings were:
C-n/C-p = scroll image
C-v/M-v = scroll to next/previous PDF page

Tassilo's bindings are:
C-n/M-p = scroll to next/previous PDF page
C-v/M-v = scroll image

I can see that Tassilo might want to keep his bindings as he also has
the characters "n" and "p" bound to the "next/previous PDF page"
functions; however, I think that (if he keeps the existing bindings)
the "M-p" binding should be changed to "C-p".

- Bill


Tassilo Horn

unread,
Aug 28, 2007, 9:34:01 AM8/28/07
to
Bill Clementson <bill...@gmail.com> writes:

Hi Bill,

>> This does not look right. The well-known scroll-up and scroll-down


>> move an object in a window. A window is a view to some object. With
>> doc-view the object is the PNG representation of a page in PDF.
>> Scroll-up and scroll-down move the view over the picture. Some next-
>> or previous-thingy is right for changing the object in the view – or
>> turning the page.
>
> I'm not sure whether you're agreeing with me or Tassilo.
>
> My suggested bindings were:
> C-n/C-p = scroll image
> C-v/M-v = scroll to next/previous PDF page
>
> Tassilo's bindings are:
> C-n/M-p = scroll to next/previous PDF page
> C-v/M-v = scroll image
>
> I can see that Tassilo might want to keep his bindings as he also has
> the characters "n" and "p" bound to the "next/previous PDF page"
> functions; however, I think that (if he keeps the existing bindings)
> the "M-p" binding should be changed to "C-p".

The current bindings (in git) are

C-n/C-p = scroll to next/previous PDF page
C-v/M-v = scroll image

I do see that reversing those would make sense, too, but I prefer
sticking with the current bindings because that's the usual key-function
assignment.

Bye,
Tassilo
--
Chuck Norris doesnt wear a watch, HE decides what time it is.

Tassilo Horn

unread,
Aug 28, 2007, 9:29:25 AM8/28/07
to
Joost Kremers <joostk...@yahoo.com> writes:

Hi Joost,

> i've just downloaded it and tried to compile, but my emacs chokes on
> 'defparameter'. the elisp manual doesn't mention defparameter,
> (require 'cl) also doesn't help, the emacs wiki site nor the source
> code mention any requirements that i don't have, and i haven't been
> able to find any relevant info on google... so please tell me, how do
> i get this elusive defparameter?

--8<---------------cut here---------------start------------->8---
(defmacro defparameter (symbol &optional initvalue docstring)
"Common Lisps defparameter."
`(progn
(defvar ,symbol nil ,docstring)
(setq ,symbol ,initvalue)))
--8<---------------cut here---------------end--------------->8---

But that was just a typo. Please update, I removed it.

Bye,
Tassilo
--
Windows: So easy to admin, even a worm can do it.

Joost Kremers

unread,
Aug 28, 2007, 3:24:03 PM8/28/07
to
Tassilo Horn wrote:
[defparameter]

> But that was just a typo. Please update, I removed it.

ah, thanks. (i already replaced it with defvar, figuring that that way, it
would at least work. ;-)

btw, since my screen is rather small (12inch ibook), a converted page isn't
shown in full, and i have to scroll down to see the bottom part. (slicing
doesn't help, as the screen is just too small.) other viewers (xdvi, xpdf)
usually use the space bar to scroll down and jump to the top of the next
page if the bottom of the page is shown. usually, DEL or backspace does the
opposite.

i've been trying to implement this functionality for doc-view, but so far
without much luck. it turns out to be rather difficult to establish which
part of the image is actually shown in the active window. i've tried with
pos-visible-in-window-p and with window-start/window-end, but that doesn't
really work. do you perhaps know a better way to do this?

Thien-Thi Nguyen

unread,
Aug 28, 2007, 3:23:22 PM8/28/07
to
() Tim X <ti...@nospam.dev.null>
() Tue, 28 Aug 2007 19:15:09 +1000

but anything else is really pushing emacs as a text editor
past its design goals and way too much effort for the return
you get.

i think one design goal of emacs is that its users should feel
free to push, and push hard. "editing" in the most generalized
sense includes changes to the "editor" (machine or human). for
some, the changes stop at the eyes and ears. for others, the
brain is changed. for others, the ~/.emacs is changed. and
yet for others, the ~/.emacs leads to further changes w/o stop.

(it is true, humans die, but what we share is not limited so.)

emacs is a platform for editing.

thi

Bill Clementson

unread,
Aug 28, 2007, 4:45:58 PM8/28/07
to help-gn...@gnu.org
Hi Tassilo,

I made some mods to my copy of the doc-view function so that it can
either be passed a file name or called from dired:

diff --git a/doc-view.el b/doc-view.el
index 5742019..bcfcbb1 100644
--- a/doc-view.el
+++ b/doc-view.el
@@ -382,7 +382,7 @@ For now these keys are useful:
(message "DocView: finished conversion!")
(doc-view-display doc-view-current-doc)))

-(defun doc-view (no-cache)
+(defun doc-view (no-cache &optional file)
"Query for a document, convert it to png and start viewing it.
If this file is still in the cache, don't convert and use the
existing page files. With prefix arg NO-CACHE, don't use the
@@ -391,7 +391,8 @@ cached files and convert anew."
(if (not (and (image-type-available-p 'png)
(display-images-p)))
(message "DocView: your emacs or display doesn't support png images.")
- (let* ((doc (expand-file-name (read-file-name "File: " nil nil t)))
+ (let* ((doc (or file
+ (expand-file-name (read-file-name "File: " nil nil t))))
(buffer (get-buffer-create (format "*DocView: %s*" doc)))
(dir (doc-view-file-name-to-directory-name doc)))
(switch-to-buffer buffer)

I've also added a "V" key in my .emacs file so that dired can call
doc-view:

(defun doc-view-dired (no-cache)
"View the current dired file with doc-view."
(interactive "P")
(doc-view no-cache (dired-get-file-for-visit)))

(define-key dired-mode-map "V" 'doc-view-dired)

I find this very convenient and you might want to consider adding
something similar.

- Bill

Tassilo Horn

unread,
Aug 29, 2007, 3:06:34 AM8/29/07
to
Bill Clementson <bill...@gmail.com> writes:

Hi Bill,

> I made some mods to my copy of the doc-view function so that it can


> either be passed a file name or called from dired:

Good idea. I applied it.

> I've also added a "V" key in my .emacs file so that dired can call
> doc-view:
>
> (defun doc-view-dired (no-cache)
> "View the current dired file with doc-view."
> (interactive "P")
> (doc-view no-cache (dired-get-file-for-visit)))
>
> (define-key dired-mode-map "V" 'doc-view-dired)
>
> I find this very convenient and you might want to consider adding
> something similar.

Added with no default binding, but the comment tells how it should be
done.

Bye,
Tassilo
--
4 out of 5 doctors fail to recommend Chuck Norris as a solution to most
problems. Also, 80% of doctors die unexplained, needlessly brutal
deaths.

Bill Clementson

unread,
Aug 29, 2007, 10:41:21 AM8/29/07
to help-gn...@gnu.org
Hi Tassilo,

Tassilo Horn <tas...@member.fsf.org> writes:
> Bill Clementson <bill...@gmail.com> writes:

>> I made some mods to my copy of the doc-view function so that it can
>> either be passed a file name or called from dired:
>
> Good idea. I applied it.

Thanks.

- Bill

Joost Kremers

unread,
Aug 29, 2007, 12:25:28 PM8/29/07
to
Tassilo Horn wrote:
[defparameter]

> But that was just a typo. Please update, I removed it.

ah, thanks. (i had already replaced it with defvar, figuring that that way,


it would at least work. ;-)

btw, because my screen is rather small (12inch ibook), a converted page isn't


shown in full, and i have to scroll down to see the bottom part. (slicing
doesn't help, as the screen is just too small.) other viewers (xdvi, xpdf)
usually use the space bar to scroll down and jump to the top of the next
page if the bottom of the page is shown. usually, DEL or backspace does the
opposite.

i've been trying to implement this functionality for doc-view, but so far
without much luck. it turns out to be rather difficult to establish which
part of the image is actually shown in the active window. i've tried with
pos-visible-in-window-p and with window-start/window-end, but that doesn't
really work. do you perhaps know a better way to do this?

TIA

Tassilo Horn

unread,
Aug 29, 2007, 3:36:48 PM8/29/07
to
Joost Kremers <joostk...@yahoo.com> writes:

Hi Joost,

> btw, because my screen is rather small (12inch ibook), a converted


> page isn't shown in full, and i have to scroll down to see the bottom
> part. (slicing doesn't help, as the screen is just too small.)

You can still slice with:

,----[ C-h f doc-view-set-slice RET ]
| doc-view-set-slice is an interactive Lisp function in `doc-view.el'.
| (doc-view-set-slice X Y WIDTH HEIGHT)
|
| Set the slice of the images that should be displayed.
| You can use this function to tell doc-view not to display the
| margins of the document. It prompts for the top-left corner (X
| and Y) of the slice to display and its WIDTH and HEIGHT.
|
| See `doc-view-set-slice-using-mouse' for a more convenient way to
| do that. To reset the slice use `doc-view-reset-slice'.
`----

> other viewers (xdvi, xpdf) usually use the space bar to scroll down
> and jump to the top of the next page if the bottom of the page is
> shown. usually, DEL or backspace does the opposite.

Implemented.

Thanks for the idea,
Tassilo
--
Wenn Windows die Lösung ist, kann ich dann bitte
das Problem zurück haben?

Joost Kremers

unread,
Aug 29, 2007, 5:44:28 PM8/29/07
to
Tassilo Horn wrote:

hi tassilo,

>> btw, because my screen is rather small (12inch ibook), a converted
>> page isn't shown in full, and i have to scroll down to see the bottom
>> part. (slicing doesn't help, as the screen is just too small.)
>
> You can still slice with:

yes, i saw that function. however, the thing is, the text itself is simply
too large to fit on my screen. ;-) telling doc-view to create smaller
images wouldn't work either, because then the text becomes too small to
read.

>> other viewers (xdvi, xpdf) usually use the space bar to scroll down
>> and jump to the top of the next page if the bottom of the page is
>> shown. usually, DEL or backspace does the opposite.
>
> Implemented.

thanks, i just downloaded the new version. your way of doing it is a bit
smarter than mine. ;-) unfortunately, moving backward from the top of page
X to the bottom of page X-1 doesn't work. the cause seems to be to be what
i would consider a bug in emacs, though.

the problem is that calling (goto-char (point-max)) makes the entire image
disappear from the visible part of the buffer; only the line "Page x of y"
is visible. if at this point i hit DEL to scroll down the image and make it
visible, emacs displays the *top* part of the image, not the bottom part,
which i would expect.

like i said, i think this should be considered a bug in emacs. if the
buffer contents is scrolled down, and emacs needs to scroll an image into
view, it apparently shows the top of the image, even if the image is too
large to be visible all at once. what emacs *should* do in such cases,
IMHO, is show the *bottom* part of an image first, and only show the top
part of the image when the contents is scrolled down further.

btw, defparameter is back again, and you've made a typo:
doc-view-scroll-dows-or-previous-page (twice)
...................^

Bill Clementson

unread,
Aug 29, 2007, 5:50:31 PM8/29/07
to help-gn...@gnu.org
Hi Tassilo,

Tassilo Horn <tas...@member.fsf.org> writes:
> Implemented.

Looks like a defparameter snuck into that last commit. You should change
it to a defvar.

- Bill

Xavier Maillard

unread,
Aug 29, 2007, 7:42:07 PM8/29/07
to Tassilo Horn, help-gn...@gnu.org
Hi Tassilo,

--8<---------------cut here---------------start------------->8---
(defmacro defparameter (symbol &optional initvalue docstring)
"Common Lisps defparameter."
`(progn
(defvar ,symbol nil ,docstring)
(setq ,symbol ,initvalue)))
--8<---------------cut here---------------end--------------->8---

But that was just a typo. Please update, I removed it.

I do not see what the typo you are talking about is. Where is the
error in this code snipet ?

Xavier
--
http://www.gnu.org
http://www.april.org
http://www.lolica.org


Xavier Maillard

unread,
Aug 29, 2007, 7:42:09 PM8/29/07
to Bill Clementson, Peter_...@web.de, help-gn...@gnu.org
Hi,

I can see that Tassilo might want to keep his bindings as he also has
the characters "n" and "p" bound to the "next/previous PDF page"
functions; however, I think that (if he keeps the existing bindings)
the "M-p" binding should be changed to "C-p".

I agree with that statement.

Joost Kremers

unread,
Aug 29, 2007, 8:14:53 PM8/29/07
to
Xavier Maillard wrote:
> Hi Tassilo,
>
> --8<---------------cut here---------------start------------->8---
> (defmacro defparameter (symbol &optional initvalue docstring)
> "Common Lisps defparameter."
> `(progn
> (defvar ,symbol nil ,docstring)
> (setq ,symbol ,initvalue)))
> --8<---------------cut here---------------end--------------->8---
>
> But that was just a typo. Please update, I removed it.
>
> I do not see what the typo you are talking about is. Where is the
> error in this code snipet ?

the code snippet does not have a typo, it's tassilo's reply to my question
how to get defparameter in elisp. the typo is the fact that there was a
defparamater in his code.

Tassilo Horn

unread,
Aug 30, 2007, 3:09:55 AM8/30/07
to
Bill Clementson <bill...@gmail.com> writes:

Hi Bill,

> Looks like a defparameter snuck into that last commit. You should


> change it to a defvar.

Done so. I think I have to create a function that changes to
defparameter, evaluates the sexp and changes back to defvar...

Thanks,
Tassilo
--
"DRM manages rights in the same way a jail manages freedom"

Tassilo Horn

unread,
Aug 30, 2007, 3:14:54 AM8/30/07
to
Joost Kremers <joostk...@yahoo.com> writes:

Hi Joost,

>> You can still slice with:


>
> yes, i saw that function. however, the thing is, the text itself is
> simply too large to fit on my screen. ;-) telling doc-view to create
> smaller images wouldn't work either, because then the text becomes too
> small to read.

But you should be able to scroll with C-v/M-v or the arrow keys, aren't
you?

>>> other viewers (xdvi, xpdf) usually use the space bar to scroll down
>>> and jump to the top of the next page if the bottom of the page is
>>> shown. usually, DEL or backspace does the opposite.
>>
>> Implemented.
>
> thanks, i just downloaded the new version. your way of doing it is a
> bit smarter than mine. ;-) unfortunately, moving backward from the top
> of page X to the bottom of page X-1 doesn't work. the cause seems to
> be to be what i would consider a bug in emacs, though.
>
> the problem is that calling (goto-char (point-max)) makes the entire
> image disappear from the visible part of the buffer; only the line
> "Page x of y" is visible. if at this point i hit DEL to scroll down
> the image and make it visible, emacs displays the *top* part of the
> image, not the bottom part, which i would expect.

Yes, I know. Emacs' image scrolling capabilities are somewhat poor.

> btw, defparameter is back again, and you've made a typo:
> doc-view-scroll-dows-or-previous-page (twice)
> ...................^

Thanks, I've fixed both.

Bye,
Tassilo
--
Chuck Norris CAN believe it's not butter.

Tassilo Horn

unread,
Aug 30, 2007, 3:16:33 AM8/30/07
to
Xavier Maillard <x...@gnu.org> writes:

Hi Xavier,

> I can see that Tassilo might want to keep his bindings as he also
> has the characters "n" and "p" bound to the "next/previous PDF
> page" functions; however, I think that (if he keeps the existing
> bindings) the "M-p" binding should be changed to "C-p".
>
> I agree with that statement.

Me, too. And I changed the binding to C-p some days ago. :-)

Bye,
Tassilo
--
Chuck Norris is not Irish. His hair is soaked in the blood of his victims.

Tassilo Horn

unread,
Aug 30, 2007, 3:51:55 AM8/30/07
to
Tassilo Horn <tas...@member.fsf.org> writes:

> I think I have to create a function that changes to defparameter,
> evaluates the sexp and changes back to defvar...

Done!

--8<---------------cut here---------------start------------->8---
(defun th-eval-last-defvar-as-defparameter (ARG)
"Eval the `defvar' before point as if it was a `defparameter'."
(interactive "P")
(save-excursion
(let ((sexp (buffer-substring-no-properties
(point)
(progn
(backward-sexp)
(point)))))
(with-temp-buffer
(insert sexp)
(goto-char (point-min))
(condition-case nil
(progn
(search-forward "(defvar ")
(replace-match "(defparameter ")
(goto-char (point-max))
(eval-last-sexp ARG))
(error (message "The sexp before point must be a defvar
form!")))))))
--8<---------------cut here---------------end--------------->8---

Now it's bound to `C-x C-v'. Hopefully this was my last defparameter
checkin.

Bye,
Tassilo
--
People say that if you play Microsoft CD's backwards, you hear satanic
things, but that's nothing, because if you play them forwards, they
install Windows.

Joost Kremers

unread,
Aug 30, 2007, 5:37:23 AM8/30/07
to
Tassilo Horn wrote:
> But you should be able to scroll with C-v/M-v or the arrow keys, aren't
> you?

yes, certainly.

> Thanks, I've fixed both.

thank *you* for writing doc-view.el. ;-)

Tassilo Horn

unread,
Aug 30, 2007, 7:52:51 AM8/30/07
to
Joost Kremers <joostk...@yahoo.com> writes:

Hi Joost,

>> Thanks, I've fixed both.


>
> thank *you* for writing doc-view.el. ;-)

Hey, it's a whole bunch of fun. I've just finished implementing a new
feature: Now you can REGEXP-SEARCH in documents. Please git-pull and
give it a try. The commentary explains how to use it.

I tested it a bit and it seems to work for me, but certainly I added
some new bugs, too.

Bye,
Tassilo

Daniel Jensen

unread,
Aug 30, 2007, 1:15:59 PM8/30/07
to
Tassilo Horn <tas...@member.fsf.org> writes:

> I think I have to create a function that changes to
> defparameter, evaluates the sexp and changes back to defvar...

Why not use C-M-x (eval-defun)?

Bill Clementson

unread,
Aug 30, 2007, 1:25:02 PM8/30/07
to help-gn...@gnu.org
Hi Tassilo,

Tassilo Horn <tas...@member.fsf.org> writes:
> Hey, it's a whole bunch of fun. I've just finished implementing a new
> feature: Now you can REGEXP-SEARCH in documents. Please git-pull and
> give it a try. The commentary explains how to use it.

Hey, what a coincidence - I was just about to write a note saying
something along the lines of "now that the speed issue has been
addressed, the biggest remaining shortfall is..." and you went and
addressed it before I finished writing the post! ;-)

It would be nice if there was some way of highlighting the matching
terms in the document; however, I can't see how you would be able to
do that. Alternatively, as each matching page is displayed with
"C-S-n", perhaps you could display at the bottom of the page the
matches on that page with a certain amount of context - (e.g. - 10
words on either side of each match). That would let the reader find
the matches more easily on that page.

- Bill


Tassilo Horn

unread,
Aug 30, 2007, 1:34:33 PM8/30/07
to
dan...@bigwalter.net (Daniel Jensen) writes:

Hi Daniel,

>> I think I have to create a function that changes to
>> defparameter, evaluates the sexp and changes back to defvar...
>
> Why not use C-M-x (eval-defun)?

Hey, cool. I didn't know this command.

Thanks a lot,

Bill Clementson

unread,
Aug 30, 2007, 6:02:13 PM8/30/07
to help-gn...@gnu.org
Hi Tassilo,

FYI - I just posted about doc-view.el on my blog:
http://bc.tech.coop/blog/070830.html

Hopefully, my post is fairly accurate! ;-)

- Bill

Xavier Maillard

unread,
Aug 30, 2007, 9:00:34 PM8/30/07
to Tassilo Horn, help-gn...@gnu.org
Hi Tassilo,

Hey, it's a whole bunch of fun. I've just finished implementing a new
feature: Now you can REGEXP-SEARCH in documents. Please git-pull and
give it a try. The commentary explains how to use it.

I tried to git-pull but I got an error:

Cannot get the repository state from http://www.tsdh.de/repos/git/doc-view.git

Is there something I am doing wrong or what ?

Regards,

Xavier Maillard

unread,
Aug 30, 2007, 9:00:29 PM8/30/07
to Joost Kremers, help-gn...@gnu.org

the code snippet does not have a typo, it's tassilo's reply to my question
how to get defparameter in elisp. the typo is the fact that there was a
defparamater in his code.

Oops sorry :)

Tassilo Horn

unread,
Aug 31, 2007, 3:55:23 AM8/31/07
to
Bill Clementson <bill...@gmail.com> writes:

Hi Bill,

> Tassilo Horn <tas...@member.fsf.org> writes:


>> Hey, it's a whole bunch of fun. I've just finished implementing a
>> new feature: Now you can REGEXP-SEARCH in documents. Please git-pull
>> and give it a try. The commentary explains how to use it.
>
> Hey, what a coincidence - I was just about to write a note saying
> something along the lines of "now that the speed issue has been
> addressed, the biggest remaining shortfall is..." and you went and
> addressed it before I finished writing the post! ;-)

Something in my head whispered: "Bill wants to search documents...
search documents... uooouuuhhh!"

> It would be nice if there was some way of highlighting the matching
> terms in the document;

Haha, this one was nice! :-)

> however, I can't see how you would be able to do that. Alternatively,
> as each matching page is displayed with "C-S-n", perhaps you could
> display at the bottom of the page the matches on that page with a
> certain amount of context - (e.g. - 10 words on either side of each
> match).

I'll address this later today.

> That would let the reader find the matches more easily on that page.

Yes, when I tested the searching functionality I always thought: "Why's
that page a match, I cannot find that damn "foo" anywhere!" (Till some
minutes later I found that little "football" somewhere.)

Bye,
Tassilo
--
Chuck Norris ordered a Big Mac at Burger King, and got one.

Tassilo Horn

unread,
Aug 31, 2007, 3:47:03 AM8/31/07
to
Bill Clementson <bill...@gmail.com> writes:

Hi Bill,

> FYI - I just posted about doc-view.el on my blog:


> http://bc.tech.coop/blog/070830.html
>
> Hopefully, my post is fairly accurate! ;-)

Hey, it's very nice. I'm grabbing the video right now. I'm very
curious how doc-view looks in action. :-P

Bye,
Tassilo
--
Fighting patents one by one will never eliminate the danger of software
patents, any more than swatting mosquitoes will eliminate malaria.
(Richard M. Stallman)

Tassilo Horn

unread,
Aug 31, 2007, 3:42:55 AM8/31/07
to
Xavier Maillard <x...@gnu.org> writes:

Hi Xavier,

> I tried to git-pull but I got an error:


>
> Cannot get the repository state from
> http://www.tsdh.de/repos/git/doc-view.git
>
> Is there something I am doing wrong or what ?

No, but sometimes the server is down for some minutes. Please try
again.

Bye,
Tassilo
--
182,000 Americans die from Chuck Norris-related accidents every year.

Joost Kremers

unread,
Aug 31, 2007, 7:55:34 AM8/31/07
to
Tassilo Horn wrote:
> Joost Kremers <joostk...@yahoo.com> writes:
>
> Hi Joost,
>
>>> Thanks, I've fixed both.
>>
>> thank *you* for writing doc-view.el. ;-)
>
> Hey, it's a whole bunch of fun. I've just finished implementing a new
> feature: Now you can REGEXP-SEARCH in documents. Please git-pull and
> give it a try. The commentary explains how to use it.

it works fine, i haven't found any real bugs (yet ;-).

one thing though: the first time you press C-s, the document gets converted
to txt, but once this is done, you're not asked for a search string and no
searching is done. you have to press C-s again to do this. is this
intentional? if so, i must admit it's not very intuitive.

and another thing: would it be possible to inform the user about the
dimensions of the image when slicing with `s s'?

TIA

joost

Tassilo Horn

unread,
Aug 31, 2007, 9:02:45 AM8/31/07
to
Bill Clementson <bill...@gmail.com> writes:

Hi Bill,

> Alternatively, as each matching page is displayed with "C-S-n",


> perhaps you could display at the bottom of the page the matches on
> that page with a certain amount of context - (e.g. - 10 words on
> either side of each match).

Now I display the line containing the match at the bottom. It's
possible that you have to delete the TXT files from the cache, because
this required a new option to pdftotext, so that the lines in the PDF
match the lines in the TXT file.

Bye,
Tassilo
--
Chuck Norris is responsible for China's over-population. He hosted a
Karate tournament in Beijing and all women within 1,000 miles became
pregnant instantly.

Tassilo Horn

unread,
Aug 31, 2007, 10:42:13 AM8/31/07
to
Joost Kremers <joostk...@yahoo.com> writes:

Hi Joost,

>> Hey, it's a whole bunch of fun. I've just finished implementing a


>> new feature: Now you can REGEXP-SEARCH in documents. Please git-pull
>> and give it a try. The commentary explains how to use it.
>
> it works fine, i haven't found any real bugs (yet ;-).

Because I don't make any faults. :-)

> one thing though: the first time you press C-s, the document gets
> converted to txt, but once this is done, you're not asked for a search
> string and no searching is done. you have to press C-s again to do
> this. is this intentional?

Yes, because the process may take several seconds on slow machines and
big documents.

> if so, i must admit it's not very intuitive.

Yeah, now it's don this way: If the process finishes and the user didn't
switch to another buffer, the user will be queried for a regexp. If he
switched away, he won't be bothered.

> and another thing: would it be possible to inform the user about the
> dimensions of the image when slicing with `s s'?

Yes, now it always displays the valid range.

Bye,
Tassilo
--
GNU Emacs is a text editor for Über-Geeks.

Joost Kremers

unread,
Aug 31, 2007, 11:27:22 AM8/31/07
to
Tassilo Horn wrote:
> Joost Kremers <joostk...@yahoo.com> writes:
>
> Hi Joost,
>
>>> Hey, it's a whole bunch of fun. I've just finished implementing a
>>> new feature: Now you can REGEXP-SEARCH in documents. Please git-pull
>>> and give it a try. The commentary explains how to use it.
>>
>> it works fine, i haven't found any real bugs (yet ;-).
>
> Because I don't make any faults. :-)

heh, i wish i could say the same about me. ;-)

> Yeah, now it's don this way: If the process finishes and the user didn't
> switch to another buffer,

ah, i hadn't though of that possibility... true of course, that must be
taken into account.

> the user will be queried for a regexp. If he
> switched away, he won't be bothered.

sounds perfect.

>> and another thing: would it be possible to inform the user about the
>> dimensions of the image when slicing with `s s'?
>
> Yes, now it always displays the valid range.

great!

Joost Kremers

unread,
Aug 31, 2007, 11:38:23 AM8/31/07
to
[doc-view]

hi tassilo,

one more thing: i added (require 'cl) to the source to keep the compiler
from complaining about remove-if.

Bill Clementson

unread,
Aug 31, 2007, 12:38:59 PM8/31/07
to help-gn...@gnu.org
Hi Tassilo,

Tassilo Horn <tas...@member.fsf.org> writes:

> Bill Clementson <bill...@gmail.com> writes:
>> Alternatively, as each matching page is displayed with "C-S-n",
>> perhaps you could display at the bottom of the page the matches on
>> that page with a certain amount of context - (e.g. - 10 words on
>> either side of each match).
>
> Now I display the line containing the match at the bottom. It's
> possible that you have to delete the TXT files from the cache, because
> this required a new option to pdftotext, so that the lines in the PDF
> match the lines in the TXT file.

Great - that looks really nice.

I tried some searches on a number of different files and they almost
all worked fine. However, when I tried searching Peter Seibel's
Practical Common Lisp PDF book (free download from Apress:
http://www.apress.com/free/index.html), there were mismatches between
the page that was displayed and the matching text. The page number
corresponded to the page number that was displayed; however, the
search term wasn't on the page. The line containing the match was
displayed correctly; however, it was for a page later in the
document. This seemed to happen for any searches I did of the PCL pdf
file.

First, I thought it might have something to do with the size of the
pdf file or blank pages not being counted; however, searches of the
sicp.pdf book all seemed to produce correct results, so I'm not sure
why the search functionality doesn't work properly in some instances.

- Bill

Bill Clementson

unread,
Aug 31, 2007, 12:44:11 PM8/31/07
to help-gn...@gnu.org
Hi Tassilo,

Tassilo Horn <tas...@member.fsf.org> writes:

> Bill Clementson <bill...@gmail.com> writes:
>> Tassilo Horn <tas...@member.fsf.org> writes:
>>> Hey, it's a whole bunch of fun. I've just finished implementing a
>>> new feature: Now you can REGEXP-SEARCH in documents. Please git-pull
>>> and give it a try. The commentary explains how to use it.
>>
>> Hey, what a coincidence - I was just about to write a note saying
>> something along the lines of "now that the speed issue has been
>> addressed, the biggest remaining shortfall is..." and you went and
>> addressed it before I finished writing the post! ;-)
>
> Something in my head whispered: "Bill wants to search documents...
> search documents... uooouuuhhh!"

Good to hear that my telepathic, DWIW utility is working properly. It
also is slated to appear in CVS Emacs shortly. ;-)

>> It would be nice if there was some way of highlighting the matching
>> terms in the document;
>
> Haha, this one was nice! :-)

I thought you would find that amusing. ;-)

>> however, I can't see how you would be able to do that. Alternatively,
>> as each matching page is displayed with "C-S-n", perhaps you could
>> display at the bottom of the page the matches on that page with a
>> certain amount of context - (e.g. - 10 words on either side of each
>> match).
>
> I'll address this later today.

Great - I see you've already done it and I have a few comments in a
separate reply.

>> That would let the reader find the matches more easily on that page.
>
> Yes, when I tested the searching functionality I always thought: "Why's
> that page a match, I cannot find that damn "foo" anywhere!" (Till some
> minutes later I found that little "football" somewhere.)

I have the same problem - if I don't have the phrase pointed out to
me, I can spend ages trying to find it on the page.

- Bill

Tassilo Horn

unread,
Aug 31, 2007, 1:15:23 PM8/31/07
to
Joost Kremers <joostk...@yahoo.com> writes:

Hi Joost,

> one more thing: i added (require 'cl) to the source to keep the


> compiler from complaining about remove-if.

Oh, indeed. I added it.

Bye,
Tassilo
--
People sometimes ask me if it is a sin in the Church of Emacs to use
vi. Using a free version of vi is not a sin; it is a penance. So happy
hacking. (Richard M. Stallman)

Tassilo Horn

unread,
Aug 31, 2007, 1:46:37 PM8/31/07
to
Bill Clementson <bill...@gmail.com> writes:

Hi Bill,

>> Now I display the line containing the match at the bottom. It's


>> possible that you have to delete the TXT files from the cache,
>> because this required a new option to pdftotext, so that the lines in
>> the PDF match the lines in the TXT file.
>
> Great - that looks really nice.

Yippie!

And it's even getting better: the search matches are now displayed in
the help-echo, too.

> I tried some searches on a number of different files and they almost
> all worked fine. However, when I tried searching Peter Seibel's
> Practical Common Lisp PDF book (free download from Apress:
> http://www.apress.com/free/index.html), there were mismatches between
> the page that was displayed and the matching text. The page number
> corresponded to the page number that was displayed; however, the
> search term wasn't on the page. The line containing the match was
> displayed correctly; however, it was for a page later in the
> document. This seemed to happen for any searches I did of the PCL pdf
> file.

I have that PDF and it works for me. Could you please delete the
doc.txt in the cache and try again?

If it still doesn't work, please post your search regexp.

Bye,
Tassilo
--
When in a bar, you can order a drink called a "Chuck Norris". It is also
known as a "Bloody Mary", if your name happens to be Mary.

Peter Dyballa

unread,
Aug 31, 2007, 3:06:17 PM8/31/07
to Bill Clementson, help-gn...@gnu.org

Am 31.08.2007 um 18:38 schrieb Bill Clementson:

>
> First, I thought it might have something to do with the size of the
> pdf file or blank pages not being counted; however, searches of the
> sicp.pdf book all seemed to produce correct results, so I'm not sure
> why the search functionality doesn't work properly in some instances.

The reason is probably that pdftotext is used with the -raw option,
which deletes all empty lines leading white space. There is another
option: -layout.

I think doc-view should check the number of pages first (pdfinfo
<file> | grep -i pages | awk '{print $NF}'). If the number is greater
1 than -layout should be more appropriate ...


BTW, -layout is bit faster!

--
Mit friedvollen Grüßen

Pete

Irgendwer sollte den Kugelschreiber mit einem Kleiderbügel kreuzen,
dass die Kulis sich vermehren, statt stets nur zu verschwinden!


Bill Clementson

unread,
Aug 31, 2007, 4:29:57 PM8/31/07
to help-gn...@gnu.org
Hi Tassilo,

Tassilo Horn <tas...@member.fsf.org> writes:

> Bill Clementson <bill...@gmail.com> writes:
>>> Now I display the line containing the match at the bottom. It's
>>> possible that you have to delete the TXT files from the cache,
>>> because this required a new option to pdftotext, so that the lines in
>>> the PDF match the lines in the TXT file.
>>
>> Great - that looks really nice.
>
> Yippie!
>
> And it's even getting better: the search matches are now displayed in
> the help-echo, too.

Hey, that's really cool. But, I have to move the mouse in order to get
the help-echo to display. Is there anyway to get the help-echo to
display without the mouse (either automatically once you've done
"C-S-n" or with a key)?

>> I tried some searches on a number of different files and they almost
>> all worked fine. However, when I tried searching Peter Seibel's
>> Practical Common Lisp PDF book (free download from Apress:
>> http://www.apress.com/free/index.html), there were mismatches between
>> the page that was displayed and the matching text. The page number
>> corresponded to the page number that was displayed; however, the
>> search term wasn't on the page. The line containing the match was
>> displayed correctly; however, it was for a page later in the
>> document. This seemed to happen for any searches I did of the PCL pdf
>> file.
>
> I have that PDF and it works for me. Could you please delete the
> doc.txt in the cache and try again?
>
> If it still doesn't work, please post your search regexp.

Ok, I deleted the doc.txt file for PCL and did a "C-u doc-view" to
re-generate the PDF; however, search still doesn't work properly with
PCL. I just did a simple search for "mapcar". When I press "C-S-n",
the first page it positions to is physical page 51 (page 25 in the
book). However, "mapcar" isn't on that page. The first match is
actually on physical page 57 (page 31 in the book) and that
corresponds to the matching text that is displayed by doc-view for
physical page 51 ("specify the values to change. The main new bit is
the use of a function MAPCARthat maps over").

Presumably, if you search for "mapcar", you are positioned to physical
page 57?

- Bill

Bill Clementson

unread,
Aug 31, 2007, 4:56:42 PM8/31/07
to help-gn...@gnu.org
Peter Dyballa <Peter_...@Web.DE> writes:

> Am 31.08.2007 um 18:38 schrieb Bill Clementson:
>
>>
>> First, I thought it might have something to do with the size of the
>> pdf file or blank pages not being counted; however, searches of the
>> sicp.pdf book all seemed to produce correct results, so I'm not sure
>> why the search functionality doesn't work properly in some instances.
>
> The reason is probably that pdftotext is used with the -raw option,
> which deletes all empty lines leading white space. There is another
> option: -layout.
>
> I think doc-view should check the number of pages first (pdfinfo
> <file> | grep -i pages | awk '{print $NF}'). If the number is greater
> 1 than -layout should be more appropriate ...
>
>
> BTW, -layout is bit faster!

I tried deleting the doc.txt file, changing the pdftotext parameter to
"-layout" and re-doing the search. Unfortunately, the results were the
save with the PCL pdf file.

- Bill

Tassilo Horn

unread,
Aug 31, 2007, 4:16:40 PM8/31/07
to
Peter Dyballa <Peter_...@Web.DE> writes:

Hi Pete,

>> First, I thought it might have something to do with the size of the
>> pdf file or blank pages not being counted; however, searches of the
>> sicp.pdf book all seemed to produce correct results, so I'm not sure
>> why the search functionality doesn't work properly in some instances.
>
> The reason is probably that pdftotext is used with the -raw option,
> which deletes all empty lines leading white space. There is another
> option: -layout.

I use -raw here and don't have any problems. Both versions have 528
occurences of ^J and that's what doc-view uses for counting pages.

> I think doc-view should check the number of pages first (pdfinfo
> <file> | grep -i pages | awk '{print $NF}'). If the number is greater
> 1 than -layout should be more appropriate ...

I don't like -layout, because then the context of the search matches
contain those whitespaces, too.

Maybe you use an older (buggy) pdftotext version?

> BTW, -layout is bit faster!

Not here:

heimdall@baldur ~/t/test> time pdftotext -raw practicalcommonlisp.pdf pcl.txtraw
21.11user 0.21system 0:21.60elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1135minor)pagefaults 0swaps
heimdall@baldur ~/t/test> time pdftotext -layout practicalcommonlisp.pdf pcl.txtlayout
21.84user 0.22system 0:22.34elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1400minor)pagefaults 0swaps

Bye,
Tassilo
--
Chuck Norris is the only man who has, literally, beaten the odds. With his fists.

Tassilo Horn

unread,
Aug 31, 2007, 5:54:42 PM8/31/07
to
Bill Clementson <bill...@gmail.com> writes:

>> And it's even getting better: the search matches are now displayed in
>> the help-echo, too.
>
> Hey, that's really cool. But, I have to move the mouse in order to get
> the help-echo to display. Is there anyway to get the help-echo to
> display without the mouse (either automatically once you've done
> "C-S-n" or with a key)?

For your pleasure: now C-t does that.

>> I have that PDF and it works for me. Could you please delete the
>> doc.txt in the cache and try again?
>>
>> If it still doesn't work, please post your search regexp.
>
> Ok, I deleted the doc.txt file for PCL and did a "C-u doc-view" to
> re-generate the PDF; however, search still doesn't work properly with
> PCL. I just did a simple search for "mapcar". When I press "C-S-n",
> the first page it positions to is physical page 51 (page 25 in the
> book). However, "mapcar" isn't on that page. The first match is
> actually on physical page 57 (page 31 in the book) and that
> corresponds to the matching text that is displayed by doc-view for
> physical page 51 ("specify the values to change. The main new bit is
> the use of a function MAPCARthat maps over").
>
> Presumably, if you search for "mapcar", you are positioned to physical
> page 57?

Exactly.

What's your pdftotext version? Mine is

,----[ pdftotext -v ]
| pdftotext version 3.00
| Copyright 1996-2004 Glyph & Cog, LLC
`----

which comes with poppler-0.5.4.

Could you please upload the doc.txt somewhere?

Bye,
Tassilo

Bill Clementson

unread,
Aug 31, 2007, 8:28:14 PM8/31/07
to help-gn...@gnu.org
Hi Tassilo,

Tassilo Horn <tas...@member.fsf.org> writes:

> Bill Clementson <bill...@gmail.com> writes:
>
>>> And it's even getting better: the search matches are now displayed in
>>> the help-echo, too.
>>
>> Hey, that's really cool. But, I have to move the mouse in order to get
>> the help-echo to display. Is there anyway to get the help-echo to
>> display without the mouse (either automatically once you've done
>> "C-S-n" or with a key)?
>
> For your pleasure: now C-t does that.

Great - thanks!

I'll have to start thinking up some harder enhancements - you whip
these out too quickly! ;-)

>>> I have that PDF and it works for me. Could you please delete the
>>> doc.txt in the cache and try again?
>>>
>>> If it still doesn't work, please post your search regexp.
>>
>> Ok, I deleted the doc.txt file for PCL and did a "C-u doc-view" to
>> re-generate the PDF; however, search still doesn't work properly with
>> PCL. I just did a simple search for "mapcar". When I press "C-S-n",
>> the first page it positions to is physical page 51 (page 25 in the
>> book). However, "mapcar" isn't on that page. The first match is
>> actually on physical page 57 (page 31 in the book) and that
>> corresponds to the matching text that is displayed by doc-view for
>> physical page 51 ("specify the values to change. The main new bit is
>> the use of a function MAPCARthat maps over").
>>
>> Presumably, if you search for "mapcar", you are positioned to physical
>> page 57?
>
> Exactly.
>
> What's your pdftotext version? Mine is
>
> ,----[ pdftotext -v ]
> | pdftotext version 3.00
> | Copyright 1996-2004 Glyph & Cog, LLC
> `----
>
> which comes with poppler-0.5.4.

Mine is:
~/Projects/doc-view $ pdftotext -v
pdftotext version 3.02
Copyright 1996-2007 Glyph & Cog, LLC

> Could you please upload the doc.txt somewhere?

I uploaded it to: http://bc.tech.coop/doc.txt

- Bill

Tassilo Horn

unread,
Sep 1, 2007, 4:32:54 AM9/1/07
to
Bill Clementson <bill...@gmail.com> writes:

Hi Bill,

> I'll have to start thinking up some harder enhancements - you whip


> these out too quickly! ;-)

Maybe I could start introducing some little bugs in the meantime and the
one who reports first gets a candy.

>> Could you please upload the doc.txt somewhere?
>
> I uploaded it to: http://bc.tech.coop/doc.txt

Ok, the difference in paging was that your newer version puts something
like this for an empty page:

,----
| before empty page
| ^J^J
| after empty page
`----

whereas my older version makes that

,----
| before empty page
| ^J
| ^J
| after empty page
`----

So I simply had to change the regexp for increasing the pagenumber. The
old one always matched to the end of line and so ^J^J increased the
pageno by one instead of two.

I tested it with your doc.txt and mine and both seem to work as
expected.
--
Wenn Windows die Lösung ist, kann ich dann bitte
das Problem zurück haben?

Bill Clementson

unread,
Sep 1, 2007, 1:45:45 PM9/1/07
to help-gn...@gnu.org
Hi Tassilo,

Tassilo Horn <tas...@member.fsf.org> writes:

> Bill Clementson <bill...@gmail.com> writes:
>> I'll have to start thinking up some harder enhancements - you whip
>> these out too quickly! ;-)
>
> Maybe I could start introducing some little bugs in the meantime and the
> one who reports first gets a candy.

I don't eat much candy, but I like beer!

>>> Could you please upload the doc.txt somewhere?
>>
>> I uploaded it to: http://bc.tech.coop/doc.txt
>
> Ok, the difference in paging was that your newer version puts something
> like this for an empty page:
>
> ,----
> | before empty page
> | ^J^J
> | after empty page
> `----
>
> whereas my older version makes that
>
> ,----
> | before empty page
> | ^J
> | ^J
> | after empty page
> `----

You probably meant "^L", but, yes that makes sense. Glad it was an
easy thing to locate.

> So I simply had to change the regexp for increasing the pagenumber. The
> old one always matched to the end of line and so ^J^J increased the
> pageno by one instead of two.
>
> I tested it with your doc.txt and mine and both seem to work as
> expected.

Works fine now - thanks!

- Bill

Tassilo Horn

unread,
Sep 1, 2007, 5:59:06 PM9/1/07
to
Bill Clementson <bill...@gmail.com> writes:

Hi Bill,

>> Maybe I could start introducing some little bugs in the meantime and


>> the one who reports first gets a candy.
>
> I don't eat much candy, but I like beer!

Haha, me too. If you ever visit Germany be sure to visit
http://www.maximilians-brauwiesen.de/ (personally, not virtually).
"Maximilians Brauwiesen Braunes" is IMO the world's best beer.

(Probably they brew the best beer, but webdesign isn't their strength.)

Bye,
Tassilo

Bill Clementson

unread,
Sep 1, 2007, 8:42:54 PM9/1/07
to help-gn...@gnu.org
Hi Tassilo,

Tassilo Horn <tas...@member.fsf.org> writes:
> Bill Clementson <bill...@gmail.com> writes:

>>> Maybe I could start introducing some little bugs in the meantime and
>>> the one who reports first gets a candy.
>>
>> I don't eat much candy, but I like beer!
>
> Haha, me too. If you ever visit Germany be sure to visit
> http://www.maximilians-brauwiesen.de/ (personally, not virtually).
> "Maximilians Brauwiesen Braunes" is IMO the world's best beer.
>
> (Probably they brew the best beer, but webdesign isn't their strength.)

Thanks - I'll make a note of it and see if I can find any in the local
(Vancouver) shops. Maybe I won't have to wait till the next time I'm
in Germany!

- Bill

Xavier Maillard

unread,
Sep 1, 2007, 9:00:13 PM9/1/07
to Bill Clementson, help-gn...@gnu.org
Hi,

FYI - I just posted about doc-view.el on my blog:
http://bc.tech.coop/blog/070830.html

Hopefully, my post is fairly accurate! ;-)

It is and I like the video. It would have been cooler not to
choose QuickTime format though ;)

Bill Clementson

unread,
Sep 2, 2007, 1:09:48 AM9/2/07
to help-gn...@gnu.org
Hi Xavier,

Xavier Maillard <x...@gnu.org> writes:
> FYI - I just posted about doc-view.el on my blog:
> http://bc.tech.coop/blog/070830.html
>
> Hopefully, my post is fairly accurate! ;-)
>
> It is and I like the video. It would have been cooler not to
> choose QuickTime format though ;)

What would have been a better format and what utility would you have
used to do the movie? I've tried a number of different ones and I've
gotten the best results with QuickTime format using SnapZ Pro on Mac
OS X. However, I'm not an expert in video utilities/formats so would
appreciate recommendations.

- Bill

Xavier Maillard

unread,
Sep 2, 2007, 4:21:19 AM9/2/07
to Tassilo Horn, help-gn...@gnu.org

> Cannot get the repository state from
> http://www.tsdh.de/repos/git/doc-view.git
>
> Is there something I am doing wrong or what ?

No, but sometimes the server is down for some minutes. Please try
again.

Yes, it works now. Nice add-ons by the way !

Regards,

Tassilo Horn

unread,
Sep 2, 2007, 4:32:31 AM9/2/07
to
Bill Clementson <bill...@gmail.com> writes:

Hi Bill,

>> It is and I like the video. It would have been cooler not to choose


>> QuickTime format though ;)
>
> What would have been a better format and what utility would you have
> used to do the movie? I've tried a number of different ones and I've
> gotten the best results with QuickTime format using SnapZ Pro on Mac
> OS X. However, I'm not an expert in video utilities/formats so would
> appreciate recommendations.

I think a quite good tool for screencasts is recordmydesktop [1]. It
produces OGG files where video is encoded with Theora and sound is
encoded with Vorbis.

Bye,
Tassilo
__________
[1] http://recordmydesktop.iovar.org

Tassilo Horn

unread,
Sep 2, 2007, 4:58:24 AM9/2/07
to
Bill Clementson <bill...@gmail.com> writes:


>> Haha, me too. If you ever visit Germany be sure to visit
>> http://www.maximilians-brauwiesen.de/ (personally, not virtually).
>> "Maximilians Brauwiesen Braunes" is IMO the world's best beer.
>

> Thanks - I'll make a note of it and see if I can find any in the local
> (Vancouver) shops. Maybe I won't have to wait till the next time I'm
> in Germany!

You won't have any luck. You can only get it directly at the brewery or
its restaurant/Biergarten.

But I could send you some sixpacks. With DHL it would be 32 EUR for
shipping two, or 42 EUR for four sixpacks. With UPS it would be about
200 EUR shipping for four sixpacks. :-)

Bye,
Tassilo
--
When Chuck Norris wants an egg, he cracks open a chicken.

Bill Clementson

unread,
Sep 2, 2007, 8:30:13 PM9/2/07
to help-gn...@gnu.org
Hi Tassilo,

Tassilo Horn <tas...@member.fsf.org> writes:
> Bill Clementson <bill...@gmail.com> writes:
>
>>> Haha, me too. If you ever visit Germany be sure to visit
>>> http://www.maximilians-brauwiesen.de/ (personally, not virtually).
>>> "Maximilians Brauwiesen Braunes" is IMO the world's best beer.
>>
>> Thanks - I'll make a note of it and see if I can find any in the local
>> (Vancouver) shops. Maybe I won't have to wait till the next time I'm
>> in Germany!
>
> You won't have any luck. You can only get it directly at the brewery or
> its restaurant/Biergarten.

That's too bad.

> But I could send you some sixpacks. With DHL it would be 32 EUR for
> shipping two, or 42 EUR for four sixpacks. With UPS it would be about
> 200 EUR shipping for four sixpacks. :-)

The DHL rate of 42 EUR for 4 sixpacks sounds like a pretty good
rate. 4 sixpacks of Canadian beer would be about 33 Eur. I wonder what
sort of duty Canada would charge on beer imports (probably quite a
hefty amount as Canada has some of the highest rates of taxes on
alcohol in the world).

Nah, I better not buy any - I might get used to drinking it and then
it would cost me a fortune! But, thanks for the offer anyhow!!

- Bill

Bill Clementson

unread,
Sep 2, 2007, 8:41:06 PM9/2/07
to help-gn...@gnu.org
Hi Tassilo,

Tassilo Horn <tas...@member.fsf.org> writes:

> Bill Clementson <bill...@gmail.com> writes:
>>> It is and I like the video. It would have been cooler not to choose
>>> QuickTime format though ;)
>>
>> What would have been a better format and what utility would you have
>> used to do the movie? I've tried a number of different ones and I've
>> gotten the best results with QuickTime format using SnapZ Pro on Mac
>> OS X. However, I'm not an expert in video utilities/formats so would
>> appreciate recommendations.
>
> I think a quite good tool for screencasts is recordmydesktop [1]. It
> produces OGG files where video is encoded with Theora and sound is
> encoded with Vorbis.

Unfortunately, recordmydesktop is linux-only and I use Mac OS X. I
haven't found any port of recordmydesktop for OS X and none of the
other open source Mac options for screencasts seems to support OGG
file output. I once did an audio recording of Gregor Kiczales
(http://bc.tech.coop/blog/060709.html) and someone converted it to OGG
format; however, he used a linux utility and I haven't found any good
OS X options for outputting OGG format audio or video.

I was playing around with vnc2swf
(http://www.unixuser.org/~euske/vnc2swf/) to see whether I could use
that instead (it outputs screencasts in Flash swf format); however, it
only worked some of the time and audio syncing (with the video) was a
bit "problematic".

- Bill

Xavier Maillard

unread,
Sep 2, 2007, 9:00:17 PM9/2/07
to Tassilo Horn, help-gn...@gnu.org

Bill Clementson <bill...@gmail.com> writes:


>> Haha, me too. If you ever visit Germany be sure to visit
>> http://www.maximilians-brauwiesen.de/ (personally, not virtually).
>> "Maximilians Brauwiesen Braunes" is IMO the world's best beer.
>
> Thanks - I'll make a note of it and see if I can find any in the local
> (Vancouver) shops. Maybe I won't have to wait till the next time I'm
> in Germany!

You won't have any luck. You can only get it directly at the brewery or
its restaurant/Biergarten.

But I could send you some sixpacks. With DHL it would be 32 EUR for
shipping two, or 42 EUR for four sixpacks. With UPS it would be about
200 EUR shipping for four sixpacks. :-)

How does it compare with Guiness (taste, etc.) ?

Xavier Maillard

unread,
Sep 2, 2007, 9:00:30 PM9/2/07
to Bill Clementson, help-gn...@gnu.org

Hi Xavier,

Xavier Maillard <x...@gnu.org> writes:
> FYI - I just posted about doc-view.el on my blog:
> http://bc.tech.coop/blog/070830.html
>
> Hopefully, my post is fairly accurate! ;-)
>

> It is and I like the video. It would have been cooler not to
> choose QuickTime format though ;)

What would have been a better format and what utility would you have
used to do the movie? I've tried a number of different ones and I've
gotten the best results with QuickTime format using SnapZ Pro on Mac
OS X. However, I'm not an expert in video utilities/formats so would
appreciate recommendations.

I am not an expert at all. My reflexion was just on the choice of
QuickTime (a notorious proprietary format). I think XVid would be
a best bet but I may be wrong.

Anyway, thank you for the video ;)

Xavier Maillard

unread,
Sep 2, 2007, 9:00:41 PM9/2/07
to Tassilo Horn, help-gn...@gnu.org

>> It is and I like the video. It would have been cooler not to choose
>> QuickTime format though ;)
>
> What would have been a better format and what utility would you have
> used to do the movie? I've tried a number of different ones and I've
> gotten the best results with QuickTime format using SnapZ Pro on Mac
> OS X. However, I'm not an expert in video utilities/formats so would
> appreciate recommendations.

I think a quite good tool for screencasts is recordmydesktop [1]. It
produces OGG files where video is encoded with Theora and sound is
encoded with Vorbis.

Really nice ! I did not know about it. THank you Tassilo.

Tassilo Horn

unread,
Sep 3, 2007, 7:12:00 AM9/3/07
to
Xavier Maillard <x...@gnu.org> writes:

Hi Xavier,

> You won't have any luck. You can only get it directly at the
> brewery or its restaurant/Biergarten.
>
> But I could send you some sixpacks. With DHL it would be 32 EUR
> for shipping two, or 42 EUR for four sixpacks. With UPS it would
> be about 200 EUR shipping for four sixpacks. :-)
>
> How does it compare with Guiness (taste, etc.) ?


--
No person, no idea, and no religion deserves to be illegal to insult,
not even the Church of Emacs. (Richard M. Stallman)

Peter Dyballa

unread,
Sep 3, 2007, 7:15:19 AM9/3/07
to Bill Clementson, help-gn...@gnu.org

Am 03.09.2007 um 02:41 schrieb Bill Clementson:

> I haven't found any good OS X options for outputting OGG format
> audio or video

Have you found and tried Perian? http://trac.perian.org/, http://
svn.perian.org. They add plug-ins for (the) QuickTime (framework) to
enable the use of additional audio, video, and encoding formats, that
even an elderly tool like qtplay can now play Ogg. Probably this also
allows to convert to other formats.


The Fink project offers parts of recordMyDesktop, pyGTK and pyQt, or
libogg and libvorbis. The biggest obstacles are libtheora and
libXfixes, which is from X11R7 – maybe in Leopard? Other pre-
requisites, at least for some example player programmes, are libsdl
and liboss (which then needs libesound and libaudiofile and ...),
both (all) supplied by Fink. These example players seem to be not
necessary since VLC or Helix Player (Real Player 10) provide their
ability.

--
Greetings

Pete

"There's no place like 127.0.0.1"
origin unknown


Bill Clementson

unread,
Sep 3, 2007, 2:58:31 PM9/3/07
to Peter Dyballa, help-gn...@gnu.org
Hi Peter,

Peter Dyballa <Peter_...@Web.DE> writes:

> Am 03.09.2007 um 02:41 schrieb Bill Clementson:
>
>> I haven't found any good OS X options for outputting OGG format
>> audio or video
>
> Have you found and tried Perian? http://trac.perian.org/, http://
> svn.perian.org. They add plug-ins for (the) QuickTime (framework) to
> enable the use of additional audio, video, and encoding formats, that
> even an elderly tool like qtplay can now play Ogg. Probably this also
> allows to convert to other formats.

I had a look at the Perian site. I didn't see anything that indicated
that they support OGG video capture output.

> The Fink project offers parts of recordMyDesktop, pyGTK and pyQt, or
> libogg and libvorbis. The biggest obstacles are libtheora and
> libXfixes, which is from X11R7 – maybe in Leopard? Other pre-
> requisites, at least for some example player programmes, are libsdl
> and liboss (which then needs libesound and libaudiofile and ...),
> both (all) supplied by Fink. These example players seem to be not
> necessary since VLC or Helix Player (Real Player 10) provide their
> ability.

Wouldn't libtheora be necessary for outputting OGG format videos? In
any case, I'm not interested in writing my own screenrecording
utility, I just want to use one. So far, the best one that I've found
for Mac OS X is SnapZ Pro. It's commercial and it doesn't produce OGG
output; but, I guess I'll just keep using that until I find some
alternative that is open source and produces OGG output and runs under
Mac OS X.

Thanks for the suggestions.

- Bill


Peter Dyballa

unread,
Sep 3, 2007, 5:00:17 PM9/3/07
to Bill Clementson, emacs list

Am 03.09.2007 um 20:58 schrieb Bill Clementson:

> Wouldn't libtheora be necessary for outputting OGG format videos?

Yes, libtheora is needed to encode video material. Ogg is just a
container format for *some* streams of compressed data (audio, video,
text).


Perian does not offer any ready to use tools. It only has the APIs
and library functions. With QuickTime Pro or iMovie or such gadgets
it might work to save the recorded scene in an Ogg container with
Vorbis audio and Theora video contents.

If Perian is missing things like Theora, the XiphQT plug-in has it:
http://www.xiph.org/quicktime/.


I am not doing anything with video or audio programmes (and my clone
is missing spare time, too), except listening to some free music
recorded at concerts or watching some funny video.

--
Greetings

Pete

Be careful of reading health books, you might die of a misprint.
-- Mark Twain


Bill Clementson

unread,
Sep 3, 2007, 7:04:17 PM9/3/07
to Peter Dyballa, emacs list
Hi Peter,

Peter Dyballa <Peter_...@Web.DE> writes:
> Am 03.09.2007 um 20:58 schrieb Bill Clementson:
>
>> Wouldn't libtheora be necessary for outputting OGG format videos?
>
> Yes, libtheora is needed to encode video material. Ogg is just a
> container format for *some* streams of compressed data (audio, video,
> text).
>
>
> Perian does not offer any ready to use tools. It only has the APIs
> and library functions. With QuickTime Pro or iMovie or such gadgets
> it might work to save the recorded scene in an Ogg container with
> Vorbis audio and Theora video contents.
>
> If Perian is missing things like Theora, the XiphQT plug-in has it:
> http://www.xiph.org/quicktime/.
>
>
> I am not doing anything with video or audio programmes (and my clone
> is missing spare time, too), except listening to some free music
> recorded at concerts or watching some funny video.

Ok, thanks for the info. I've had "partial" success in creating an ogg
video file from my QT movie. I did the following:

1. Downloaded XiphQT package from:
http://www.xiph.org/quicktime/download.html
2. Moved XiphQT.component to ~/Library/Components/
3. Loaded my doc-view.mov movie into iMovie
4. In iMovie, selected File/Share... menu option
5. Selected "Expert Settings" from the drop down menu
6. Selected "Movie to Ogg" as the Export: option and pressed
"Options..."
7. Under "Video Settings", I selected "Best" for Frames per Second and
"Best" for Compressor Quality and "High" for Sharpness

The movie was converted to OGG format (e.g. - an OGG container with
the sound in the Vorbis codec and the video in the Theora
code). However, although the resulting sound quality was ok, the video
quality was very poor. It was so poor that, although I could make out
what was happening in the movie, it is doubtful that anyone would want
to watch it. So, I guess converting .MOV movies to OGG format isn't
really a viable option.

On Mac OS X, I can use VLC to view OGG videos; however, I haven't been
able to find any screenrecording utility that will save to OGG. Does
anyone have any recommendations?

- Bill


Xavier Maillard

unread,
Sep 3, 2007, 9:00:12 PM9/3/07
to Tassilo Horn, help-gn...@gnu.org

Xavier Maillard <x...@gnu.org> writes:

Hi Xavier,

> You won't have any luck. You can only get it directly at the
> brewery or its restaurant/Biergarten.
>
> But I could send you some sixpacks. With DHL it would be 32 EUR
> for shipping two, or 42 EUR for four sixpacks. With UPS it would
> be about 200 EUR shipping for four sixpacks. :-)
>
> How does it compare with Guiness (taste, etc.) ?

Yes ? :)

Bill Clementson

unread,
Sep 4, 2007, 9:10:12 PM9/4/07
to help-gn...@gnu.org
Hi all,

Bill Clementson <bill...@gmail.com> writes:

Just for the record (and in case any Mac OS X users find themselves in
the same predicament), I was able to finally convert my Quicktime
Movie to OGG. The issue was iMovie converting everything first to DV,
when it did the export. If you are able to use QuickTime Pro to export
again as OGG you don't have the same problem. I converted the movie to
OGG format and have posted it on my blog. A description of what I went
through and a link to the doc-view.ogg movie are here:
http://bc.tech.coop/blog/070904.html

The OGG format movie is actually smaller in size (~9MB as opposed to
~16MB for the Quicktime movie) and of comparable quality.

Thanks to Tassilo, Peter, and Xavier for the pointers and suggestions.

- Bill

0 new messages