emacs-wiki-discuss
[Top][All Lists]
Advanced

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

Re: [emacs-wiki-discuss] opening pdf documents


From: Ray Fix
Subject: Re: [emacs-wiki-discuss] opening pdf documents
Date: Mon, 6 Sep 2004 10:56:51 -0400

This thread goes way back but I finally figured something out about it so here is my report. ;-) When we last left our enthusiastic novice, he was having trouble with non-text links. For example:

[[/some/path/file.txt][Text File]]    Good
[[/some/path/file.png][PNG]]        Non-optimal
[[/some/path/file.pdf][PDF]]          Non-optimal

All of these files would open in text mode. Upgrading my version of Emacs fixed the PNG case. Now it inlines the picture. Yay! (Charles guess that my emacs was not compiled correctly was probably correct.)

However, I was still having problems with PDF files. (Again it would open them as a text file....)

My solution here was to use trivial mode as described on:

http://www.emacswiki.org/cgi-bin/wiki/TrivialMode

I am using MacOS X 10.3.5 so I hacked at the lisp a little to make it work for me better. (When it opened the file it injected the words "open process complete" into the original pdf buffer.)

(defun define-trivial-mode(mode-prefix file-regexp &optional command)
  (or command (setq command mode-prefix))
  (let ((mode-command (intern (concat mode-prefix "-mode"))))
    (fset mode-command
          `(lambda ()
             (interactive)
(start-process ,mode-prefix (get-buffer-create "*open-trivial-mode*")
                            ,command (buffer-file-name))
             (kill-buffer (get-buffer buffer-file-name))))
    (add-to-list 'auto-mode-alist (cons file-regexp mode-command))))

(define-trivial-mode "open" "\\.ps$")
(define-trivial-mode "open" "\\.pdf$")


Ray

On Apr 20, 2004, at 5:15 AM, Charles Phlip Chan wrote:

On 19 Apr 2004, address@hidden wrote:

hitting return opens the file in emacs as a text file.

Strange, are you using Emacs in console mode? Is your copy of Emacs
compiled with graphics support? The image should just be displayed
inline in the Emacs buffer.

Charles

--
We come to bury DOS, not to praise it.
(Paul Vojta, address@hidden, paraphrasing a quote of Shakespeare)
_______________________________________________
emacs-wiki-discuss mailing list
address@hidden
http://mail.nongnu.org/mailman/listinfo/emacs-wiki-discuss





reply via email to

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