开发者

Contextual help in Emacs?

开发者 https://www.devze.com 2023-01-25 06:59 出处:网络
I am not a very good at using Emacs, but the feature I would like the most would be some integration with help/documentation for a particular language/API I use at the moment. I would imagine that the

I am not a very good at using Emacs, but the feature I would like the most would be some integration with help/documentation for a particular language/API I use at the moment. I would imagine that there would be help displayed in another buffer depending on where I put my cursor while editing.

I wonder if there is a package that does that, even if it would be very simple, just displaying some file based on the keyword. I think there is, but I cannot find it ("help" is a too generic word).

(In particular, I would like to have this help for Common Lisp, but other langu开发者_如何转开发ages, such as Java or C, could be useful.)


ILISP and SLIME provide several methods for looking up a function; see the Emacs wiki and the SLIME documentation. Or just built into Emacs itself, there are functions like C-h f to get function help or M-x man; both use the text at the point by default. You could pretty easily adapt them to work for another language of your choice.


Assuming you are using SLIME for common-lisp, you can take a look at slime-autodoc-mode.

Sorry, can't help with a generic solution for this.


You can set up the CLHS root for SLIME in your .emacs file:

(setq common-lisp-hyperspec-root "/usr/share/doc/hyperspec/HyperSpec/")

Adjust the path to where you put your HyperSpec.

Then, C-c C-d h with point at a symbol will look it up there in your browser.


One thing you might like to enable is eldoc-mode, by adding (turn-on-eldoc-mode) to your mode hook functions for the appropriate programming modes.

In ElDoc mode, the echo area displays information about a
function or variable in the text where point is.  If point is
on a documented variable, it displays the first line of that
variable's doc string.  Otherwise it displays the argument list
of the function called in the expression point is on.

This is probably less than you were after, but it still makes a good companion to a fuller-featured contextual help system, and there are a number of programming modes that support it.

0

精彩评论

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

关注公众号