开发者

emacs key binding

开发者 https://www.devze.com 2023-04-12 19:59 出处:网络
I\'m new to emacs so I need simple tip. I\'d like to use Command-RET to eval last expression - to do this:

I'm new to emacs so I need simple tip. I'd like to use Command-RET to eval last expression - to do this:

clojure-mode.el:

(define-key map "\C-x\C-e" 'lisp-eval-last-sexp)

And I don't want to change original clojure-mode.el file. How can I define key binding that will execute C-x\C-e and that will call 'lisp-eval-last-sexp? It would be great solution for me, because I can't bind Command-RET directly with:

local-set-key

to 'lisp-eval-last-sexp, emacs can't find this function.

thanks in advance, Bartek

Update:

finally it turned out that I needed to write:

M-x
describe-key
^X ^E

and it returned me:

^X ^E runs the command slime-eval-last-expression, which is an
interactive Lisp function in `slime.el'.

It is bound to ^X ^E, <menu-bar> <SLIME> <Evaluation> <Eval Last
Expression>, <A-ret开发者_JS百科urn>.

(slime-eval-last-expression)

Evaluate the expression preceding point.

[back]

and then I bound my keys to function

'slime-eval-last-expression

thanks for your help :)


You can rebind keys in your .emacs file you don't need to change clojure-mode.el,

(add-hook 'clojure-mode-hook
                '(lambda ()
                   (define-key clojure-mode-map 
                     "\e\C-x" 'lisp-eval-defun)))


I believe you want to set it to eval-print-last-sexp instead. That is what C-j is bound to.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号