the default behavior of isearch was highlighting the world that matched in current windows.
how can i change that behavior, let it highlighting the world that matched in the whole current buffer.
Perhaps you are looking for the highlight-* commands, to keep things highlighted throughout the buffer whilst you perform other actions?
M-shC-h lists:
Global Bindings Starting With M-s h:
key binding
--- -------
M-s h l highlight-lines-matching-regexp
M-s h p highlight-phrase
M-s h r highlight-regexp
M-s h u unhighlight-regexp
You can also use M-shr during an isearch to invoke highlighting for the current search term.
Tangentially, you can likewise invoke occur on the current search term with M-so
Use C-hC-hb during isearch to see all of the isearch bindings.
Related
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.
[…]
I'm trying to set a command for C-M-s, however the M-s bit is screwing up. When I try to search for an existing command for the C-M-s keybinding using the describe-key function (C-h k) nothing is registered. When I search for just M-s the buffer registers Esc-s. This only happens with the s key, for example, searching for M-d and C-M-d both work as expected.
Sometimes in a long commit log, it's really painful to navigate the all-expanded diffs.
(You get expanded-diffs when hitting enter from the magit-blame-mode for example)
Is there a way to collapse these diffs?
In any buffer you can type C-hm to see the major and minor mode descriptions, which almost always includes the key bindings defined by each mode (and if it doesn't, you can type C-hb and then search for the mode you're interested in).
Major mode magit-diff-mode includes the following bindings:
M-1 magit-show-level-1-all
M-2 magit-show-level-2-all
M-3 magit-show-level-3-all
M-4 magit-show-level-4-all
M-H magit-show-only-files-all
M-S magit-show-level-4-all
M-g magit-goto-diffstats
M-h magit-show-only-files
M-n magit-goto-next-sibling-section
M-p magit-goto-previous-sibling-section
M-s magit-show-level-4
I am trying to learn to use keyboard macros more but wasn't sure how to approach this.
I need to select a region, then run two query-replacements on that region. The region will be different each time, but the query replacements will be the same.
The problem comes because the first query replace (or replace-string) removes the active region. If I use C-u C-SPC, it appears the beginning mark is saved, but the point is not saved, so the active region is not available for the second replace operation.
How can I apply two operations, which remove the active region as a side effect, to the same region in a keyboard macro?
As I don't perfom tasks like the one described that often I'm not sure I can advice you the quickest solution but here at least two approaches that will work.
Option 1
This option involves using narrowing to reduce the buffer to the active region prior to performing query-replace, or whatever you want to do with the region. The workflow would be as follows:
... start recording your keyboard macro with region active
M-x narrow-to-region
... perform the operations you want to perform happily jumping back to the start via M-< (beginning-of-buffer) and the like
M-x widen
... stop recording your keyboard macro
You should be able to happily apply it to any highlighted region.
BTW: narrow-to-region and widen have a default bindings of C-x n n (narrow-to-region) and C-x n w (widen) so you could use them either in case you haven't changed your keybindings
Option 2
This options involves using registers to store the locations of the region prior to "destroying" it. The actual workflow would look like
... start recording your keyboard macro with region active
C-x r SPC 1 (point-to-register)
C-x C-x (exchange-point-and-mark)
C-x r SPC 2 (point-to-register)
... perform the operation that "destroys" the region
C-x r j 2 (jump-to-register)
C-SPC
C-x r j 1 (jump-to-register)
... now your region should be back again, so happily apply any other operations not "destroying" the region
... stop recording your keyboard macro
What you're missing is exchange-point-and-mark C-x C-x. This has
the effect of re-activating the mark.
I have the following code in .emacs: (global-set-key (kbd "M-x g") 'gnus) to start Gnus with the keybinding M-x g. I obtain: error: Key sequence M-x g starts with non-prefix key M-x. How can I define keybindings starting with M-x? Is this a bad thing to do and should be avoided? I find it more intuitive since the "long version" is M-x gnus. Defining it as C-c g for example is no problem but then you start Gnus with C-c g and, for example, R via M-x R which is not very intuitive (in contrast to starting both via M-x + 1 letter
The key M-x is already bound to the command execute-extended-command, which then asks you to provide the name of a command to execute (in you case: gnus).
Since R is a command only one-character long, it looks like M-x R is a key sequence, but it's not: it's M-x followed by entering R in the minibuffer and you have to hit RET to validate your input.
In short:
you can not set key sequences beginning with M-x since this key is already bound to a command and is thus not a prefix (unlike C-c, which does nothing but wait for you to type another key, but should be reserved for bindings specific to the current modes).
the standard way to do things would be to continue starting gnus using M-x gnus or to rebind it to an entirely different key if you need to be very quick (you could for example use one of the F1-F12 keys)
if you really want to have a M-x + letter binding, you can define a one-letter alias to the command gnus, like this:
(defalias 'g 'gnus)