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

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

bug#5102: 23.1; doc-view on a buffer not linked to a file


From: Stefan Monnier
Subject: bug#5102: 23.1; doc-view on a buffer not linked to a file
Date: Sun, 06 Dec 2009 21:38:40 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

>>> No, it cannot handle non-file buffers, because ghostscript and friends
>>> only handle input files and don't support piping in the output.  So the
>> It already has special code for Tramp and jka-compr files, where it
>> saves the buffer's content to a temp file.
>> Harven(?), does the patch below help?
> Mails to Harven bounce back with the error:
>   <address@hidden>: host mx1.free.fr said: 550 5.2.1 This mailbox
>     has been blocked due to inactivity (in reply to RCPT TO command)
> So I tried out your patch and it fails with:
>   Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>     file-name-nondirectory(nil)
>     doc-view-mode()
>     doc-view-toggle-display()
>     call-interactively(doc-view-toggle-display nil nil)
> I don't understand how do you expect it to work.

Witha bit more help.  I've installed the patch below which seems to work
for me,


        Stefan


--- doc-view.el.~1.93.~ 2009-11-30 22:13:35.000000000 -0500
+++ doc-view.el 2009-12-06 21:35:39.000000000 -0500
@@ -563,7 +563,7 @@
     (setq doc-view-current-cache-dir
          (file-name-as-directory
           (expand-file-name
-           (concat (file-name-nondirectory buffer-file-name)
+           (concat (file-name-nondirectory doc-view-buffer-file-name)
                    "-"
                    (let ((file doc-view-buffer-file-name))
                      (with-temp-buffer
@@ -1228,6 +1228,7 @@
     (set (make-local-variable 'doc-view-buffer-file-name)
         (cond
          (jka-compr-really-do-compress
+           ;; FIXME: there's a risk of name conflicts here.
           (expand-file-name
            (file-name-nondirectory
             (file-name-sans-extension buffer-file-name))
@@ -1237,9 +1238,12 @@
          ;; supposed to return nil for things like local files accessed via
          ;; `su' or via file://...
          ((let ((file-name-handler-alist nil))
-            (not (file-readable-p buffer-file-name)))
+            (not (and buffer-file-name (file-readable-p buffer-file-name))))
+           ;; FIXME: there's a risk of name conflicts here.
           (expand-file-name
+           (if buffer-file-name
            (file-name-nondirectory buffer-file-name)
+              (buffer-name))
            doc-view-cache-directory))
          (t buffer-file-name)))
     (when (not (string= doc-view-buffer-file-name buffer-file-name))





reply via email to

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