emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Okamsn <okamsn@protonmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] `org-delete-char` and `org-delete-backward-char` don't respect `delete-active-region`
Date: Wed, 19 Jul 2023 12:44:37 +0000	[thread overview]
Message-ID: <87jzuwyssq.fsf@localhost> (raw)
In-Reply-To: <684fb4d3-9653-bc06-de72-b22fcbd51b3d@protonmail.com>

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>


      reply	other threads:[~2023-07-19 12:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzuwyssq.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=okamsn@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).