Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: the undefine-key function to delete an existing key in a keymap. #1611

Open
sakurawald opened this issue Nov 19, 2024 · 4 comments
Open

Comments

@sakurawald
Copy link
Contributor

sakurawald commented Nov 19, 2024

I have the folloing bindings:

(defun define-paired-commands ()
  (define-key lem-vi-mode:*normal-keymap* "[ b" 'previous-buffer)
  (define-key lem-vi-mode:*normal-keymap* "] b" 'next-buffer)

  (define-key lem-vi-mode:*normal-keymap* "[ w" 'previous-window)
  (define-key lem-vi-mode:*normal-keymap* "] w" 'next-window)

  (define-key lem-vi-mode:*normal-keymap* "[ t" 'lem/frame-multiplexer::frame-multiplexer-prev)
  (define-key lem-vi-mode:*normal-keymap* "] t" 'lem/frame-multiplexer::frame-multiplexer-next)

  (define-key lem-vi-mode:*normal-keymap* "[ s" 'backward-sexp)
  (define-key lem-vi-mode:*normal-keymap* "] s" 'forward-sexp)

  (define-key lem-vi-mode:*normal-keymap* "[ l" 'up-list)
  (define-key lem-vi-mode:*normal-keymap* "] l" 'down-list)

  (define-key lem-vi-mode:*normal-keymap* "[ f" 'lem/language-mode::beginning-of-defun)
  (define-key lem-vi-mode:*normal-keymap* "] f" 'lem/language-mode::end-of-defun)
  
  (define-key lem-vi-mode:*normal-keymap* "[ i" 'lem-vi-mode/commands::vi-search-backward-symbol-at-point)
  (define-key lem-vi-mode:*normal-keymap* "] i" 'lem-vi-mode/commands::vi-search-forward-symbol-at-point)
  )

The paredit mode will override the vi-mode bindings starts with [ and ]

  (lem-paredit-mode:paredit-mode t)

I would like to un-define the bindings that defined by paredit mode. Is there an easy way to do this ?

@cxxxr
Copy link
Member

cxxxr commented Nov 19, 2024

undefine-key is not yet implemented.
could you use override its commands with define-key?

@sakurawald
Copy link
Contributor Author

undefine-key is not yet implemented. could you use override its commands with define-key?

It seems like the paredit defines the [ and ] keys in paredit-mode-keymap, it is conflict with vi-normal keymap and vi-insert keymap.

(define-keys *paredit-mode-keymap*
('forward-sexp 'paredit-forward)
('backward-sexp 'paredit-backward)
("(" 'paredit-insert-paren)
("[" 'paredit-insert-bracket)
("{" 'paredit-insert-brace)
(")" 'paredit-close-parenthesis)
("]" 'paredit-close-bracket)
("}" 'paredit-close-brace)
("\"" 'paredit-insert-doublequote)
("|" 'paredit-insert-vertical-line)
('delete-previous-char 'paredit-backward-delete)
('delete-next-char 'paredit-forward-delete)
("C-k" 'paredit-kill)
("C-Right" 'paredit-slurp)
("C-Left" 'paredit-barf)
("M-s" 'paredit-splice)
("M-Up" 'paredit-splice-backward)
("M-Down" 'paredit-splice-forward)
("M-r" 'paredit-raise)
("M-(" 'paredit-wrap-round)
("M-|" 'paredit-vertical-line-wrap)
("M-\"" 'paredit-meta-doublequote))

I don't know how to override this.

@sakurawald
Copy link
Contributor Author

It would be good if there is a way to delete a key in a keymap

@sakurawald
Copy link
Contributor Author

I think i can just comment out these lines, and compile a custom version for myself.

@sakurawald sakurawald changed the title question: how to un-define keys defined by paredit mode. feature: the undefine-key function to delete an existing key in a keymap. Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants