emacs delete-selection-mode disables itself - emacs

In my .emacs file I have (delete-selection-mode t) to enable the delete-selection-mode globally. Currently I'm working on a TeX file with AUXTeX, so it might be related to AUCTeX, but I don't know.
At first, after visiting a file foo.tex everything works fine, and typing over a marked text replaces the marked text with the one I type. However, after some time, during which I compile the document, add TeX macros, etc. the functionality of the delete-selection-mode doesn't work any more.
I don't know which action of mine is the one which causes the problem - it would be hard to trace it.
Note that although the functionality of the delete-selection-mode fails, when I try to enable it (M-x delete-selection-mode) I get a message that the mode was disabled! That is it was not disabled before - it just didn't work... I I then enable it (M-x delete-selection-mode again), then it is enabled and working again. Till the next fail...

Under the hood, the mode use pre-command-hook, which allows commands to run things right before every command. Emacs is known to clear this variable in the event of an error (just to make sure that Emacs don't hang). This mean that the function used by delete-selection-mode, or any other mode that use this hook, triggered an error.
How to fix it? Find what caused the error, wrap the function in a ignore-errors block, or run a timer re-adding the function every ten seconds or so.

Related

How to prevent messy windows after error in emac-live

I'm trying to get familiar with emacs and Clojure and its working out pretty well..
It's just that everytime I get a Clojure error, it will close any emacs-window except the one where the error occured and instead show me a giant empty window of "popwin-dummy".
I can't quite see how that's supposed to help me fixing any bug... Can you tell me how to disable this behaviour?
Have a nice day!
As a general protection against "Emacs messed up my window configuration" occurrences, add the following to your init file:
(winner-mode 1)
You can also toggle it for the current session with M-x winner-mode
Then whenever your window configuration is unexpectedly changed, use C-c<left> to call winner-undo (which you can do repeatedly if necessary).
C-c<right> takes you back to the most recent configuration (immediately, rather than step-by-step).

show value of variable when mouse hovers over in Emacs/gdb?

I am using GDB with emacs and sometimes use GDB with DDD.
Starting version 22 (???) Emacs provides a tool-bar-mode, where you can do
the most important commands like run, next, step, up/down of stack frames in the emacs UI.
As such , I have moved away from DDD, since anyways I run most commands through command line and the sometime through the limited UI given in the tool-bar-mode.
However, the ability to hover your mouse over a variable and make the value to pop-up still seems to be missing. Does anyone know about some mode in emacs or some .el file that would allow Emacs to do the same.
This kinda goes against emacs not being a gui-ide. I can still use watchpoints/local variable buffer; but I really would like the ability to hover my mouse over some variable and see the value. Any help would be much appreciated.
gud-tooltip-mode is supposed to give you just that, I think.

emacs gud window use

How do I customize which window GUD will use when i issue commands - 'up', 'down', etc ? It seems to use an arbitrary window, sometimes even the window with gdb in it - I want to be able to specify a specific window to be used.
Have you considered borrowing the key bindings mentioned in the following question?
Emacs, switch to previous window
This question implies that GUD steps on some things if you don't add a parameter. Maybe your command bindings are being affected similiarly.
Using gdb in Emacs 23
I asked a buddy of mine about this issue and here is what he said.
Well, we used xemacs and so it's not exactly apples to apples here. I
do have gnu-emacs installed on cygwin and I can't replicate his
problem. I think he definitely needs to list a version # for emacs
and the version # for all his installed packages.
When you press up/down it calls 'previous-line' and 'next-line'
respectively which both move the cursor in the default buffer. The
only thing I can think is that he has something running that switches
buffers (lisp 'set-buffer') temporarily and maybe doesn't set it back
or errors b/f restoring the buffer? Better to use
'with-current-buffer' (or one of the other with-* forms) that saves
the current state of the ui runs your lisp code and restores the ui
state.

How can I make emacs stop loading viper-mode?

I'm developing a mode for Emacs, and everytime I switch to its buffer, viper gets turned on. I've modified viper-mode to trace where viper-mode is being called, and surprisingly set-viper-state-in-major-mode is called by running the viper-post-command-hooks, set to nil. Any idea of what is going on?
Thanks!
EDIT: For the benefit of all beings, here is what I found out: as instructed by Trey, I started emacs with -Q and manually loaded both viper and my package. As I could reproduce the bug, the problem was on one of these packages. After line-by-line filtering, I discovered that the innoquous-looking (kill-all-local-variables) was causing the problem.
There's something in initialization that's causing it.
First try starting without your .emacs emacs -q. If the problem persists, then the trigger is in the site-start.el. So, talk to whomever installed Emacs and get them to remove the customizations there. You can also always use the -Q startup option to avoid loading the site-start.el.
If the problem isn't in site-start.el, and you don't think it's in your .emacs, it might be in a custom default.el file, which you can prevent from being loaded by adding:
(setq inhibit-default-init t)
to your .emacs.
If you still have a problem, then I'm 99% sure it's in your .emacs.
To be 100% sure, try emacs -Q, which runs Emacs with no customizations. If the problem persists, download and install your own Emacs b/c you surely can't trust the installation you're using.
So, now if you're convinced it's in your .emacs, start cutting out parts of your .emacs, or introduce an error in your .emacs with (error "frog"), and progressively rule out which portions of your .emacs are causing the problem.
g'luck
The function kill-all-local-variables will run all functions added to change-major-mode-hook, this is a common way for global minor modes to initialize themselves. For example, global font lock and global cwarn mode use this.
I haven't used viper myself, but chances are that it use this mechanism. Of course, you still would have had to enable it in your init file, somehow, so if you simply would stop doing this, it would solve your problem as well.
Try commenting out any references to viper mode in your .emacs. I don't get sent into viper mode, unless I start playing around with viper mode before I eval your new mode.
Maybe there's more being done with this statement than you think:
(use-local-map ecoli-map)
Try to change some of your binds in your map. eg. j to C-j and k to C-k.
Maybe emacs is getting confused?
Try removing your ~/.viper config file, and also check your .custom.el for settings that might kick viper into action in your major mode (or globally).

make emacs semantic auto complete tip "always on"

I have just installed cedet (CVS version) and I am now playing with in emacs and my C++ source code.
Regarding the auto complete, I can invoke the tool tip and the menu from their semantic-ia-complete-* commands.
Does anyone know how I can make the auto complete tip appear automatically without my having to invoke a command (semantic-ia-complete-tip)? Is this even possible?
From CEDET website:
Automatically starting inline completion in idle time
M-x global-semantic-idle-completions-mode
This is a minor mode which runs
semantic-complete-analyze-inline-idle
during idle time. Instead of trying to
complete the symbol immediately, it
will just display the possible
completions, and underline the current
symbol the cursor is on.
In practice this means that the possible completions will appear whenever you stop typing and the cursor is under a symbol where completions are possible.
To use it, just put
(global-semantic-idle-completions-mode)
to your .emacs after loading the CEDET.