blog/content/post/2009-10-17-00001242.md

38 lines
2.3 KiB
Markdown

---
title: モード単位で anything のソースを指定する
author: kazu634
date: 2009-10-17
url: /2009/10/17/_1355/
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:4843;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}'
categories:
- Emacs
---
<div class="section">
<p>
モードが起動したら実行される「 nnn-mode-hook 」というのがあるから、それに無名関数を入れるといいらしい。そのバッファーだけ、 anything-sources を個別に指定する。こんな感じ:
</p>
<pre class="syntax-highlight">
<span class="synComment">;; はてなモード用の設定</span>
<span class="synSpecial">(</span>add-hook <span class="synSpecial">'</span><span class="synIdentifier">hatena-mode-hook</span>
<span class="synSpecial">(</span><span class="synStatement">lambda</span> <span class="synSpecial">()</span>
<span class="synSpecial">(</span><span class="synStatement">when</span> <span class="synSpecial">(</span><span class="synStatement">require</span> <span class="synSpecial">'</span><span class="synIdentifier">anything</span> <span class="synStatement">nil</span> <span class="synStatement">t</span><span class="synSpecial">)</span>
<span class="synSpecial">(</span>make-variable-buffer-local <span class="synSpecial">'</span><span class="synIdentifier">anything-sources</span><span class="synSpecial">)</span>
<span class="synSpecial">(</span><span class="synStatement">setq</span> anything-sources
<span class="synComment">;; ここで source をリストアップする</span>
<span class="synSpecial">(</span><span class="synStatement">list</span> anything-c-source-yasnippet
anything-c-source-flickr
anything-c-source-files-in-current-dir<span class="synSpecial">)))))</span>
</pre>
<p>
<center>
</center>
</p>
<p>
<a href="http://flickr.com/photos/42332031@N02/4019489058/" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://flickr.com/photos/42332031@N02/4019489058/', '');" title="Anythingの設定(hatena-mode)"><img src="http://farm4.static.flickr.com/3517/4019489058_2df9d0207b.jpg" /></a>
</p></p>
</div>