new-ryuslash.org/posts/20230412-0702-paredit-and-ielm.org
Tom Willemse 839c53448b Add blog section
- Add a ‘posts/index.org’ that just includes all of the posts and only exports
  headings tagged with ‘summary’.

- Add summaries to all posts.

- Rename posts to include the date and time in the file name.

- Add an RSS feed from the new ‘posts/index.org’

Unfortunately generating an RSS feed from the ‘index.org’ doesn't work, so this
experiment is at a dead end for now.
2023-07-25 13:12:33 -07:00

34 lines
1.7 KiB
Org Mode
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#+TITLE: IELM & Paredit
#+TAGS: emacs
#+COMMENT_STATUS: closed
#+STATUS: publish
# #+DATE: Wed, 12 Apr 2023 07:02:45 GMT
#+DATE: <2023-04-12 Wed 07:02>
#+UPDATE_URL: /admin/modify-post/2023%252f04%252f12%252fielm-paredit
#+exclude_tags: summary
For a while I've been bothered by being unable to use IELM to evaluate Emacs Lisp expressions. Then [[https://www.n16f.net/blog/making-ielm-more-comfortable/][Making IELM More Comfortable]] pointed out that using paredit in IELM causes the =RET= and =C-j= keybindings to be bound to the wrong functions and proposes to fix them. The given fix, however, appears to change the keybindings for all buffers using paredit. I don't want that, and Emacs can do better!
A quick search yielded [[https://stackoverflow.com/a/13102821][Buffer-locally overriding minor-mode key bindings in Emacs]] suggesting a fix. My adaptation of that solution:
#+begin_src emacs-lisp
(defun oni-elisp-ielm-remove-paredit-newline-keys ()
"Disable C-j and RET keybindings from paredit-mode."
(let ((oldmap (map-elt minor-mode-map-alist 'paredit-mode))
(newmap (make-sparse-keymap)))
(set-keymap-parent newmap oldmap)
(define-key newmap (kbd "RET") nil)
(define-key newmap (kbd "C-j") nil)
(make-local-variable 'minor-mode-overriding-map-alist)
(push `(paredit-mode . ,newmap) minor-mode-overriding-map-alist)))
(add-hook 'ielm-mode-hook #'oni-elisp-ielm-remove-paredit-newline-keys)
#+end_src
Defining =RET= and =C-j= as =nil= means that the keybinding defaults back to the major-mode keybinding.
* IELM & Paredit :summary:
I couldn't use IELM for a while because of Paredit. So I fixed it.
[[file:20230412-0702-paredit-and-ielm.org][Read More]]