* [BUG] `org-delete-char` and `org-delete-backward-char` don't respect `delete-active-region`
@ 2023-06-18 18:31 Okamsn
2023-06-21 10:14 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Okamsn @ 2023-06-18 18:31 UTC (permalink / raw)
To: emacs-orgmode
Hello,
I use Meow, which combines movement and making selections, and have
`delete-active-region` set to `nil`. Because Meow creates regions
frequently, it recommends not having the deletion commands delete the
active region.
This works when `delete` is bound to `forward-delete-char` and
`backspace` is bound to `backward-delete-char-untabify`, because both
commands respect `delete-active-region`.
This does not work with `org-delete-backward-char` or `org-delete-char`,
because those commands use `delete-char`, which does not respect
`delete-active-region`.
This is in Org version 9.6.6.
Thank you.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] `org-delete-char` and `org-delete-backward-char` don't respect `delete-active-region`
2023-06-18 18:31 [BUG] `org-delete-char` and `org-delete-backward-char` don't respect `delete-active-region` Okamsn
@ 2023-06-21 10:14 ` Ihor Radchenko
2023-06-22 1:56 ` Okamsn
0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2023-06-21 10:14 UTC (permalink / raw)
To: Okamsn; +Cc: emacs-orgmode
Okamsn <okamsn@protonmail.com> writes:
> `org-delete-char` and `org-delete-backward-char` don't respect
> `delete-active-region`
Clarification first.
`org-delete-char' and `org-delete-backward-char' are not supposed to
respect `delete-active-region'. They are the replacements for
`delete-char' and `delete-backward-char' that also do not respect it.
Org only re-binds `delete-char' and `delete-backward-char'.
> This works when `delete` is bound to `forward-delete-char` and
> `backspace` is bound to `backward-delete-char-untabify`, because both
> commands respect `delete-active-region`.
>
> This does not work with `org-delete-backward-char` or `org-delete-char`,
> because those commands use `delete-char`, which does not respect
> `delete-active-region`.
May you please explain what exactly you did? Or meow did? Did it bind
the Org functions inappropriately? Or are you asking to add new Org
commands that respect `delete-active-region'?
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] `org-delete-char` and `org-delete-backward-char` don't respect `delete-active-region`
2023-06-21 10:14 ` Ihor Radchenko
@ 2023-06-22 1:56 ` Okamsn
2023-07-19 12:44 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Okamsn @ 2023-06-22 1:56 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
On 2023-06-21 10:14 UTC, Ihor Radchenko wrote:
> Okamsn <okamsn@protonmail.com> writes:
>
>> `org-delete-char` and `org-delete-backward-char` don't respect
>> `delete-active-region`
>
> Clarification first.
> `org-delete-char' and `org-delete-backward-char' are not supposed to
> respect `delete-active-region'. They are the replacements for
> `delete-char' and `delete-backward-char' that also do not respect it.
> Org only re-binds `delete-char' and `delete-backward-char' >
>> This works when `delete` is bound to `forward-delete-char` and
>> `backspace` is bound to `backward-delete-char-untabify`, because both
>> commands respect `delete-active-region`.
>>
>> This does not work with `org-delete-backward-char` or `org-delete-char`,
>> because those commands use `delete-char`, which does not respect
>> `delete-active-region`.
>
> May you please explain what exactly you did? Or meow did? Did it bind
> the Org functions inappropriately? Or are you asking to add new Org
> commands that respect `delete-active-region'?
Thank you for the clarification. In my config, I had remapped
`delete-char` to `delete-forward-char` years ago and I had forgotten
that I did that. In Emacs 29, I see in the definition of
`delete-backward-char` that this command _does_ respect
`delete-active-region`, and that `delete-char` does not respect this
setting.
Meow only sets `delete-active-region` to nil. It does not bind any Org
commands. I only mentioned it to give context. My apologies for any
confusion.
With your clarification, I am asking that Org commands be added/changed
to support `delete-active-region`.
Thank you.
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] `org-delete-char` and `org-delete-backward-char` don't respect `delete-active-region`
2023-06-22 1:56 ` Okamsn
@ 2023-07-19 12:44 ` Ihor Radchenko
0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2023-07-19 12:44 UTC (permalink / raw)
To: Okamsn; +Cc: emacs-orgmode
Okamsn <okamsn@protonmail.com> writes:
> With your clarification, I am asking that Org commands be added/changed
> to support `delete-active-region`.
Maybe something like below? (100% untested)
(defun org-delete-forward-char (N)
"Like `delete-forward-char', insert whitespace at field end in tables.
When deleting, in tables this function will insert whitespace in front
of the previous \"|\" separator, to keep the table aligned. The table
will still be marked for re-alignment if the field did fill the entire
column, because, in this case the deletion might narrow the column."
(interactive "p")
(save-match-data
(if (and (= N 1)
(not overwrite-mode)
(not (org-region-active-p))
(not (eq (char-after) ?|))
(looking-at-p ".*?|")
(org-at-table-p))
(org-delete-char 1)
(funcall-interactively #'delete-forward-char N)
(org-fix-tags-on-the-fly))))
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-19 12:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-18 18:31 [BUG] `org-delete-char` and `org-delete-backward-char` don't respect `delete-active-region` Okamsn
2023-06-21 10:14 ` Ihor Radchenko
2023-06-22 1:56 ` Okamsn
2023-07-19 12:44 ` Ihor Radchenko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.