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

2007-08-27 Thread Tim X
Tassilo Horn [EMAIL PROTECTED] writes:

 Tim X [EMAIL PROTECTED] writes:

 Hi Tim,

 5. Dired key: It would be nice to have a defcustom value that would
 specify a dired map key that would call doc-view on a file (with a
 new doc-view function that doesn't prompt for the file name). This
 would make it easier to browse pdf files in dired.

 Good idea.  I'll add that.  Do you have a good suggestion what key
 could be used and is free?

 How about b (for browse) or V (for View)?

 I think 'b' is available. However, you may find it useful to do what I
 did in my txutils.el package. I used defadvice around view-file (which
 is bound to v in dired).

 Since I was asked to include doc-view.el in Emacs I'm not sure if
 defadvice would be too good.  AFAIK RMS doesn't like it too much.


Actually, this is a misunderstanding of RMS' position. It is true he
doesn't want defadvice used in packages that are part of emacs, but thats
not because he doesn't like the mechanism. His view is that it could make
debugging of problems harder because it can obscure what is going on. As a
facility to change exisitnig functionality, he has no issue with it. 

So, yes, your right you shouldn't use it if the package is going to be part
of emacs, but incorrect on the reason. However, since it will be part of
emacs, there is no reason you couldn't ask for a change - either to how
view-file works or to how/what is bound to the 'v' key in dired. For
exmaple, you could create a new funciton that is bound to v which does
things specific based on the file extension. 

 So, now if I hit v on a pdf, ps, doc, ppt html etc file, it converts
 the file to either text or html and then displays it in a buffer (in
 the case of html output and .html files, it just uses browse-url to
 display the rendered version).

 At least for PS files that may not be the right thing.  Users might want
 to view it with `ps-mode' instead.


One of the nice things about advising view-file is that you still get
standard behavior if you just hit enter i.e. if you hit enter on a ps file,
it will just open the file in ps-mode. However, ps-mode is I think for
hacking at the postscript level rather than for viewing. 

The nice thing about the txutils package is that all of this is controlled
by a customizable variable. If you remove the translation entry for
PostScript, then no conversion will occur.

Tim





-- 
tcross (at) rapttech dot com dot au
___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-26 Thread Bill Clementson
Stefan Monnier [EMAIL PROTECTED] writes:

 [ Please guys, this is a sources-only newsgroup. ]

I posted this reply to the emacs help newsgroup as well. Presumably
any further discussion should occur there.

 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.

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



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-26 Thread Tassilo Horn
Bill Clementson [EMAIL PROTECTED] writes:

Hi Bill,

 1. It is slow: It would probably be better to provide an async mode
 option. In other words, instead of waiting for the convert process
 to complete, let the user view the pages that have been generated
 and periodically, have doc-view automatically update the
 doc-view-current-files variable with the updated list of pages.

 I don't think that would help much.  The generation of the pictures
 is about the last 5-10% of the transformation.

Please update.  I changed it to use plain ghostscript now, which makes
it about 10 times faster.  The results are nearly as good.  The only
real downside is that I didn't figure out how I can trim the margins,
yet.

Bye,
Tassilo



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-26 Thread Tassilo Horn
Tim X [EMAIL PROTECTED] writes:

Hi Tim,

 5. Dired key: It would be nice to have a defcustom value that would
 specify a dired map key that would call doc-view on a file (with a
 new doc-view function that doesn't prompt for the file name). This
 would make it easier to browse pdf files in dired.

 Good idea.  I'll add that.  Do you have a good suggestion what key
 could be used and is free?

 How about b (for browse) or V (for View)?

 I think 'b' is available. However, you may find it useful to do what I
 did in my txutils.el package. I used defadvice around view-file (which
 is bound to v in dired).

Since I was asked to include doc-view.el in Emacs I'm not sure if
defadvice would be too good.  AFAIK RMS doesn't like it too much.

 So, now if I hit v on a pdf, ps, doc, ppt html etc file, it converts
 the file to either text or html and then displays it in a buffer (in
 the case of html output and .html files, it just uses browse-url to
 display the rendered version).

At least for PS files that may not be the right thing.  Users might want
to view it with `ps-mode' instead.

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



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-26 Thread Henrik Enberg
Guys, the gnu-emacs-sources info page¹ has the following to say:

| This list/newsgroup will be for the posting, by their authors, of Emacs
| Lisp and C sources and patches that improve GNU Emacs. Its contents
| will be reviewed by the FSF for inclusion in future releases of GNU
| Emacs.

| Please do NOT discuss or request source code here. Use
| help-gnu-emacs/gnu.emacs.help for those purposes. This allows the
| automatic archiving of sources posted to this list/newsgroup.

For me at least, endless discussions about previously posted code
reducess the usefulness of this list.

[1] http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources

-- 
If animal trapped call 410-844-6286


___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-26 Thread Bill Clementson
Hi Tassilo

Tassilo Horn [EMAIL PROTECTED] writes:

 Bill Clementson [EMAIL PROTECTED] writes:
 1. It is slow: It would probably be better to provide an async mode
 option. In other words, instead of waiting for the convert process
 to complete, let the user view the pages that have been generated
 and periodically, have doc-view automatically update the
 doc-view-current-files variable with the updated list of pages.

 I don't think that would help much.  The generation of the pictures
 is about the last 5-10% of the transformation.

 Please update.  I changed it to use plain ghostscript now, which makes
 it about 10 times faster.  The results are nearly as good.  The only
 real downside is that I didn't figure out how I can trim the margins,
 yet.

It doesn't look like the new version is in the git repository:

~/Projects/doc-view $ git pull
Fetching refs/heads/master from http://www.tsdh.de/repos/git/doc-view.git using 
http
Already up-to-date.
~/Projects/doc-view $ git log
commit 2736e4f17a7592e5d1e018995f81a86ace44d3c8
Author: Tassilo Horn [EMAIL PROTECTED]
Date:   Wed Aug 22 21:44:29 2007 +0200

Require dired

commit fe21cf209b5a15f83cefa42132f205b0f1aa4a72
Author: Tassilo Horn [EMAIL PROTECTED]
Date:   Wed Aug 22 21:23:09 2007 +0200

defparameter - defvar

Are you doing your commits to the git repository that is on the
doc-view.el page on your wiki?:
http://www.tsdh.de/cgi-bin/wiki.pl/doc-view.el

I am new to git, so maybe I'm doing something wrong.

- Bill



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-26 Thread Bill Clementson
Hi Tassilo,

Tassilo Horn [EMAIL PROTECTED] writes:

 Bill Clementson [EMAIL PROTECTED] writes:

 Hi Bill,

 I am new to git, so maybe I'm doing something wrong.

 No, the problem was on my side.  Please try again.

Yep, that did it.

Wow, the performance increase with gs is incredible! That's really
amazing. :-)

BTW, you might want to add the following bindings to doc-view-mode-map:

(define-key map (kbd C-p)   'scroll-down)
(define-key map (kbd C-n)   'scroll-up)

They make it easier to scroll the image if your frame size is too
small to show the entire page.

- Bill



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-26 Thread Tassilo Horn
Bill Clementson [EMAIL PROTECTED] writes:

Hi Bill,

 Wow, the performance increase with gs is incredible! That's really
 amazing. :-)

Yep, but it's a bummer that I dunno how to cut of the margins.

 BTW, you might want to add the following bindings to
 doc-view-mode-map:

 (define-key map (kbd C-p)   'scroll-down)
 (define-key map (kbd C-n)   'scroll-up)

Nope. :-)

I'll make C-v and M-v for scrolling, because that's the default.  C-p
and C-n will move to the previous/next page.

BTW: Please open a new thread on gnu.emacs.help for further discussions.
It seems that this group is not intended therfore and I don't want to
hijack it.

Bye,
Tassilo
-- 
When Chuck Norris works out on the Total Gym, the Total Gym feels like
it's been raped.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-25 Thread Tassilo Horn
Bill Clementson [EMAIL PROTECTED] writes:

Hi Bill,

 Only the Macports install worked on my Powerbook G4 (and that took
 ages to build all the dependencies because Macports builds versions of
 the dependencies that work with the package you're installing even if
 you have non-Macports versions of the same progs installed and in your
 path). Tassilo, please forgive me for all the names I called you this
 afternoon for using git! ;-)

Haha, forgiven.

 But, back to doc-view.el. Did I mention that it is way cool? :-)

Thanks!

 There are a few ways that it could probably be made better though:

 1. It is slow: It would probably be better to provide an async mode
 option. In other words, instead of waiting for the convert process to
 complete, let the user view the pages that have been generated and
 periodically, have doc-view automatically update the
 doc-view-current-files variable with the updated list of pages.

I don't think that would help much.  The generation of the pictures is
about the last 5-10% of the transformation.

 2. Cancel key: There should be a key binding to cancel the convert
 process and (optionally) view what has been generated so far.

I've done that yesterday.  Get the current version.

 3. Page count: It would be useful to have a running update of how many
 pages have been converted so far in the minibuffer (or maybe the mode
 line so that the minibuffer isn't being continually updated and can be
 used for other commands).

See my answer to point 1.

 4. Batch mode: It would be nice to have an option to kick off a batch
 background process to do the conversion. For big documents, it isn't
 really practical to wait till it's been converted.

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

 5. Dired key: It would be nice to have a defcustom value that would
 specify a dired map key that would call doc-view on a file (with a new
 doc-view function that doesn't prompt for the file name). This would
 make it easier to browse pdf files in dired.

Good idea.  I'll add that.  Do you have a good suggestion what key could
be used and is free?

 Did I mention that doc-view is way cool? :-)

And think of how cool it will be in 5 or ten years when we all have
64-core 50 GHz computers with 512 GB RAM!!!

Bye,
Tassilo
-- 
Scotty in Star  Trek often says Ye cannae change  the laws of physics.
This is  untrue. Chuck Norris can  change the laws of  physics. With his
fists.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-25 Thread Bill Clementson
Hi Tassilo,

Tassilo Horn [EMAIL PROTECTED] writes:

 Bill Clementson [EMAIL PROTECTED] writes:
 There are a few ways that it could probably be made better though:

 1. It is slow: It would probably be better to provide an async mode
 option. In other words, instead of waiting for the convert process to
 complete, let the user view the pages that have been generated and
 periodically, have doc-view automatically update the
 doc-view-current-files variable with the updated list of pages.

 I don't think that would help much.  The generation of the pictures is
 about the last 5-10% of the transformation.

Darn. That's the major hassle with using doc-view and I thought having
async functionality would make it less painful.

 2. Cancel key: There should be a key binding to cancel the convert
 process and (optionally) view what has been generated so far.

 I've done that yesterday.  Get the current version.

Just did a git pull and it said I had the most up-to-date version
already. I didn't see anything in the source - maybe you haven't
checked it into your git repository yet?

 3. Page count: It would be useful to have a running update of how many
 pages have been converted so far in the minibuffer (or maybe the mode
 line so that the minibuffer isn't being continually updated and can be
 used for other commands).

 See my answer to point 1.

ok.

 4. Batch mode: It would be nice to have an option to kick off a batch
 background process to do the conversion. For big documents, it isn't
 really practical to wait till it's been converted.

 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.

 5. Dired key: It would be nice to have a defcustom value that would
 specify a dired map key that would call doc-view on a file (with a new
 doc-view function that doesn't prompt for the file name). This would
 make it easier to browse pdf files in dired.

 Good idea.  I'll add that.  Do you have a good suggestion what key could
 be used and is free?

How about b (for browse) or V (for View)?

 Did I mention that doc-view is way cool? :-)

 And think of how cool it will be in 5 or ten years when we all have
 64-core 50 GHz computers with 512 GB RAM!!!

At the moment, I would be happy to just replace my Powerbook with a
dual core computer with 4GB of RAM!

- Bill




___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-25 Thread Tim X
Bill Clementson [EMAIL PROTECTED] writes:


 5. Dired key: It would be nice to have a defcustom value that would
 specify a dired map key that would call doc-view on a file (with a new
 doc-view function that doesn't prompt for the file name). This would
 make it easier to browse pdf files in dired.

 Good idea.  I'll add that.  Do you have a good suggestion what key could
 be used and is free?

 How about b (for browse) or V (for View)?

I think 'b' is available. However, you may find it useful to do what I did
in my txutils.el package. I used defadvice around view-file (which is
bound to v in dired). So, now if I hit v on a pdf, ps, doc, ppt html etc
file, it converts the file to either text or html and then displays it in
a buffer (in the case of html output and .html files, it just uses
browse-url to display the rendered version).

What I like about this approach is that I now always use 'v' to view a
file and don't have to remember to hit a different key for different
filetypes. 

HTH

Tim


-- 
tcross (at) rapttech dot com dot au
___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-24 Thread Tassilo Horn
Xavier Maillard [EMAIL PROTECTED] writes:

Hi Xavier,

 I'll try to do that this evening.

Ok.  Today I made some major changes to make it more convenient to use,
because doc-view.el is going to be part of GNU Emacs in the near
future.  The current version is in my Git repository and a patch is sent
to emacs-devel. :-)

Bye,
Tassilo
-- 
The  desire  to  be  rewarded  for one's  creativity  does  not  justify
depriving  the world  in  general of  all  or part  of that  creativity.
(Richard M. Stallman)



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-24 Thread Bill Clementson
Hi Tassilo,

Tassilo Horn [EMAIL PROTECTED] writes:
 Ok.  Today I made some major changes to make it more convenient to use,
 because doc-view.el is going to be part of GNU Emacs in the near
 future.  The current version is in my Git repository and a patch is sent
 to emacs-devel. :-)

Ok, this is way cool. In fact, it was so cool that I mucked around all
afternoon trying to get git (ouch - bad pun) so that I could get the
latest version of doc-view!

Note for Mac users: save yourself a lot of pain and install
the Macports version of git - I tried:

(a) building from source (no worky)
(b) fink install (I already had fink installed but the git install 
failed)
(c) pre-built package at metastatic.org (no worky)
(d) Macports install (which required an install of Macports as I didn't 
have it on my Mac)

Only the Macports install worked on my Powerbook G4 (and that took
ages to build all the dependencies because Macports builds versions of
the dependencies that work with the package you're installing even if
you have non-Macports versions of the same progs installed and in your
path). Tassilo, please forgive me for all the names I called you this
afternoon for using git! ;-)

But, back to doc-view.el. Did I mention that it is way cool? :-)

There are a few ways that it could probably be made better though:

1. It is slow: It would probably be better to provide an async mode
option. In other words, instead of waiting for the convert process to
complete, let the user view the pages that have been generated and
periodically, have doc-view automatically update the
doc-view-current-files variable with the updated list of pages. In
async mode, some functionality wouldn't be available (for example,
M- would only go to the last page that had been generated and g
would only allow you to go to a page that had been generated);
however, since frequently the user will be reading the document from
Page 1, that shouldn't be a big problem. Also, having an async option
would provide a more immediate access to the document and the user
might decide to cancel (see #2 below) the remainder of the convert
process once a few pages have been viewed.

2. Cancel key: There should be a key binding to cancel the convert
process and (optionally) view what has been generated so far. 

3. Page count: It would be useful to have a running update of how many
pages have been converted so far in the minibuffer (or maybe the mode
line so that the minibuffer isn't being continually updated and can be
used for other commands).

4. Batch mode: It would be nice to have an option to kick off a batch
background process to do the conversion. For big documents, it isn't
really practical to wait till it's been converted.

5. Dired key: It would be nice to have a defcustom value that would
specify a dired map key that would call doc-view on a file (with a new
doc-view function that doesn't prompt for the file name). This would
make it easier to browse pdf files in dired.

Did I mention that doc-view is way cool? :-) 

- Bill



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-23 Thread Tassilo Horn
Xavier Maillard [EMAIL PROTECTED] writes:

Hi Xavier,

 I've started to write something down onto emacwiki[1]. It needs still
 some work to be usefull.

 [1] http://www.emacswiki.org/cgi-bin/wiki/DocViewMode

I've seen it and I left a comment.  If you want you can upload it to
emacswiki and keep it current.  (I don't do that because I'm laz... ah,
too busy!)

Bye,
Tassilo
-- 
Chuck Norris is not Politically Correct. He is just Correct. Always. 



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


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

2007-08-22 Thread Reiner Steib
[ 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/
___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources