This is very odd.
I have my Emacs config in code blocks in an org-mode
file that is called from my init file using (org-babel-load-file "~/.emacs.d/emacs-config.org")
.
I've tried to assign some new key-bindings:
#+begin_src emacs-lisp :tangle yes
(global-set-key (kbd "C-c h") 'browse-url-emacs) ; plain text
(global-set-key (kbd "C-c j") 'browse-url) ; default browser
#+end_src
For a reason that I don't understand, this breaks other key bindings. After restarting emacs, for example, C-x f
is bound to the default set-fill-column
instead of recentf-ido-find-file
, to which I had it reassigned.
This is confusing, because there is no overlap between the key-bindings. But what's really weird is that the problem persists even when I comment out the new key-bindings in the code block:
#+begin_src emacs-lisp :tangle yes
; (global-set-key (kbd "C-c h") 'browse-url-emacs) ; plain text
; (global-set-key (kbd "C-c j") 'browse-url) ; default browser
#+end_src
The problem goes away if I instruct org-babel
to ignore the code block (using the :tangle no
property:
#+begin_src emacs-lisp :tangle no
; (global-set-key (kbd "C-c h") 'browse-url-emacs) ; plain text
; (global-set-key (kbd "C-c j") 'browse-url) ; default browser
#+end_src
Why do commands that are commented out seem to affect my config? (And in such a weird way?)
And why do these new key bindings mess up existing ones?
~/.emacs.d/emacs-config.el
so you should take a look at this file and see what it contains in the various cases. That will probably help you understand what's going on. If you still have problems, you might want to add that file to your question if it's short enough - or better yet, you might be able to reproduce the problem with a much smalleremacs-config.org
file and then post the resulting.el
file in your question.