In the Isabelle proof assistant, one can click Ctrl+click on a term and the IDE redirects him to the relevant definition.
Can this be done with CoqIde? With Proof-General?
Yes, the features you mention in your post and in your comment (as an aside, feel free to edit your question to incorporate your comment) are possible in Proof-General and/or company-coq (an Emacs package gathering IDE extensions of Proof-General):
to see the content of a definition def (equivalent of Print def.): C-c C-a C-p def RET
to see the type of a definition def (equivalent of Check def.): C-c C-a C-c def RET
to see the type and related metadata of a definition def (equivalent of About def.): C-c C-a C-b def RET
to see all this in one go for the identifier under point (requires company-coq): C-c C-d
to be redirected to the location of the definition under point (requires company-coq): M-.
to make the definition under point show up without moving (requires company-coq): <C-down-mouse-1>
Reminders
Just to be self-contained, the Emacs keybindings C-c, M-., RET, <C-down-mouse-1> refer to Ctrl+c, Alt+., Return, and Ctrl+click (without releasing the mouse button).
Finally you can discover the list of bindings associated to the ambient mode by doing C-h m:
C-h k [describe-key] C-h m [describe-mode]:
C-h m runs the command describe-mode (found in global-map), which is
an interactive compiled Lisp function in ‘help.el’.
It is bound to C-h m, <f1> m, <help> m, <menu-bar> <help-menu>
<describe> <describe-mode>.
(describe-mode &optional BUFFER)
Display documentation of current major mode and minor modes.
A brief summary of the minor modes comes first, followed by the
major mode description. This is followed by detailed
descriptions of the minor modes, each on a separate page.
[…]
Related
I am new to Emacs working through the Org-mode beginning at the basics tutorial.
The "Working with todo items" part of the tutorial uses a C-c C-v binding.
But C-c C-v is not working on my Spacemacs. And it is not listed in describe-bindings:
SPC h d b
pattern: C-c C-v
"Prefix Command" is a keyboard macro.
Macro: P r e f i x SPC C o 2*m a n d
Similar results in emacs mode:
C-z
C-h b
pattern: C-c C-v
"Prefix Command" is a keyboard macro.
Macro: P r e f i x SPC C o 2*m a n d
C-c C-v doesn't work in Spacemacs mode nor Emacs mode.
What function is C-c C-v supposed to be bound to?
Is "C-c C-v" deprecated or a typo?
Is there an on-line resource that lists all the default Emacs key bindings?
I am running Emacs 25.2.1 with Spacemacs on Linux.
It used to be bound to org-show-todo-tree, but the binding was changed back in 2010: C-c C-v is now a prefix key for various org-babel functions.
You can call org-show-todo-tree with M-x org-show-todo-tree RET or you can install your own binding to org-show-todo-tree (the function is still around); or you can use C-c / t which shows a sparse tree of TODO items in the current buffer. In this last case, C-c / is bound to org-sparse-tree which gives you a bunch of options: t selects the TODO case, but you might want to experiment with the other options.
EDIT: BTW, I found all this using some git commands in my clone of the org-mode git repo. I used
git log --oneline --grep='C-c C-v'
to find commits that mention that key combo. The actual commit was
commit 3d8b6de2ad00220e164f226fb0dde5ada831d21b
Author: Carsten Dominik
Date: Wed May 12 08:04:27 2010 +0200
Free up the `C-c C-v' key for Org Babel
TODO sparse trees are also accessible with `C-c / t'.
Isn't git wonderful?
Is there a way to see the arguments for a common lisp function and its documentation from within emacs? Or also to see a list of all available functions?
SLIME automatically loads eldoc-mode - this is the mode that displays function arguments in the minibuffer. If you mean cl library of Emacs Lisp, you can load it using M-xeldoc-mode.
Another useful SLIME feature is the C-c C-d C-d - this pops a new buffer with documentation about the function.
These are very useful too:
C-c C-w C-aslime-who-specializes
C-c C-w C-bslime-who-binds
C-c C-w C-cslime-who-calls
C-c C-w RETslime-who-macroexpands
C-c C-w C-rslime-who-references
C-c C-w C-sslime-who-sets
C-c C-w C-wslime-calls-who
C-c C-w aslime-who-specializes
C-c C-w bslime-who-binds
C-c C-w cslime-who-calls
C-c C-w mslime-who-macroexpands
C-c C-w rslime-who-references
C-c C-w sslime-who-sets
C-c C-w wslime-calls-who
It should be obvious what they do from their names.
Addidionally, there's an auto-complete plugin for SLIME which can show documentation and function arguments in a drop-down menu (well, sort of), visually similar to how Visual Studio or Eclipse do it. I think it's called ac-slime and is installable through ELPA.
You can get the documentation of a function with documentation. (Following examples for getting information about the function list.)
(documentation 'list 'function)
"Returns constructs and returns a list of its arguments."
To get the argument-list, there is typically an implementation dependent function arglist in some package. You can search this function with (apropos 'arglist). This will give you a list of all interned symbols whose names contain arglist.
For example in CMUCL it is (swank-backend::arglist 'list), in CLISP it is just (arglist 'list), etc.
N.B. If you use SLIME, you should see the available arguments below anyway.
Sort of. The manual GNU Emacs Common Lisp Emulation comes with GNU Emacs -- it is CL in the main (dir-level) Info menu. Consult the function index for the list of documented functions. But the documentation is somewhat incomplete, and it documents only the Emacs implementation, which sometimes differs from the Common Lisp spec.
Consult the Common Lisp documentation for precise info about the language.
Common Lisp Hyperspec
Common Lisp the Language, 2nd Edition
Everything below is from http://cl-cookbook.sourceforge.net/emacs-ide.html
Q2. Viewing HyperSpec from within Emacs
Q2 I like having access to the HyperSpec when I'm in Emacs, but why does it have to use an external browser? Why
can't I just see the HyperSpec in Emacs?
A2 If you use the Emacs add-on package W3 (or W3M which provides similar functionality), you can display HTML pages
inside of Emacs. Once you have W3 and the HyperSpec both installed, use code similar to the following to access the
HyperSpec from the Shift-F1 key:
(global-set-key [(shift f1)]
'(lambda ()
(interactive)
(let ((browse-url-browser-function
'browse-url-w3)
(common-lisp-hyperspec-root
"file://c:/home/docs/Hyperspec/")
(common-lisp-hyperspec-symbol-table
(concat common-lisp-hyperspec-root
"Data/Map_Sym.txt"))
(hyperspec-prog
"c:/home/site/ilisp/extra/hyperspec"))
(load-library hyperspec-prog)
(common-lisp-hyperspec
(thing-at-point 'symbol)))))
Note that the "let" in the above code sets the browse-url-browser-function to W3 for just the HyperSpec. You can
either set the variable globally (if you want to always use W3 or some other specific browser) or locally (if you
want to use a specific browser and not the default one).
I have been creating macros and saving them for later use with the following process.
Create keyboard macro
Edit the macro: C-x C-k C-e
Name the macro: M-x name-last-kbd-macro
Create an .el file then insert the macro definition: M-x insert-kbd-macro
With the lisp code saved for later, I'll load it up in my .emacs file. Perhaps it is my unfamiliarity with elisp, but the elisp code which is generated seems quite unwieldy. I much prefer the syntax in the macro editor, and I'd like to make updates and refinements to the code that I've created, so I ask:
Is there a way to take my elisp code back to a reasonable rendition in the macro editor?
You can use C-x C-k e M-x followed by the name of the macro you want to edit. (Or C-x C-k e (edit-kbd-macro) followed by the key sequence a macro is bound to; M-x here is just a kind of mnemonic, as the help for the command explains).
Maybe it's also helpful to know that all the keyboard macros you've run are saved in a global ring, so you can cycle backwards and forwards through them using C-x C-k C-n and C-x C-k C-p.
BTW, it's not just unfamiliarity with Elisp that makes those macro definitions hard to read; insert-kbd-macro basically just writes out the macro as a vector of key sequences. Elisp written by humans is a much pleasanter language ;-)
I know that I can list all the keybindings available in emacs by using C-h b, but is it possible to list only the keybindings that apply to a certain mode, say dired-mode.
In dired+, I can do
?
h
and it shows me all the applicable dired mode keybindings.
Thanks
use C-h m or M-x describe-mode
Not sure what the question is. C-h b shows you all of the key bindings currently available (i.e., in the current mode).
If you want to see only the key bindings provided by a mode's own keymap, then use library help-fns+.el and hit C-h M-k. You are prompted for the keymap variable (e.g. dired-mode-map).
http://www.emacswiki.org/emacs/help-fns%2b.el
I'm trying to use C-h c in emacs to figure out what a key combination is bound to. The combination is C-u C-c C-q, which realigns tags in org-mode. However, Emacs just tries to look up C-u C-c and then fails. What am I doing wrong? I realize I could easily look at the orgmode source or something to figure this out, but for future reference what would I do to figure out what function something like this is bound to?
Edit: OK, so it's actually C-u followed by C-c C-q, and according to emacs this is what that combination is bound to:
(org-set-tags-command &optional arg just-align)
Call the set-tags command for the current entry.
So what exactly does it mean to give this command the argument 4?
Oh, just to give an explanation: I'm trying to start learning emacs-lisp and customization and one of the things I wanted to do was to have this command added to the before-save-hook so that when I save an org file, the tags get automatically aligned.
Final edit: I figured out why this command behaves as it does; given the prefix argument it changes its behavior. How can I set the prefix argument when calling the function in elisp?
It's not a general problem with combinations that are three keys long: For example, C-h c ESC ESC ESC (keyboard-escape-quit) or C-h c C-x r t (string-rectangle) both work fine.
When I try C-h c C-u C-c C-q in org-mode, the command interrupts after C-u and shows:
C-u runs the command universal-argument
in the minibuffer, which is correct. So, in fact, "C-u C-c C-q" is not a command, it's the command "C-c C-q" (org-table-wrap-region) started with an additional argument (4 -- see C-h k C-u for an explanation).