Disable Mail in emacs 23 - emacs

I am wondering if its possible to disable mail in emacs 23. Basically, I occasionally press C-xm and it annoys me that it will create a Mail folder in my home directory. (I also want to remap this to 'execute-extended command).
I have tried
(global-unset-key "\C-x m")
(global-set-key (kbd "C-c m") 'execute-extended-command)
but it doesn't seem to affect anything.

This will set the binding of C-xm to the execute-extended-command function:
(global-set-key "\C-xm" 'execute-extended-command)
or
(global-set-key [?\C-x ?m] 'execute-extended-command)
or
(global-set-key (kbd "C-x m") 'execute-extended-command)

Related

How to disable Meta-Cursor Shortcuds in markdown-mode?

I switch windows with M-left and M-right. Also Tab, S-Tab and C-Tab are hardwired into my spine. Since I use markdown-mode my workspeed has halved.
How do I disable that markdown-mode re-assigns those keys on loading. The keys I describe are carefully handcrafted shortcuts from my .emacs file, set via global-set-key.
(global-set-key [S-iso-lefttab] 'dabbrev-expand)
(global-set-key [C-tab] 'ispell-word)
(global-set-key [M-up] 'windmove-up)
(global-set-key [M-down] 'windmove-down)
(global-set-key [M-left] 'windmove-left)
(global-set-key [M-right] 'windmove-right)
Set those keys also in markdown-mode, in its keymap (probably markdown-mode-map). For example:
(define-key markdown-mode-map [C-tab] 'ispell-word)
The problem you saw comes from the fact that a local binding overrides a global one. See the Elisp manual, node Active Keymaps.

emacs: turning electric-indent-mode on/off easily

I'm a bit of an elisp newbie. How can I tell emacs to toggle electric-indent-mode when I press "C-c e" ?
I tried
(global-set-key (kbd "C-c e") 'toggle-electric-indent-mode)
but that does't seem to do it for me.
The mode is just a function that you can call. Try:
(global-set-key (kbd "C-c e") 'electric-indent-mode)

How to customize Emacs keyboard shortcut for deleting current line

I want the current line to be deleted when Alt, and the letter d is pressed twice.
How can I achieve this inside my Emacs configuration file?
Currently all I have is this in my .emacs:
(global-set-key (kbd "M-9") 'prev-window)
(global-set-key (kbd "M-0") 'other-window)
You can use your own keymap:
(defvar somename-map (make-sparse-keymap) "Keymap for M-d")
(define-key somename-map (kbd "M-d") 'kill-line)
(define-key somename-map (kbd "M-w") 'kill-word)
(global-set-key (kbd "M-d") somename-map)

How to keep traditional binding on M-x in emacs evil mode

I am trying to bind execute-extended-command to M-x in evil normal mode.
I currently have
;; evil mode
(require 'evil)
(evil-mode 1)
(define-key evil-normal-state-map "M-x" 'execute-extended-command)
in my .emacs file but the keybinding doesn't work. I tried replacing
"M-x"
with
"\M-x"
and
(kbd "M-x")
but neither works. I also tried adding it to evil.el and evil-maps.el.
I don't know what's wrong with your binding. You could use Emacs' own global-set-key for global stuff and if you plan something special for say, insert mode, you could override that later on, like this:
;; this works, just tested. My evil is 1.0-dev from github.
(global-set-key (kbd "M-x") 'smex)
(define-key evil-insert-state-map (kbd "M-x") 'execute-extended-command)
Use (kdb "") macro when you have modifier keys in your binding. But you can use the macro always, regardless of the content. These are for example usage. When in doubt, wrap the key in (kdb ).
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
;;(global-set-key (kbd "M-x") 'execute-extended-command)
(define-key evil-normal-state-map ",d" 'volatile-kill-buffer)
(define-key evil-normal-state-map ",b" 'ido-switch-buffer)
(define-key evil-normal-state-map ",s" 'ispell-word)
(define-key evil-normal-state-map (kbd "C-x g") 'magit-status)
(define-key evil-insert-state-map (kbd "C-f") 'my-expand-file-name-at-point)
(define-key evil-insert-state-map (kbd "C-x C-l") 'my-expand-lines)
(define-key minibuffer-local-map (kbd "C-w") 'backward-kill-word)
(define-key evil-normal-state-map (kbd ",ff") 'ido-find-file)
After long research and with help from #emacs and #evil-mode channels on irc, it turned out that my emacs was broken. It was a snapshot from http://emacs.naquadah.org/ I tried all this on another emacs version (from debian jessies repos) and it worked ok.

How to bind 'search' and 'search-repeat' to C-f in Emacs?

How can I to remap incremental search (C-s) to C-f in Emacs?
I try to do (global-set-key (kbd "C-f") 'isearch-forward) but the second C-f does not repeat the search and I need to use C-s.
I then tried (global-set-key (kbd "C-f") 'isearch-repeat-forward) but the first C-f didn't start the search.
And I even tried (global-set-key (kbd "C-f C-f") 'isearch-repeat-forward), but this causes an error.
I want to use C-f for search and search-repeat commands, how can I do this?
Thanks.
(define-key isearch-mode-map "\C-f" 'isearch-repeat-forward)
isearch-repeat-forward is defined in the isearch-mode-map
To resolve your problem do the following :
(global-set-key (kbd "C-f") 'isearch-forward)
(add-hook 'isearch-mode-hook
(lambda ()
(define-key isearch-mode-map (kbd "C-f") 'isearch-repeat-forward)
)
)
EDIT: actually, you don't need to add a hook. The accepted answer by Ross Patterson is correct.