[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug] deleting backward char does not do undo-boundary
From: |
Kyle Meyer |
Subject: |
Re: [bug] deleting backward char does not do undo-boundary |
Date: |
Sat, 22 Aug 2020 00:17:08 -0400 |
Samuel Wales writes:
> here is my code to try to fix it [note that i fix teh rest of emacs 25
> also]. but that one command does not accept the undo-boundary that i
> call. i do not udnerstand why this is the case.
Without looking at this too closely, I'd guess it's because ...
> (define-key org-mode-map [remap org-delete-backward-char]
> #'alpha-org-delete-backward-char)
> (define-key org-mode-map [remap org-delete-char] #'alpha-org-delete-char)
> (defun alpha-org-delete-char () (interactive)
> (alpha-wrap-with-undo-boundary 'org-delete-char))
> (defun alpha-org-delete-backward-char () (interactive)
> (alpha-wrap-with-undo-boundary 'org-delete-backward-char))
... you're trying to remap a command that is itself remapping a command.
(info "(elisp)remapping commands")
In addition, remapping only works through a single level; in the
following example,
(define-key my-mode-map [remap kill-line] 'my-kill-line)
(define-key my-mode-map [remap my-kill-line] 'my-other-kill-line)
‘kill-line’ is _not_ remapped to ‘my-other-kill-line’. Instead, if
an ordinary key binding specifies ‘kill-line’, it is remapped to
‘my-kill-line’; if an ordinary binding specifies ‘my-kill-line’, it
is remapped to ‘my-other-kill-line’.
Perhaps just bind it directly?
(define-key org-mode-map (kbd "DEL") #'alpha-org-delete-backward-char)