How do you disable mlinks-mode in emacs nxhtml mode - emacs

I am using emacs with nxhtml mode. I find mlinks-mode to be a pain because I use PHP constants for my paths which trips up mlinks-mode - so when I inadvertently click on a link, I get a debug stack trace.
Whenever I enter into an HTML block, the mlinks-mode gets enabled. I have tried setting my init file or mlinks-mode options to disable it, but it seems to be getting loaded dynamically regardless of these settings. Is there a way to prevent nxhtml from loading this mode unless I want it to?

Try M-x customize-variable RET mlinks-mode-functions RET and remove the nxhtml-mode entry.

Related

Emacs does not create new windows for new buffers

I am very new to emacs. I just started using it. After a fresh install of spacemacs on my macbook when I opened a file from neo tree or command line it used to appear in a new window. Now it's opening in the same window and the file that was already open gets hidden. I don't know what I did wrong. I even reinstalled spacemacs from scratch but it is of no use.
Also, I can't find a way to open a file in a new frame and close it in the frame that it's already in.
it used to appear in a new window. Now it's opening in the same
window and the file that was already open gets hidden.
I don't know about spacemacs, but for Emacs generally it's completely
normal when visiting a file for the current window to be re-used.
The pop-up-windows user option would affect this some of the time,
but that's non-nil by default, so you probably have that enabled
already?
M-x customize-option RET pop-up-windows RET
Naturally there are other rules and settings around this behaviour
(which is very flexible), so I would also recommend reading about it
in the manual:
C-hig (emacs)Window Choice
You can use the command find-file-other-window to make Emacs display
the buffer in the 'other' window (creating a new window if necessary).
This is usually bound to C-x4f but
spacemacs may be different?
Refer to: C-hig (emacs)Pop Up Window
Also, I can't find a way to open a file in a new frame and close it
in the frame that it's already in.
Similarly to the above, by default:
C-x5f calls find-file-other-frame
C-x50 calls delete-frame
Refer to: C-hig (emacs)Creating Frames

emacs delete-selection-mode disables itself

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.

unable to toggle read-only mode in emacs

I am using emacs-live as my emacs starter config. I have .jade files which when opened in emacs say Buffer is read only.
However these same files I am able to edit in Sublime Text.
I tried toggling the read only by C-xC-q to no effect.
How do I resolve it ?
File permissions shouldn't prevent Emacs from allowing you to toggle the read-only state of an associated buffer.
Can you try M-x toggle-read-only RET instead, to check whether it's the function or just the key binding that isn't working?
I'm assuming that C-xC-q is working in general for other buffers?

How to turn off *input/output* buffer in gud

I recently switched to using GNU Emacs 24 from 23, and I notice that whenever I enter gud the *input/output* buffer is open. I have close it manually with C-x 0 everytime I debug. Can anyone point me to the correct variable which needs to be configured in order to stop displaying this buffer by default?
There is a 'gud-gdb' in new emacs releases that implement the old behavior of gdb/emacs interaction (no dedicated-windows and no I/O buffer). If you don't want to call M-x gud-gdb when you use it you can define an alias for M-x gdb
I have this problem as well. After a quick look at the source code, the problem appears to be that GUD dedicates most of its windows (that is, it calls set-window-dedicated-p on them). A dedicated window is one that cannot be switched away from. I guess more and more young guns are using GUD in many windows mode and want GUD to manage their window layout, and those of us that like to do that manually are in the minority. There doesn't seem to be anything obvious in gdb-mi.el that disables this behavior (for example, gdb-set-window-buffer seems to always do a set-window-dedicated-p to t for all windows it manages).
For now, this solution is more or less the one I'm using -- I manually deactivate the window dedication. This seems suboptimal, though. There ought to be some way to get GUD to let you manually manage the window layout. This question is related.
You can disable window dedication altogether like this: (in Emacs 24.4+)
(defun set-window-undedicated-p (window flag)
"Never set window dedicated."
flag)
(advice-add 'set-window-dedicated-p :override #'set-window-undedicated-p)
Note that this doesn't affect already dedicated windows.

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).