I was wondering if there is a way to permanently remove a major mode let's say vhdl-mode from Emacs? I have already checked " How do I turn off vhdl-mode in emacs? " but I am wondering if I want to write my own distribution how can I removed some of these modes permanently from Emacs?
-- Experimental only and so no licensing issues or etc.
You can effectively disable a mode by removing it from the auto-mode-alist variable. Once removed, the mode will never be automatically chosen by emacs but it may still be started manually. This removes vhdl-mode:
(rassq-delete-all 'vhdl-mode auto-mode-alist)
All modes are available as files. On my machine, VHDL mode is at /usr/share/emacs/23.4/lisp/progmodes/vhdl-mode.el.gz. If you delete this file, there's no way to turn that on at all. If other modes depend on functionality implemented in this mode, they will suffer too.
Also, modes might be spread across mutliple files so you might have to remove more than one.
Related
(update: a valid answer can include "there is no neat/automated way of doing this) I've been keeping myself busy with other things but if I know there is no neat way of doing what is requested below then I'll just get started on finding some manual way as much as possible.
I have been looking online for a way to ensure all my emac buffers use the same keybindings. However I use exwm & certain applications such as libreoffice have their own keybindings which take precedence over emacs keybindings. Is there some code I can use to make all emacs default keybindings take precedence over any other application?
A specific example is this situation:
I want to be able to use the default bindings to change which buffer I am using position wise. I do this using (windmove-default-keybindings) however when I switch to an application like libreoffice writer, that application makes it so S-arrowkey doesn't move my active buffer anymore (libreoffice takes over that keybinding). I wish for windmove to still control what S-arrow key does.
In general this means I want emacs to be the only application in control of any keybinding. Is the only way to do this is to set each keybinding as global manually? and will a global keybinding take precedence over applications like libreoffice?
I would like to associate sets of buffers/files in emacs with different projects, and switch from one to other. This would involve closing all the buffers associated with the present project and open the files corresponding to the switched-to-project. I tried setting up desktops using bookmarks+ as suggested in https://emacs.stackexchange.com/questions/315/using-desktop-for-basic-project-management but all buffers remain open. I also tried setting up workgroups using workgroups2 (https://github.com/pashinin/workgroups2), but had similar issues. Is there an existing emacs package that could be used for this?
There is an excellent package called Projectile that does exactly what you describe and more.
Alternative suggestion
I recommend that you don't look to emacs to manage buffers, frames, and editor state separately across projects.
Instead, use a desktop manager and create separate desktops for each project. This works well because not only can you have separate emacs instances (that you can be sure are truly separated), but you can also have separate web browsers open to documentation or other project-specific applications that collectively get swapped in and out when you switch between projects.
You say, "I tried setting up desktops using bookmarks+ as suggested in using-desktop-for-basic-project-management but all buffers remain open.".
I guess you mean that switching to a desktop does not kill buffers that existed before the switch. Not by itself, it doesn't. How can it guess which such pre-existing buffers you want killed?
Clearly you do not want to kill all buffers that existed prior to the desktop switch.
To get the behavior it seems you want, you would need to somehow decide, and specify, which such buffers you would like killed. You could, for example, choose to kill all that have a certain mode (perhaps using desktop-buffer-mode-handlers).
With Bookmark+ you can have bookmarks that do more than one thing. In particular, here, you could create a sequence bookmark that chains together (1) a function bookmark that kills all of the buffers you want to kill and (2) a desktop bookmark.
Or you can perhaps make use of desktop-after-read-hook or desktop-buffer-mode-handlers to do some cleanup.
(But it sounds like you have not really thought through exactly what behavior you want with respect to buffers that you do not want to "remain open", so that you can specify it clearly. If you can specify it then you can probably implement it fairly easily, using either desktop hooks or bookmarks or both. Just a guess.)
I am not particularly satisfied how the viper mode works in Emacs. I am trying to write my own viper mode. I do not have any good programming experience in Elisp except for the number of customizations I have done using the .emacs file.
I would like to know if I can change the key-bindings in Emacs temporarily and return them back to their original state as and when needed.
Well if I understand your question correctly one easy way to do this would be to create your own minor mode (in addition to your own specific mode I'd say), made only of your temporary key-bindings.
You give a name to that mode and then toggling all your temporary key-bindings on or off becomes as simple as calling your command:
M-x salsabear-minor-mode
You probably want to read scottfrazer's 45+ upvotes answer here on SO:
Globally override key binding in Emacs
where he explains how to create your own minor-mode containing your key-bindings.
Given that you explicitly only mention viper, it's probably worth asking whether you're aware of the other vi/vim-based libraries which exist? See the list under:
http://www.emacswiki.org/emacs/CategoryEmulation
I would suspect that re-inventing this particular wheel is probably not worthwhile.
I believe that Evil is the most active project, but if it doesn't work the way you want, your efforts might be better-spent enhancing that (if practical)?
I'm trying to figure out if there's a way to reset the keymap so that I can manually enable features with an appropriate keybinding. I'm trying to do a customized Emacs build and would like full control over the keybindings and features enabled.
Edit: Thanks for the answers, this answered what I was looking for perfectly. I was trying to Google it and I couldn't find much but now I'm starting to understand Emacs more.
Basically I'm trying to learn it and customize the keybindings to my preferences. Though I have had trouble overriding some keybindings but the suggestions of disabling major mode was what I was looking for.
Well, Emacs will give you full control, there are a couple different ways to accomplish what it sounds like you're trying to do. To be successful though, I recommend you read and understand the Keymaps section of the manual. If your customized Emacs build uses any major or minor modes, you'll have to do special work to disable/override any keymaps they set.
Of particular interest are the sections Creating Keymaps, Active Keymaps, Controlling Active Maps, and ... pretty much the whole chapter.
I recommend starting with creating a basic keymap and overriding the global keymap with yours. That'd be a good start. Probably the easiest way would be to do something like:
(setq global-map (make-keymap))
(global-set-key ...)
Though, you're also going to have to disable the major modes from setting up their keys, the easiest way would be to disable automatic choosing of major modes by doing this:
(setq auto-mode-alist nil)
Read the section on How Emacs Chooses a Major Mode.
The question needs more detail to enable writing a more detailed answer...
You may bundle the features into a minor-mode with its own keymap. When the minor-mode is enabled, its keymap will be consulted before the global-map, overriding the latter in effect. When disabled, the default key bindings in the global-map will be visible again.
I saw the the news that emacs 23.1 was released.
For a programmer, What are the big reasons to upgrade? I'm currently on 22.2.
None of the features listed really seem like must-haves for me. The most immediately interesting bit is that nXML is now integrated. I already have it though.
But I have to admit I don't know what is really behind "smarter minibuffer completion" or "per buffer text scaling".
Anyone have any tips or examples of what these things are?
For me, the biggest reason is the support for anti-aliased fonts. And the --daemon support is nice.
Emacs-fu has a nice write-up of some of the features.
M-x butterfly
No one said anything about multi-tty support? I have one long (LONG!) emacs session opened somewhere, and I ssh'ed into that machine remotely and use that particular emacs session (with all the temporary buffers, everything setup the way I liked, groups of buffers opened, etc.). The benefit of course, is that I don't need to worry about saving temporary buffers (you do use those as scratch pad, don't you?), etc. when switching machines (from school to home, for example).
Also, with multi-tty support, you can open emacs with emacsclient -nw to substitute your occasional needs for vi for quick terminal edits. emacsclient -nw will open even faster than vi, and you will have access to your opened emacs session as a bonus. (Before emacs 23, emacsclient cannot run from the terminal).
"Improved Unicode support (the internal character representation is now based on UTF-8)."
is a critical reason for me, but it no doubt depends on your work flow.
Some of the terms you are asking about were discussed in Set Emacs defaut font face per-buffer/mode and are also in the emacs wiki, e.g. http://www.emacswiki.org/emacs/SetFonts (under Changing Font Size - Buffer Text Resizing ).
While I was using the pre-releases, the most noticeable feature has been the improved font support. and some small things about smarter window splitting.
for me its font support and gnupg integration.
also its nice to read pdf's from within emacs.