Comments for Function in Emacs

只谈情不闲聊 提交于 2019-12-12 18:07:53

问题


I'm looking for a way to generate and insert header comment blocks above my functions in Emacs (in any mode), with the default contents of the comment automatically based on the function's signature (i.e. the correct number of @param place-holders).

Doxymacs is a nice candidate. But I prefer another way works without the necessary libs. Can anyone recommend some others ways for adding smart comments for functions in Emacs? Thanks.

Edit: Now I found this: http://nschum.de/src/emacs/doc-mode/, but it seems that it does not work well after I require it into my .emacs and add hook for js-mode. Doesn't it support js functions ?


回答1:


I don't know of any general-purpose approach.

Csharp-mode has a defun that is bound to / , which tries to generate comments appropriate for C#. The way it works: Every time you type a slash, it looks to see if it is the third slash in a row. (In C#, three slashes are used to denote comments that produce documentation). If it is the third slash, then it looks at the surrounding text and inserts a comment skeleton or fragment that is appropriate.

It is not generalized in any way to support javascript or other language syntaxes. But you might be able to build what you want, if you start with that.

here's the excerpt:

http://pastebin.com/ATCustgi




回答2:


I've used doxymacs in the past and I've found it useful http://doxymacs.sourceforge.net/



来源:https://stackoverflow.com/questions/9872445/comments-for-function-in-emacs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!