Hi,
My config for Emacs before switching to rde consisted entirely of
`setopt` instead of `setq`, and `define-keymap` instead of `define-key`,
so when I switched, I rewrote the features I needed. There are
practically no differences from the upstream rde, so it would be better
for me to make updates in the rde repository.
setopt and keymap.el appeared in Emacs 29.1, because of this it is not
possible to use the config with earlier versions.
1) keymap.el
Example:
--8<---------------cut here---------------start------------->8---
(let ((map goto-map))
(define-key map (kbd "g") 'consult-goto-line)
(define-key map (kbd "M-g") 'consult-goto-line)
(define-key map (kbd "l") 'consult-line)
(define-key map (kbd "o") 'consult-outline)
(define-key map (kbd "i") 'consult-imenu)
(define-key map (kbd "m") 'consult-mark)
(define-key map (kbd "M") 'consult-global-mark)
(define-key map (kbd "b") 'consult-bookmark))
can be rewritten as follows:
(define-keymap
:keymap goto-map
"g" 'consult-goto-line
"l" 'consult-line
"o" 'consult-outline
"i" 'consult-imenu
"m" 'consult-mark
"M" 'consult-global-mark
"b" 'consult-bookmark
"M-g" 'consult-goto-line)
--8<---------------cut here---------------end--------------->8---
2) setopt - this is like ‘setq’, but is meant for user options instead of
plain variables.
keymap.el is already in fact a standard, setopt is exactly what you
should use with defcustoms. That's all my arguments for now, what do you
think?
--
Best regards,
Aleksandr Vityazev
On 2024-09-17 22:22, Aleksandr Vityazev wrote:
> Hi,
>
> My config for Emacs before switching to rde consisted entirely of
> `setopt` instead of `setq`, and `define-keymap` instead of `define-key`,
> so when I switched, I rewrote the features I needed. There are
> practically no differences from the upstream rde, so it would be better
> for me to make updates in the rde repository.
>
> setopt and keymap.el appeared in Emacs 29.1, because of this it is not
> possible to use the config with earlier versions.
>
> 1) keymap.el
> Example:
> --8<---------------cut here---------------start------------->8---
>
> (let ((map goto-map))
> (define-key map (kbd "g") 'consult-goto-line)
> (define-key map (kbd "M-g") 'consult-goto-line)
> (define-key map (kbd "l") 'consult-line)
> (define-key map (kbd "o") 'consult-outline)
> (define-key map (kbd "i") 'consult-imenu)
> (define-key map (kbd "m") 'consult-mark)
> (define-key map (kbd "M") 'consult-global-mark)
> (define-key map (kbd "b") 'consult-bookmark))
>
> can be rewritten as follows:
>
> (define-keymap
> :keymap goto-map
> "g" 'consult-goto-line
> "l" 'consult-line
> "o" 'consult-outline
> "i" 'consult-imenu
> "m" 'consult-mark
> "M" 'consult-global-mark
> "b" 'consult-bookmark
> "M-g" 'consult-goto-line)
> --8<---------------cut here---------------end--------------->8---
>
> 2) setopt - this is like ‘setq’, but is meant for user options instead of
> plain variables.
>
> keymap.el is already in fact a standard, setopt is exactly what you
> should use with defcustoms. That's all my arguments for now, what do you
> think?
Agree on both. I already started to use setopt and keymaps in the new
code. Migrating the old one to new API also make sense.
Feel free to update features, which still use old API.
--
Best regards,
Andrew Tropin