blog/content/post/2007/09/01/2007-09-01-00000600.md

72 lines
4.4 KiB
Markdown
Raw Normal View History

2019-03-31 11:00:21 +00:00
---
title: Doc-Viewモード
author: kazu634
date: 2007-09-01
wordtwit_post_info:
- 'O:8:"stdClass":13:{s:6:"manual";b:0;s:11:"tweet_times";i:1;s:5:"delay";i:0;s:7:"enabled";i:1;s:10:"separation";s:2:"60";s:7:"version";s:3:"3.7";s:14:"tweet_template";b:0;s:6:"status";i:2;s:6:"result";a:0:{}s:13:"tweet_counter";i:2;s:13:"tweet_log_ids";a:1:{i:0;i:3205;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}'
categories:
- Emacs
---
<div class="section">
<p>
 Emacsを使い始めて、段々とその便利さがわかってきた。現在はLaTeXで修論を書いているのですが、LaTeXの打ち込みとコンパイルまでを一括して処理してくれています。
</p>
<p>
 そんな感じで便利さを体感していると、なんと<a href="http://www.tsdh.de/cgi-bin/wiki.pl/doc-view.el" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.tsdh.de/cgi-bin/wiki.pl/doc-view.el', 'EmacsでPDFを閲覧できる');" target="blank">EmacsでPDFを閲覧できる</a>ことを知りました。使ってみると、Windowsでは使えない文字で作業用ファイルを書き込もうとしていて、PDFが閲覧できませんでした(..;)どうにかならんのかと検索していたら、すでに他の人も作者の人に指摘済みでした(→<a href="http://www.mail-archive.com/gnu-emacs-sources@gnu.org/msg01114.html" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.mail-archive.com/gnu-emacs-sources@gnu.org/msg01114.html', 'doc-view.el &#8212; View PDF/PostStript/DVI files in Emacs');" target="blank">doc-view.el &#8212; View PDF/PostStript/DVI files in Emacs</a>:
</p>
<blockquote>
<p>
[ Crosspost & Followup-To: gnu.emacs.help ]
</p>
<p>
On Wed, Aug 22 2007, Tassilo Horn wrote:
</p>
<p>
> (defcustom doc-view-cache-directory &#8220;/tmp/doc-view&#8221;
</p>
<p>
Maybe use `temporary-file-directory&#8217; or `make-temp-name&#8217;.
</p>
<p>
>&#160;&#160; &#8220;The base directory, where the PNG imoges will be saved.&#8221;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; images
</p>
<p>
> (defun doc-view-file-name-to-directory-name (file)<br />>&#160;&#160; &#8220;Return the directory where the png files of FILE should be saved.<br />><br />> It&#8217;a a subdirectory of `doc-view-cache-directory&#8217;.&#8221;<br />>&#160;&#160; (concat (directory-file-name doc-view-cache-directory)<br />>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8220;/&#8221;<br />>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; (replace-regexp-in-string &#8220;/&#8221; &#8220;!&#8221; file)))
</p>
<p>
Probably not portable, I think.&#160; Windows users may set the directory<br />to &#8220;c: ooar&#8221;.&#160; Maybe you could do like the package formerly knows<br />as `tumme.el&#8217; does it.&#160; Ah, it&#8217;s `image-dired.el&#8217; now:<br />`image-dired-thumb-name&#8217;.
</p>
<p>
> (defun doc-view-convert-file (file)<br />[&#8230;]<br />>&#160;&#160; (let* <span class="footnote"><a href="/sirocco634/#f1" name="fn1" title="dir (doc-view-file-name-to-directory-name file">*1</a></span><br />>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; (png-file (concat dir &#8220;/&#8221; &#8220;page.png&#8221;)))
</p>
<p>
,&#8212;-[ (info &#8220;(elisp)Directory Names&#8221;) ]<br />|&#160;&#160;&#160; If you want to use a directory file name in making such a<br />| combination, you must first convert it to a directory name using<br />| `file-name-as-directory&#8217;:<br />| <br />|&#160;&#160;&#160;&#160;&#160; (concat (file-name-as-directory DIRFILE) RELFILE)<br />| <br />| Don&#8217;t try concatenating a slash by hand, as in<br />| <br />|&#160;&#160;&#160;&#160;&#160; ;;; Wrong!<br />|&#160;&#160;&#160;&#160;&#160; (concat DIRFILE &#8220;/&#8221; RELFILE)<br />| <br />| because this is not portable.&#160; Always use `file-name-as-directory&#8217;.<br />`&#8212;-
</p>
<p>
Bye, Reiner.
</p>
</blockquote>
<p>
 というわけで、もう一度elispを導入してみようと思う。
</p>
</div>
<div class="footnote">
<p class="footnote">
<a href="/sirocco634/#fn1" name="f1">*1</a>dir (doc-view-file-name-to-directory-name file
</p>
</div>