Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy can't I change paredit keybindings
    primarykey
    data
    text
    <p>I'm trying to use just a few functions from paredit, without loading all the keybindings. Looking at paredit.el, the only keymap I found was paredit-mode-map, so I tried this.</p> <pre><code>(setq paredit-mode-map (make-sparse-keymap)) (define-key paredit-mode-map (kbd "&lt;C-M-left&gt;") 'paredit-backward) </code></pre> <p>It didn't change the keybinding (As checked with C-h k), but the variable paredit-mode-map was changed.</p> <p>I also tried </p> <pre><code>(eval-after-load "paredit" '(progn (setq paredit-mode-map (make-sparse-keymap)) (define-key paredit-mode-map (kbd "&lt;C-M-left&gt;") 'paredit-backward))) </code></pre> <p>and then turning paredit on and off, with the same result. </p> <p>Previously, making changes to a keymap directly has always worked for me. What is going on here?</p> <p>Edit: </p> <p>I succeeded in changing the keymap by doing this:</p> <pre><code>; Remove old paredit bindings (defun take-from-list (condp list) "Returns elements in list satisfying condp" (delq nil (mapcar (lambda (x) (and (funcall condp x) x)) list))) (setq minor-mode-map-alist (take-from-list (lambda (x) (not (eq (car x) 'paredit-mode))) minor-mode-map-alist)) ; Create new paredit-mode-map (setq paredit-mode-map (make-sparse-keymap)) (define-key paredit-mode-map (kbd "&lt;C-kp-enter&gt;") 'paredit-backward) ; Add the new paredit-mode-map to minor-mode-map-alist (setq minor-mode-map-alist (append (list (append (list 'paredit-mode) paredit-mode-map)) minor-mode-map-alist)) </code></pre> <p>So it seems minor-mode-map-alist is a the variable used for lookup. I'm sure there are more elegant ways to change the keybindings, but I wanted to understand more of how keybindings work in emacs.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload