[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: View PDF, PS within emacs
>>>>> In [emacs-w3m : No.10033] David Hansen wrote:
(B>> I guess we need a Lisp function that downloads the contents into a
(B>> local file and performs `find-file' on it if `auto-mode-alist'
(B>> contains the `doc-view-mode' element.
(B> Ah, OK, I naively thought we just put the file content in a buffer and
(B> then run the `doc-view-mode' command, but it seems that doc-view
(B> requires an existing file.
(BIt might be better to implement `doc-view-buffer' in the Emacs
(Btrunk first. ;-)
(B>> But it might be somewhat troublesome to make emacs-w3m work for a Lisp
(B>> function (not an external command) which is specified in
(B> I think there already is one entry that calls a lisp function (one of
(B> the browse-url functions for `w3m-view-url-with-external-browser').
(BI see. But the functions in `w3m-content-type-alist' might not
(Bbe for the internal display. Instead, now I think modifying
(B`w3m-goto-url' (as well as it handles ftp, local files, etc.) is
(Breasonable. Tsuchiya-san might dislike it, though.
(BI tried a quick hack. It works, however it has to be much improved.
--- w3m.el~ 2008-02-20 08:08:23 +0000
(B+++ w3m.el 2008-02-26 10:59:17 +0000
(B@@ -8246,6 +8246,30 @@
(B (string-match "\\`ftps?://" url)
(B (not (string= "text/html" (w3m-local-content-type url))))
(B (w3m-goto-ftp-url url))
(B+ ;; use `doc-view-mode'
(B+ ((let ((suffix (car (rassq 'doc-view-mode auto-mode-alist)))
(B+ ;!!! This section should work asynchronously.
(B+ ;!!! This variable should be implemented as a user option.
(B+ ;; w3m-use-doc-view-mode
(B+ (string-match suffix url)
(B+ (setq temp-file
(B+ (concat (make-temp-name
(B+ (expand-file-name "w3mel" w3m-profile-directory))
(B+ (match-string 0 url))))
(B+ (find-file temp-file)
(B+ (while (and doc-view-current-converter-process
(B+ (memq (process-status doc-view-current-converter-process)
(B+ '(open run)))
(B+ (sleep-for 0.1))
(B+ (delete-file temp-file)
(B ;; find-file directly
(B ((condition-case nil
(B (and (w3m-url-local-p url)