89 lines
2.4 KiB
Markdown
89 lines
2.4 KiB
Markdown
|
# 201812091402 slimeを動かしているとddskkの変換がうまくいかない
|
|||
|
|
|||
|
#slime #emacs #lisp
|
|||
|
|
|||
|
|
|||
|
slimeの設定はこんな風にした。
|
|||
|
|
|||
|
```lisp
|
|||
|
(require 'slime)
|
|||
|
(setq inferior-lisp-program "sbcl")
|
|||
|
(slime-setup '(slime-repl slime-fancy slime-banner slime-company))
|
|||
|
(add-hook 'lisp-mode-hook 'smartparens-mode)
|
|||
|
(add-hook 'lisp-mode-hook
|
|||
|
(lambda ()
|
|||
|
(set (make-local-variable lisp-indent-function)
|
|||
|
'common-lisp-indent-function)))
|
|||
|
(add-to-list 'auto-mode-alist '("\\.lisp\\'" . lisp-mode))
|
|||
|
```
|
|||
|
|
|||
|
それで .lispファイルを開くと、漢字変換ができなくなる。
|
|||
|
M-x describe-key で スペース押すとこんな結果。
|
|||
|
|
|||
|
```
|
|||
|
SPC runs the command slime-autodoc-space (found in
|
|||
|
slime-autodoc-mode-map), which is an interactive compiled Lisp
|
|||
|
function in ‘slime-autodoc.el’.
|
|||
|
|
|||
|
It is bound to SPC.
|
|||
|
|
|||
|
(slime-autodoc-space N)
|
|||
|
|
|||
|
Like ‘slime-space’ but nicer.
|
|||
|
```
|
|||
|
|
|||
|
ということだったので、
|
|||
|
|
|||
|
```lisp
|
|||
|
(define-key slime-autodoc-mode-map " " nil)
|
|||
|
```
|
|||
|
|
|||
|
を追加。
|
|||
|
|
|||
|
まだだめで、この状態で M-x describe-key で スペース押すとこんな結果。
|
|||
|
|
|||
|
```lisp
|
|||
|
SPC runs the command slime-space (found in slime-mode-indirect-map),
|
|||
|
which is an interactive compiled Lisp function in ‘slime.el’.
|
|||
|
|
|||
|
It is bound to SPC.
|
|||
|
|
|||
|
(slime-space N)
|
|||
|
|
|||
|
Insert a space and print some relevant information (function arglist).
|
|||
|
Designed to be bound to the SPC key. Prefix argument can be used to insert
|
|||
|
more than one space.
|
|||
|
```
|
|||
|
|
|||
|
じゃあ、ということで
|
|||
|
|
|||
|
```lisp
|
|||
|
(define-key slime-mode-map " " nil)
|
|||
|
```
|
|||
|
|
|||
|
|
|||
|
を追加。
|
|||
|
|
|||
|
・・・で日本語が打てるようになったが、この2つもddskk利用時以外は使いたい。
|
|||
|
とすると日本語変換以外の時は上記の関数を呼びたい。
|
|||
|
<https://gist.github.com/hiyosi/1325989/cea57a115897ac6c3a2f3d0c4082e380b6b30bf7>
|
|||
|
この方のやつなどを参考にしてこうしてみた。
|
|||
|
|
|||
|
```lisp
|
|||
|
(define-key slime-autodoc-mode-map " " nil) ; 下のadd-hookで上書きされるので不要
|
|||
|
(define-key slime-mode-map " " nil)
|
|||
|
```
|
|||
|
|
|||
|
```lisp
|
|||
|
;; ddskkが変換中は変換を優先する@slime
|
|||
|
(defun slime-space/skk (n)
|
|||
|
(interactive "p")
|
|||
|
(if (and (boundp 'skk-henkan-mode) skk-henkan-mode)
|
|||
|
(skk-insert n)
|
|||
|
(slime-autodoc-space n)))
|
|||
|
|
|||
|
(add-hook 'slime-autodoc-mode-hook
|
|||
|
(lambda ()
|
|||
|
(define-key slime-autodoc-mode-map " " 'slime-space/skk)))
|
|||
|
```
|