gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Tassilo Horn
Subject: Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs
Date: Thu, 23 Aug 2007 09:56:12 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

Reiner Steib <address@hidden> writes:

Hi Reiner,

>> (defcustom doc-view-cache-directory "/tmp/doc-view"
>
> Maybe use `temporary-file-directory' or `make-temp-name'.

I use the former now.

>> (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".

Winwhat?!? ;-)

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

Yes, now I do a bit as the package formely known as `tumme'.

--8<---------------cut here---------------start------------->8---
(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 (file-name-as-directory doc-view-cache-directory)
          (file-name-nondirectory file) "-"
          (md5 file)))
--8<---------------cut here---------------end--------------->8---


> ,----[ (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'.
> `----

I'll try to memorize it.

Thanks for the pointers,
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)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]