M-x global-set-key <RET> C-d delete-backward-char
successfully rebinds C-d
to delete-backward-char
.
However, (global-set-key (kbd "C-d") 'delete-backward-char)
in my ~/.emacs.d/init.el
doesn't seem to have any effect.
This related post doesn't solve it for me.
I am new to emacs, is there something wrong with the way I am entering my command in my init file. Note that other commands successfully working in my init file include ones such as:
(global-set-key (kbd "C-c a") #'org-agenda)
.
I don't understand why the #
is needed here, but using a #
did not solve my problem of remapping C-d
Edit
Removing
(org-babel-do-load-languages
'org-babel-load-languages
'(
(emacs-lisp . t)
(R . t)
(python . t)
(scheme . t)
(java . t))
(latex . t)
)
from my ~/.emacs
file causes things to work. But I would like to be able to keep these lines if possible. Any idea why these lines are problematic?
C-d
correctly triggers the commanddelete-backward-char
(i.e. it deletes the inserted characters). What doesC-h k
C-d
tell you? Placing#'
before a symbol is called 'sharp quoting' its use and purpose is explained here. – dalanicolai May 25 '22 at 11:15C-d
is not working? It may be that it overrides the global keymap setting with its own. @dalanicolai's comment tells you how to check. – NickD May 25 '22 at 12:28#'
is an abbreviation forfunction
. See the Elisp manual, node Anonymous Functions. – Drew May 25 '22 at 14:10C-h k C-d
says that C-d runs the command delete-char (found in global-map). It seems that some lines in my .emacs file are causing problems, as shown in my update. I am testing things out in the scratch buffer and it works when I remove the problematic lines – user615536 May 25 '22 at 16:07(java . t)
should really be placed after(latex . t)
. Otherwise, try to start Emacs viaemacs --debug-iinit
. – dalanicolai May 25 '22 at 16:51~/.emacs.d/init.el
and~/.emacs
. Note, that Emacs loads only one of them if you do not explicitly call(load "~/.emacs.d/init.el")
in~/.emacs
. If you put(global-set-key (kbd "C-d") 'delete-backward-char)
into~/.emacs.d/init.el
and a non-empty~/.emacs
exists (without(load "~/.emacs.d/init.el")
) then theglobal-set-key
is never evaluated. – Tobias May 25 '22 at 20:26