blog/content/post/2008/01/18/2008-01-18-00000754.md

49 lines
3.2 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: CPerl mode用のsnippet.elの設定
author: kazu634
date: 2008-01-18
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:3627;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}'
categories:
- Emacs
- Perl
---
<div class="section">
<p>
 とりあえずifとforeachだけ付け加えてみた。
</p>
<pre class="syntax-highlight">
<span class="synComment">;; === snippet ===</span>
<span class="synComment">;; snippet.el で、addrev に定型文を追加する</span>
<span class="synComment">;; 設定方法の例</span>
<span class="synComment">;; (add-hook 'sgml-mode-hook</span>
<span class="synComment">;; '(lambda ()</span>
<span class="synComment">;; (setq-default abbrev-mode t) ;; abbrev-mode をon</span>
<span class="synComment">;; (snippet-with-abbrev-table '任意のmode-abbrev-table </span>
<span class="synComment">;; (&#34;略称の文字列1&#34; . &#34;展開する文字列1&#34;)</span>
<span class="synComment">;; ))</span>
<span class="synComment">;; )</span>
<span class="synComment">;; 参考:</span>
<span class="synComment">;; emacs + snippet.el の定型文補完スニペットで楽々HTML編集Goodpic</span>
<span class="synComment">;; http://www.goodpic.com/mt/archives2/2007/02/emacs_snippetel_html.html</span>
<span class="synComment">;; unknownplace.org - Tags: emacs</span>
<span class="synComment">;; http://unknownplace.org/memo/tag/emacs</span>
<span class="synComment">;; 展開文字列の設定</span>
<span class="synComment">;; $${} ;; タブキーで移動可能な入力エリア</span>
<span class="synComment">;; $. ;; タブ入力を終了した後の、カーソルの位置</span>
<span class="synComment">;; $&#62; ;; その行をインデントする</span>
<span class="synSpecial">(</span><span class="synStatement">require</span> <span class="synSpecial">'</span><span class="synIdentifier">snippet</span><span class="synSpecial">)</span>
<span class="synComment">;; cperl mode</span>
<span class="synSpecial">(</span>add-hook <span class="synSpecial">'</span><span class="synIdentifier">cperl-mode-hook</span>
<span class="synSpecial">'(</span><span class="synStatement">lambda</span> <span class="synSpecial">()</span>
<span class="synSpecial">(</span>setq-default abbrev-mode <span class="synStatement">t</span><span class="synSpecial">)</span> <span class="synComment">;; abbrev-mode をon</span>
<span class="synSpecial">(</span>snippet-with-abbrev-table 'cperl-mode-abbrev-table
<span class="synSpecial">(</span><span class="synConstant">&#34;if&#34;</span> . <span class="synConstant">&#34;if ($${arg}) {\n$&#62;$.\n}&#34;</span><span class="synSpecial">)</span>
<span class="synSpecial">(</span><span class="synConstant">&#34;foreach&#34;</span> . <span class="synConstant">&#34;foreach ($${arg}) {\n$&#62;$.\n}&#34;</span><span class="synSpecial">)</span>
<span class="synSpecial">))</span>
<span class="synSpecial">)</span>
</pre>
</div>