auto-complete source for Rust
Repository
https://github.com/syohex/emacs-ac-racer
How to use
- Install rust(https://www.rust-lang.org/install.html)
- Install racer(https://github.com/phildawes/racer)
(defun my/racer-mode-hook () (ac-racer-setup)) (add-hook 'racer-mode-hook 'my/racer-mode-hook) (custom-set-variables '(racer-cmd (expand-file-name "~/src/racer/target/release/racer")) '(racer-rust-src-path (expand-file-name "~/src/rustc/src")))
You must set racer-cmd
and racer-rust-src-path
. (racer-cmd
is path of racer
command. racer-rust-src-path
is path of rustc source code)
Summary
ac-racer is alpha quality. Please report me via github issues or twitter if you have any suggestions or issues.
Text::Xslate 3.3.6 released
https://metacpan.org/release/SYOHEX/Text-Xslate-3.3.6
I released Text::Xslate 3.3.6. This version fixed include
issue.
Include Issue
Perl VM stack pointer goes wrong by each include
call. For example.
#!perl use strict; use warnings; use Text::Xslate; my $tx = Text::Xslate->new( path => { 'body.tx' => ': block body | reverse -> { include text }', 'text.tx' => 'foo', }, function => { reverse => sub { scalar reverse $_[0] }, }, ); print $tx->render('body.tx');
reverse
function takes foo
as first argument but it is undefined value.
% perl test.pl Text::Xslate: Use of uninitialized value $_[0] in reverse at test.pl line 12. (<string>:1) at test.pl line 12. main::__ANON__(undef, foo) called at test.pl line 16 eval {...} called at test.pl line 1
Why this behavior ? Because foo
is 2nd argument. Following code works well.
#!perl use strict; use warnings; use Text::Xslate; my $tx = Text::Xslate->new( path => { 'body.tx' => ': block body | reverse -> { include text }', 'text.tx' => 'foo', }, function => { reverse => sub { scalar reverse $_[1] }, }, ); print $tx->render('body.tx');
oof
is printed. If include
is called two times, foobar
is 3rd argument. 1st and 2nd arguments are undef
.
#!perl use strict; use warnings; use Text::Xslate; my $tx = Text::Xslate->new( path => { 'body.tx' => ': block body | reverse -> { include text; include text2 }', 'text.tx' => 'foo', 'text2.tx' => 'bar', }, function => { reverse => sub { scalar reverse $_[2] }, }, ); print $tx->render('body.tx');
Conclusion
I released Text::Xslate 3.3.6. Please report us via github issues if you have any problems.
auto-complete source for Emoji
I uploaded ac-emoji to github. This package provides auto-complete source of Emoji.
Image
Repository
https://github.com/syohex/emacs-ac-emoji
I test only MacOSX.
Sample configuration
I think this package is useful for writing Markdown or git commit message.
(add-hook 'markdown-mode-hook 'ac-emoji-setup) (add-hook 'git-commit-mode-hook 'ac-emoji-setup)
MacOSX Users
Please add emoji font configuration to your init.el. This configuration is not necessary if you use emacs with no window mode(-nw
).
(set-fontset-font t 'symbol (font-spec :family "Apple Color Emoji") nil 'prepend)
Summary
I released ac-emoji
which is auto-complete source of emoji. I plan to request this package to MELPA. If you have any suggestions or problems, please report me via github issue.
Open write mode for flock(fh, LOCK_EX) for portability
We should open file with write intent for using flock(fh, LOCK_EX
) for portability. Because flock(fh, LOCK_EX)
is failed without write intent on some platforms(such as Solaris) and platforms which does not provide flock
. (In this case Perl emulates flock
with other API).
On Linux or some BSD(include MacOSX), flock(fh, LOCK_EX)
successes without write intent. However if you want to work your module on many platforms, you should open with write intent.
perldoc -f flock
says
Note that the fcntl(2) emulation of flock(3) requires that FILEHANDLE be open with read intent to use LOCK_SH and requires that it be open with write intent to use LOCK_EX.
See also
Macで flyspell-modeを使うための設定
スペルチェックはもっぱら flyspell-mode, flyspell-bufferなので, Macでもそれを使うための設定.
ispellのインストール
% brew install ispell
昔は ~/.aspell.conf
の設定が必須だったような気がするのだが, なくても動作した. デフォルトの言語を設定を英語にしているということが関係しているのか, そもそも不要になったのかはよくわかっていない.
faceの設定
GUIだとデフォルトが波線ですごく見づらい. emacs -nw
なら真っ直ぐな下線なのでよいのだが... 見やすければなんでもいいので以下のような設定にしてみた.
(set-face-attribute 'flyspell-duplicate nil :foreground "white" :background "orange" :box t :underline nil) (set-face-attribute 'flyspell-incorrect nil :foreground "white" :background "red" :box t :underline nil)
こんな感じになります.
Tips
ドキュメントを書くときは, flyspell-modeを有効にしているだけですが, まとめてチェックしたい場合は以下のように設定して開くファイルすべてに対してスペルチェックをかけるというようなことをしています.
(add-hook 'find-file-hook 'flyspell-mode) (add-hook 'find-file-hook 'flyspell-buffer)
auto-complete for Elixir programming
I recommend you to use company-mode for auto completion of Elixir programming.
I created ac-alchemist which is auto-complete source of alchemist. Because alchemist provides only company-mode completion.
alchemist often changes its API frequently. So it may break ac-alchemist. Please report me if ac-alchemist does not work with latest alchemist via github issues.
Repository
https://github.com/syohex/emacs-ac-alchemist