Emacs Lisp Function Guide?

前端 未结 12 2318
清歌不尽
清歌不尽 2021-01-30 12:13

I have been using Emacs for more than three years now but it still takes me days to write even small functions in Lisp. I\'ve looked through GNU Emacs Lisp Reference Manual but

12条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-30 12:24

    I would add a couple of things:

    • M-x apropos - searches functions and variables for whatever string you specify (e.g. directory). Note that this is slightly different than C-h a, which only finds interactive functions

    • find a similar piece of code and copy it - you can learn an awful lot about how to do things by looking at what's already done. If you have a particular function you want to see examples of, one good way is to visit the main lisp source directory in dired (e.g. d:/product/emacs/lisp or /usr/share/lib/emacs/lisp) and do % g which will grep through all files looking for whatever string you type. Open up that file and see what other people have done with it.

    • C-h f and C-h v - as someone else mentioned, you can open up source, position point over a function or variable and then get documentation on it.

    • Check out the Emacs wiki, which has a crap-load of Emacs lisp modules for you to peruse.

提交回复
热议问题