Skip to content

fix :bind-keymap symbol evaluation #542

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

Open
conao3 opened this issue Aug 30, 2024 · 0 comments
Open

fix :bind-keymap symbol evaluation #542

conao3 opened this issue Aug 30, 2024 · 0 comments

Comments

@conao3
Copy link
Owner

conao3 commented Aug 30, 2024

Description

Maybe Too early to evaluate symbols.
The current behavior is trying to set the key-map itself bound to the symbol, not the symbol of the keymap, so it will not work correctly when added to the keymap afterwards.

Issue leaf-block

(leaf project
  :doc "Operations on the current project"
  :tag "builtin"
  :added "2024-08-30"
  :bind-keymap (("C-x C-p" . project-prefix-map)))

become

(leaf-key-bind-keymap "C-x C-p" project-prefix-map nil 'project)

become

(progn
      (require 'project)
      (leaf-key "C-x C-p" project-prefix-map nil))

become

(let*
          ((old (lookup-key global-map (kbd "C-x C-p")))
           (value
            `(global-map "C-x C-p" nil
                         ,(and old (not (numberp old)) old)
                         "/Users/conao/dev/repo/dotfiles/.dotfiles/.emacs.d/lisp/c--builtin.el")))
        (leaf-safe-push value leaf-key-bindlist)
        (define-key global-map (kbd "C-x C-p")
                    '(keymap (109 . magit-project-status)
                             (2 . project-list-buffers)
                             (111 . project-any-command)
                             (120
                              . project-execute-extended-command)
                             (114 . project-query-replace-regexp)
                             (71
                              . project-or-external-find-regexp)
                             (103 . project-find-regexp)
                             (112 . project-switch-project)
                             (107 . project-kill-buffers)
                             (101 . project-eshell)
                             (99 . project-compile)
                             (118 . project-vc-dir)
                             (68 . project-dired)
                             (100 . project-find-dir)
                             (115 . project-shell)
                             (98 . project-switch-to-buffer)
                             (70 . project-or-external-find-file)
                             (102 . project-find-file)
                             (38 . project-async-shell-command)
                             (33 . project-shell-command))))

Expected output from macroexpand-1 of the leaf-block

(define-key global-map (kbd "C-x C-p") project-prefix-map)
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

1 participant