Emacs 24.5 , CUA mode. Not paste text in the minibuffer - emacs

In Windows 7 / Emacs 24.5
Copy text e.g. "example" in the kill-ring
M-x
C-y (yank)
Success show text "example" in the minibuffer
But if turn on CUA-mode, the text "example" not yank (paste) by 'C-v' in the minibuffer.

CUA mode makes C-v the yank/paste command.
If you start Emacs with :
emacs -Q
Then turn on CUA mode (M-x cua-mode) you'll see that C-v works as you expect.
Without knowing your setup it's difficult to be sure but it's likely you're using a package which modifies the behavior of M-x (E.g. smex, Ido, ivy, etc.)
It's likely CUA mode won't really have anything to do with this problem. You can verify this by trying to do C-y to yank in the minibuffer too.
Packages which enhance M-x may provide a way to allow you to drop out temporarily, so you can yank text in-place.
Update
From your comments we know you are using Helm, which overrides some bindings in the minibuffer, including C-v which is bound to page down.
Because bindings are applied at different mode (context) scopes, the minibuffer modemap (list of key bindings) will override anything that's applied at a more general context (such as cua mode)
To work around this you'd need to add a binding specifically for cua-paste in the affected mode map. It would need to be applied after Helm has loaded.

Related

kill-ring-save vs. clipboard-kill-ring-save

In the menu-bar of Emacs-23 under [Edit] there is Cut, Copy, Paste which are all explicit clipboard related commands ; the traditional C-w, M-w, C-y are no longer offered, and these no longer have an effect relevant to X.
What is the cleanest way to make the traditional commands clipboard-aware? It seems there must be some more systematic way than just redefining everything. C-h C-n did not help me.
Is it intended to hide the traditional command from users?
Edit: Or at least: a command to "synchronize" with the clipboard.
X has two "clipboards": the primary selection, and the clipboard. Emacs 23 uses the primary selection by default, but it seems you want the clipboard. You can enable this with the following in your .emacs:
(setq x-select-enable-clipboard t)
This setting changed in Emacs 24 to use the clipboard by default. See also: http://emacswiki.org/emacs/CopyAndPaste

How to scroll up in Emacs ansi-term

I've been Googling around and looking at Emacs built-in help but I have yet to determine how to scroll up (or down) in Emacs ansi-term.
I'm using Emacs 23.3.1, OS X, in iTerm2. Thanks!
Edit: I've noticed most the advice people give me doesn't work in ansi-term but does work in eshell. I have since moved to eshell.
In general, if you don't need full screen terminal emulation, shell or eshell are better choices.
However, if you decide to stick with ansi-term, press C-c C-j to go into line mode. Then you can move around normally with the usual cursor movement keys. Press C-c C-k to get back into char mode to interact with the terminal.
Alternatively, you can scroll backwards a screen at a time with C-c C-v and just enter text to scroll back to the terminal input point.
Take a look at the Emacs documentation on term-mode (most of which applies equally to ansi-term) for more information.
Shift-page up/down (in Emacs-speak, S-prior/S-next) will work using the default bindings.
(While the normal C-h m/C-h b don't work to see mode information and bindings in this mode, you can still use C-c M-x describe-mode/describe-bindings, or depending on your setup, use F1 or the help key instead of C-h.)
install evil-mode at first, press C-z to switch to vim key binding.
You can use C-f, C-b to scroll up and down
you can use 20% to jump to to the top 20% of the buffer
you can use /, ?, #, * to search the text in the buffer.
all the grep/filter commands now usable (occur, swiper, helm-swoop, .... just name a few)
you can narrow/widen the buffer
you can yank text
Have you tried: Page up, up arrow, Ctrl-V,Alt-V
For ansi-term, I have this in my .emacs:
(add-hook 'term-mode-hook
(function
(lambda ()
(define-key term-raw-map [?\C-c prior] 'scroll-down)
(define-key term-raw-map [?\C-c next] 'scroll-up))))
Then I can use C-c pgup and C-c pgdn to scroll.
I was having the same issue but with multi-term (zsh), and after reading the response from #muffinista (the C-v did not work for me) but the Alt-v worked to go 1 page, after that you can use the normal C-p and C-n to scroll up and down.
This worked for me, but it depends a lot on which term you are using and key bindings you might have.
Up and down are Ctrl-P and Ctrl-V. There's a whole long list here

How do I list all yanks in emacs?

Is there a way to list all the yanked text in Emacs? You can do it on Textmate with SPLAT+V.
Edit: I meant recently killed items, items that can be yanked.
The list of kills (i.e., the list of things you can yank) is called kill ring and stored in the variable kill-ring, so you can view it (in a not very nice way) with C-h v kill-ring RET.
The kill ring also appears in the menu, under “Edit / Paste from kill menu”. If you use a text mode Emacs or have turned the menu bar off, you can access the menu with M-x tmm-menubar (bound to M-`): type M-` e p followed by the first letter of the item you want to paste (if it's a letter and it's unique, otherwise whatever character is indicated). If you don't want to paste anything, type M-` e p C-g; the kills remain in the *Completions* buffer. The kill texts are displayed truncated to yank-menu-length characters.
To my knowledge, emacs doesn't support that feature out of the box.
If you're using a Debian or Ubuntu Linux distribution, you can install the emacs-goodies-el package, which contains a browse-kill-ring feature (bound to M-y by default).
Alternatively, you can use the browse-kill-ring ELisp package available here.
See also here for a nice article about this problem and other alternate solutions.
EmacsWiki has a satisfying list of solutions. A portable and intuitive solution uses the built-in popup.el to display a vertical list to choose from:
(global-set-key (kbd "C-c y") '(lambda ()
(interactive)
(popup-menu 'yank-menu)))
In Icicles you can see all of your kill-ring, and yank any entries in it using completion. By default, C-y is bound in Icicle mode to icicle-yank-maybe-completing.
That's the same as yank, unless you give it a negative prefix arg (e.g., C--). In that case, it lets you complete against the kill-ring. Completion can be prefix, apropos (substring, regexp), or fuzzy.
http://www.emacswiki.org/emacs/Icicles_-_Multi-Commands
councel-yank-pop wors well for me
especially with the binding suggested in
http://pragmaticemacs.com/emacs/counsel-yank-pop-with-a-tweak/
(use-package counsel
:bind
(("M-y" . counsel-yank-pop)
:map ivy-minibuffer-map
("M-y" . ivy-next-line)))
if you use helm, you may call the helm-show-kill-ring function.

Disable auto indent globally in Emacs

How to disable auto indent in Emacs globally or only for some modes?
I have a number of packages installed for RubyOnRails (ruby, html, js, css).
Let's say I want to disable autoindent for css-mode.
For me, on emacs 24.x, M-xelectric-indent-mode toggled the behavior that I wanted to disable.
FWIW, the behavior was that RET was bound to the command newline which is defined in simple.el... Among other things, the behavior of that command is altered by electric-indent-mode.
You may want to look for variable names containing the word electric. (This is the common Emacs parlance for actions which occur automatically when particular visible characters are typed.)
In this instance, M-x apropos-variable RET electric RET shows me that there is a css-electric-keys variable containing a list of "Self inserting keys which should trigger re-indentation."
You could use M-x customize-variable RET css-electric-keys RET to set this list to nil, or add (setq css-electric-keys nil) to your init file.
Sometimes a minor mode is used to implement electric behaviours, so that you can switch them on and off more easily. Those would likely be found via M-x apropos-command RET electric RET, and you would probably use a major mode hook to ensure that the electric minor mode was disabled, in a similar fashion to this:
(add-hook 'MAJORMODE-mode-hook 'my-MAJORMODE-mode-hook)
(defun my-MAJORMODE-mode-hook ()
(ELECTRICMODE-mode 0))

How do I turn off vhdl-mode in emacs?

I am learning emacs at the moment and tried to write an easy vhdl program for testing. I can see that the vhdl-mode might be an interesting feature, but I would like to know how I can turn it off for the moment and how I can reactivate it later on.
Use the command M-x fundamental-mode, that is:
Press (and hold) the meta key (which is usually the Alt key)
Press x
This will take the cursor into the echo area at the bottom of the screen/frame. Type fundamental-mode and press return.
To disable VHDL mode permanently, you will have to change the file-extension mapping used by emacs to associate a file's extension with a particular major mode. You can do this by writing a custom .emacs configuration file. Look for auto-mode-alist in the emacs manual:
(setq auto-mode-alist (remove (rassoc 'vhdl-mode auto-mode-alist) auto-mode-alist))
Change to some other mode, e.g.
M-x fundamental-mode RET
or
M-x indented-text-mode RET
re-enable it by entering
M-x vhdl-mode RET