From: Ihor Radchenko <yantar92@posteo.net>
To: Psionic K <psionik@positron.solutions>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Unindentation fixup for code blocks
Date: Wed, 10 Jan 2024 12:28:07 +0000 [thread overview]
Message-ID: <877ckhqso8.fsf@localhost> (raw)
In-Reply-To: <CADQMGASvOR3VvLFEe_5VDFP3=hC_xpvoLPubN5eC1YNtOZWKZQ@mail.gmail.com>
Psionic K <psionik@positron.solutions> writes:
> When cleaning up hard indentation, I found my source blocks remaining indented.
>
> The way that org-do-remove-indentation is sensitive to invisible text.
> This occurs for source blocks whenever using org-modern-mode, where it
> makes the source blocks align left.
Thanks for the patch!
Would you also be able to create a reproducer, so that we can replicate
the problem and write a test?
> By swapping out the arithmetic and expressions that relied on
> current-column, the behavior is fixed.
>
> There are several behaviors I only just found, so I don't expect a lot
> of precision in my fix, but the patch I came up with follows:
>
> From 858077f0d2a7f4cd8699948229c2965f0c6bb0a1 Mon Sep 17 00:00:00 2001
> From: Psionik K <73710933+psionic-k@users.noreply.github.com>
> Date: Wed, 10 Jan 2024 18:05:53 +0900
> Subject: [PATCH] when removing indentation, take into account invisible text
It looks like you did not send the patch with git send-email (this email
patch does not apply with git). It might be easier if you simply attach
the patch to email.
> One behavioral difference is that the point is no longer moved
> forward. Therefore, arithmetic is used instead of (current-column)
> based math. (current-column) is inaccurate when moving the point
> through invisible text.
If you can, please add changelog entries to the commit message. See
https://orgmode.org/worg/org-contribute.html#org77afce2
> - (progn (move-to-column n t)
> - (point)))))
> + (+ (line-beginning-position) n))))
This math is not accurate when tabs are present.
--
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>
next prev parent reply other threads:[~2024-01-10 12:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 9:20 [PATCH] Unindentation fixup for code blocks Psionic K
2024-01-10 12:28 ` Ihor Radchenko [this message]
2024-01-10 13:55 ` Psionic K
2024-01-10 15:45 ` Ihor Radchenko
2024-01-21 12:04 ` Ihor Radchenko
2024-03-12 12:26 ` Ihor Radchenko
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=877ckhqso8.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=psionik@positron.solutions \
/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).