Emacs Lisp Function Guide?

前端 未结 12 2276
清歌不尽
清歌不尽 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条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-30 12:18

    Have you tried the build-in manual in emacs? Open any lisp buffer (or any buffer in lisp mode), move your point to any function or variable, and hit C-h f (for function) or C-h v (for variable). Emacs will give you a fairly concise description of the function/variable.

    For example, the manual content for (save-excursion) is

    save-excursion is a special form in `C source code'.
    (save-excursion &rest BODY)
    
    Save point, mark, and current buffer; execute BODY; restore those things.
    Executes BODY just like `progn'.
    The values of point, mark and the current buffer are restored
    even in case of abnormal exit (throw or error).
    The state of activation of the mark is also restored.
    
    This construct does not save `deactivate-mark', and therefore
    functions that change the buffer will still cause deactivation
    of the mark at the end of the command.  To prevent that, bind
    `deactivate-mark' with `let'.
    

    The good thing also is the build-in manual give you "link" to to the source code of the function and to other functions that might be related, which make it nice to browse around.

    Of course you can't learn lisp this way, but for looking up documentation of function this is a nice starter. When you find the build-in manual not understandable (which sometimes does happen), then it's time for you to google the function ;)

提交回复
热议问题