I'm an evil Emacs user. However, I really only use the normal mode for fancy Vim style edits when I find them more convenient than regular Emacs commands. (Mostly fancy bulk editing/yanking/deleting). However, I'm also a huge user of the minibuffer (I do a lot of M-x with ido and flx so I can avoid remembering the more esoteric commands). When I do, evil switches to normal mode automatically after I exit. I find that very annoying/confusing. How can I get it to stop? (preferably in an elegant, non-hackish way).
Thanks,
PythonNut
EDIT:
It appears that the switch to normal mode happens in all windows and in all frames.
I cannot reproduce your issue; maybe knowing your versions could help anyone to identify your issue. Can you reproduce your issue with "emacs -q" (plus adding evil to load-path)?
Here is an approach to identify the evil (traditional English meaning) piece of code, if any, that is calling to evil-normal-state:
(defadvice evil-normal-state (before debug-issue activate)
(setq debug-on-error t)
(inexisting-function-will-fail))
Eval this just after setting a buffer in the evil-state you want it to be, then go to to the minibuffer with M-x. Is there an stacktrace?
You may reactivate evil-mode by adding whatever function you use to activate it to minibuffer-exit-hook.
Related
I have Global Subword Mode enabled, but I am trying to get Ctrl+Left/Right to travel by subwords in place of the full word default of left/right-word (the default commands for those keys).
It works as expected if I simply rebind the keys, except for one case: If I try to "transient-mark" using Ctrl+Shift+Right, rather than marking the full word like right-word does, the point is moved to the next subword without creating a region.
Is this due to Subword Mode? I would like to know if I can somehow combine some of the normal features of left/right-word like marking with the movement of Subword Mode.
IMHO this is indeed a problem with subword-mode. You can fix it by doing:
(defadvice subword-backward (before handle-shift-selection activate)
(handle-shift-selection))
(defadvice subword-forward (before handle-shift-selection activate)
(handle-shift-selection))
But my advice is to do also a M-x report-emacs-bug so this can be properly fixed in next release.
It sounds easy but I can't fix it: I want to permanently disable automatic spell-checking in emacs. There must be a simple line for my init.el. Can somebody help me?
Figure out why it's on in the first place (it isn't enabled by default), then fix that. Either your init file is turning it on, or else some system-wide init file is. Read about those files: http://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html
From a brief look, the simplest way I can see is to redefine the function:
(eval-after-load "flyspell"
'(defun flyspell-mode (&optional arg)))
or you could use advice to force the argument to always be -1 (see C-h f turn-off-flyspell), but that would be slightly more complex and less efficient for no good reason.
If you want to know what is running it in the first place, you could use M-x debug-on-entry flyspell-mode, which will show a stack trace when the function is called (q to exit the debugger; C-h m to list other commands; M-: (info "(elisp)debugger") for help). Use M-x cancel-debug-on-entry to remove that breakpoint.
(flyspell-mode 0)
I found mine in ~/.emacs.d/usk/text.el
I deleted the block of code having to do with FlySpell and closed emacs.
After reopening emacs, I still saw the spelling error (red underline). However, I simply deleted and retyped the "misspelled" words and then, emacs didn't underline. Problem solved.
I'm running Debian.
In my case flyspell-mode has been gaining ground in the .emacs.desktop file.
This was not the first time that desktop-mode causes pain in restoring obsolete things. In this case it restored all modes on a per-file basis, although in .emacs.el I had already disabled flyspell-mode and flyspell-prog-mode everywhere.
Solution: either edit the .emacs.desktop file or delete it.
Using Emacs graphical mode you can just right click above "Fly" minor mode bellow and select "Turn Off minor mode" like this:
I am using GNU Emacs 22.3.1 on Windows.
In my Emacs I have enabled delete-selection-mode, and it's very useful to select a region and delete or replace it. But I have a drawback.
When I write or press DEL over the selection, Emacs does not only remove the text, but it kills (a.k.a. send to the clipboard*). This is very annoying for me, because I don't have control of my kill-ring (a.k.a. clipboard) and may cause unexpected effects.
There is a way that delete-selection-mode does not kill the text, just delete it? Perhaps modify the source code?
(*: I have synchronized the kill-ring and the Windows clipboard, so for me (for practical purposes) it's the same)
Edit[Jun 24, 2009]
Thanks, danielpoe. Even with the idea of Trey Jackson the selection is still killing. And I found the reason.
I discovered that the problem was not in delete-selection-mode. The problem is, when I selected the region, I did it with the mouse. And never have imagined that it was the mouse who was copying the text. Using the set-mark command and the arrow keys the text finally aren't killed, only deleted.
I disabled this behavior writing this in my .emacs:
(require 'delsel)
(setq mouse-drag-copy-region nil)
(global-unset-key (kbd "<mouse-2>"))
(global-unset-key (kbd "<mouse-3>"))
Thanks for the advice. If this method of disable this mouse behavior can cause conflicts with other options, please comment.
Have you tried starting emacs with -Q. If I do so and only enable M-x: delete-selection-mode, I can't reproduce what you describe. Nothing is killed only deleted?! Can you check?
It looks as though you just need to modify a small part of the source, namely make this change:
(defun delete-active-region (&optional killp)
(delete-region (point) (mark))
t)
The original code looked at the argument killp and used that to decide whether to add the region to the kill-ring, and you said you don't ever want that. This change forces the region to always be deleted.
Now, you don't need to actually modify the source, just place that function definition after the (require 'delsel) in your .emacs (or after the (delete-selection-mode)).
As a vim convert, I've gotten fairly used to viper mode. One issue that I've discovered, however, is that viper-auto-indent breaks all inferior modes. What happens is when I enter any sort of inferior mode (sql-mode, ess-mode, etc.) and hit Enter, the Enter key doesn't actually send the command off to the inferior process and gives the appearance of the process just hanging.
Without setting viper-auto-indent I have the problem that the Enter key doesn't automatically indent when writing code, meaning that I need to always hit tab after entering a new line, which is annoying. The workaround I've been using is to have viper-auto-indent enabled by default (since I spend most of my time programming), and then disabling it when I enter an inferior-mode buffer.
Does anyone know how to fix this problem? Alternatively, can anyone help supply me with the elisp to disable viper-auto-indent when switching to an interior mode buffer, and enabling it when in a non-inferior mode buffer? Thanks.
I think Emacs' intent is to have you use "C-j" for newline-and-indent, and let Enter be left alone.
If that is not yet acceptable to you, then this untested code may work:
(add-hook 'inferior-ess-mode-hook
'(lambda () (set (make-local-variable 'viper-auto-indent) nil))
I'm not able to reproduce your problem. I tried every level of viper-mode (1-5), and a number of inferior processes. That said, from your actual question, this code appears like it should fit the bill. If/when 'viper-autoindent is called, if the current buffer has a process, it calls the original binding for the keys just pressed. If there's no process, the original viper-autoindent is called.
(defadvice viper-autoindent (around viper-autoindent-but-not-when-buffer-has-process activate)
"work around reported user problem"
(if (and (this-command-keys)
(get-buffer-process (current-buffer)))
(let* ((viper-mode nil)
(thiskey (key-binding (this-command-keys))))
(when thiskey
(call-interactively thiskey)))
ad-do-it))
I've recently started using ido-mode, which, overall, is pretty nice. But one thing seems especially broken, and I'm wondering if there's a setting (ha) buried in there to fix it.
ido-switch-buffer doesn't seem to care about buried buffers. That is, if I use bury-buffer, and then ido-switch-buffer, the first choice is often the one I just buried.
Is there an easy way around this? The whole point of burying a buffer is that I don't want to see it again any time soon.
Acording to the documentation (C-h f bury-buffer)
Put BUFFER-OR-NAME at the end of the list of all buffers.
There it is the least likely candidate for 'other-buffer' to return;
thus, the least likely buffer for C-x b to select by
default.
So, if you use bury-buffer the buffer will be still available (at the end of the list), so it's normal that ido-switch-buffer find it.
If you don't want to see that buffer ever, you should think of closing it.
I can't reproduce this. On Emacs 23, as far as I can tell, ido-switch-buffer lists the buffers in the correct order.
In any case, you might try out iswitchb instead. It's kind of like ido, only older and more specific to buffer switching. If you like it, you can use iswitchb for buffer switching and ido for everything else.
can't reproduce this either: when i bury a buffer and call ido-switch-buffer afterwards, the buried buffer is NOT at the front of the switch list.
i have done quite a bit of ido customization (to get it working well with dired, etc), but my main ido settings are:
(setq ido-show-dot-for-dired t)
(setq ido-default-file-method 'samewindow)
(setq ido-default-buffer-method 'samewindow)
(setq ido-confirm-unique-completion t)
(setq ido-max-dir-file-cache 20)
my ido.el version is "1.57 released on gnu.emacs.sources adapted for emacs 22.1".
hth.
Use next-buffer or previous-buffer
FWIW, the default completion behavior of switch-to-buffer (C-x b) in Emacs-24 has been changed to use substring-match completion, so its behavior is similar to IDO while obeying the principle that "the default buffer shouldn't be the one I just buried". You can make it even more similar by turning on icomplete-mode (which does not change the completion behavior itself, but displays the completion candidates at the end of the minibuffer).