Suppose I want to install a new package. To do this I need to remember that M-x package-install RET package-name is the sequence of keystrokes to type into emacs to do this.
If I forget this keystroke, my go to solution is to google the action I want to complete and browse through the results until I find the right command.
I suspect there is a better way to look up emacs commands and what they do though. If so, can anybody point me to it?
Thanks!
The number one goto command for this would be the apropos-command, which is invoked by using C-h a (or M-x apropos-command), and then typing a search query for the command.
If you know the name of a function, you can use C-h f which runs the describe-function command to get more details about the command.
Lastly, if you know the key sequence, and want more details regarding the command you run, you can use C-h k - describe-key to have emacs tell you what command and the documentation for that command when typing a sequence of keys.
You can get a more complete list of help commands by typing C-h ?.
The built-in manuals are the other obvious places to look, and you can search each one using its index, or isearch through the full-text of the manual.
https://stackoverflow.com/a/22380057/324105
If you use Icicles then the equivalent of apropos-command is built into every command that reads a command name, and you can change the pattern on the fly to tweak the set of matches. See apropos completion.
Whereas with apropos-command you need to provide at the outset the regexp or the complete list of keywords to match (and you need to get them right), with Icicles you can modify/correct them incrementally, and you can add more patterns progressively (progressive completion).
And when you have a set of matches for your pattern(s), you can see the complete doc for each on demand, as opposed to searching the output from apropos-command (which only shows partial doc anyway).
In addition, Icicles extends the standard apropos commands in various ways.
Related
My Current Workflow
I need to use 'doseq'
I don't remember it's args.
I go to clojuredocs , lookup 'doseq', and look at the examples.
My Ideal Setup
Inside emacs, I type some magic key combo, I type in doseq,
and it EXTRACTS EXAMPLES FROM A LOCAL MIRROR OF CLOJUREDOCS
and presents it inside my emacs browser.
What I found via Google:
https://www.reddit.com/r/emacs/comments/450x84/a_clojuredocsorg_for_emacs/
Basically other people also want this.
My Question:
Is there anyway to do this in emacs?
Thanks!
I use cider-grimoire. In Spacemacs, I just type the leader key, followed by hg. Behind the scene, cider will perform a search on conj.io and return the result in another Emacs buffer.
Late to the party, but here it is:
https://github.com/mbuczko/helm-clojuredocs
It is helm-based solution which redirects to the clojuredocs.org displaying documentation of given search phrase (if found). Most useful when used with helm-clojuredocs-at-point function which simply searches for phrase under the cursor.
If you use cider, C-c C-d C-d on a var will show you the docstring for that var. Not exactly what you're describing but for many use-cases the docstring is enough to figure out the arguments to a function.
cider will also show the arguments to the current function (under cursor) in the echo area.
I would like to, after switching to the buffer where I usually run commands, navigate the history by searching it, rather than navigate one-command-at-a-time at the end of the buffer (e.g. C-p).
Basically I would like to "Reverse I-search" the command history at the end of the buffer, rather than search the buffer.
Did anyone code a working solution? Note that I noticed there is a Command History buffer available, but here it is just a bunch of text and it is not grouped well enough I think to use.
As in a terminal, you can use M-r to search backward. It works in comint-mode, but it also work elsewhere, like in M-x (M-xM-rpatternRET).
Yes, with Icicles.
In Icicle mode, command icicle-comint-search is bound to C-c ` in shell buffers. It gives you the behavior you are looking for. It is described here.
It uses only stuff that is in the currently visible history as candidates, however. If you want to access stuff from your history from previous sessions then use command comint-input-ring, bound to C-c TAB, instead. (This is explained in the same doc.)
I am using emacs and the auto-newline feature is not working as expected. I have a pretty large number of customizations done to my emacs. So it would be no wonder if one of the other customizations is not what auto-line is expecting. I would like to know if there is a way to know the list of commands (list of emacs commands) executed by emacs at a particular point, for e.g. when ctrl-s ctrl-c or in my case when auto-line feature is called.
edit : I think you have misunderstood the question. I would like to know what command emacs calls 'internally'.
I believe view-lossage is what you're looking for -- M-x view-lossage, or C-h l.
If you want to know what a keystroke is bound to, consider using describe-key, which is usually bound to C-h k.
Basically at this point, you need to bite the bullet and learn some Emacs-lisp. The debugger is what you are looking for to dig further into your problem (I use edebug). It's not just about seeing what functions get called, you also need to see the values of the relevant variables when those functions are called.
If you feel you're not up to it, then you can bi-sect your init file until you find the culprit, but at that point you still need some Emacs-lisp to investigate further.
To add to what #event_jr said --
What you seem to be asking is the history of the functions called by the command you last invoked. (You speak of Emacs "internal commands", but it seems you just mean functions.)
To get that history for any given command you invoke (e.g., by a key), use M-x debug-on-entry and then enter the command name. The next time you use that command, you can walk through its execution in the Emacs debugger (hit d to step, c to continue past a step).
I am working in Emacs 23, editing LaTeX via AUCTeX. I noticed in emacs that when I press C-c }, I receive the minibuffer message
Scan error: "Unbalanced parentheses", 16026, 16440
Question 1. What exactly is this command doing?
Question(s) 2. More generally, how can I determine what I a given macro is doing? Is there, for example, a universal command that request the keyboard shortcut as an input and outputs a description of the command to which that shortcut is bound? Is there a list of all active keyboard shortcuts?
Question 3. How can I find my unmatched parentheses? The post here recommends the command M-x check-parens, but it availed me nothing, not even a minibuffer message.
The answer to 1 and 2 is to do C-h k C-c } and see what the help buffer tells you. This is one of the features that allows us to call Emacs a self-documenting editor. Don't forget that you can follow the links in the help buffer to both the source code where this function is implemented and to other documentation.
You may also want to use C-h m to see all the key bindings added by the major and minor modes that are currently enabled and C-h ? to see what other interesting help functions there are.
I've never used check-parens specifically, but it does work in my current buffer, which is javascript. I see from its documentation (C-h f check-parens) that it relies on the current syntax table, so perhaps for TeX the syntax table doesn't contain enough information for check-syntax to find the error.
I'd like to quickly move point to a function in my Emacs buffer. I'd like to run some function and get a prompt asking me for the function name, with completion provided for every function defined in the current buffer.
I generally use etags to navigate around, but sometimes I'm looking for a framework method that's been overridden in several files. In these cases, I can find the file I need but then I'd like to quickly jump to the function there. There is a similar feature in TextMate where you can select a definition from a list in the bottom right of the editor.
Just to jump around functions in the current file? Use imenu. It's the simplest and lightest of all the alternatives listed so far and might be enough for what you want. It's also built into Emacs and has minimum setup hassle. It features graphical and textual interfaces. Anything extra and you'll be better off using one of the other excellent suggestions made here.
speedbar comes standard, and gives you a collapsible menu for each file in the current directory, by default middle clicking on an entry for a function definition jumps to that def. With emacs23 this was changed to the more normal leftclick.
You can use etags-select to select from multiple matching tags. But the answer to what you asked is imenu.
Icicles is probably closer to what you are looking for:
http://www.emacswiki.org/emacs/Icicles_-_Tags_Enhancements
It's an enhancement to etags and includes (among other things) the file name with the tag so you can tell if it's the one you are looking for.
try CEDET. It is a bit difficult to set up the first, but here is an excellent tutorial: by Alex ott
And when he gets installed, you can use semantic-complete-jump. pressed tab couple times, and it is also brings up symbol definitions.
If M-. brings up the wrong method, you can type C-u M-. to find the next one with the same name.
global gtags is very good
To navigate within the current file or a set of files that you select, you do not need a TAGS file. You can use Imenu. But it is better to use Icicles imenu commands.
Why? Because they let you use completion. Substring, regexp, prefix, or fuzzy completion. Combine simple patterns to match, or subtract them.
Command icicle-imenu is bound in Icicle mode to C-c =. Butyou can also look up just a command or just a non-command function (non-interactive), using command icicle-imenu-command or icicle-imenu-non-interactive-function.
These commands are multi-commands, meaning that they are actually browsers: you can trip among function definitions using keys C-RET or C-mouse-2 (direct jumps) and C-down (cycle). Hit RET or click mouse-2 to settle down at a final destination.
I use C-M-a and C-M-e to jump between the beginning and end of functions.
Otherwise, open up Speedbar and click the + icon next to a file name to view a list of functions contained in the file. Then click on the function names to jump to them directly.