emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Psionic K <psionik@positron.solutions>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Psionic K <psionik@positron.solutions>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] Unindentation fixup for code blocks
Date: Wed, 10 Jan 2024 22:55:52 +0900	[thread overview]
Message-ID: <CADQMGATV7JFOih+XNd-ytFwi9kfmfNQ6RT0vAS+rTT8g8GJNBQ@mail.gmail.com> (raw)
In-Reply-To: <877ckhqso8.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

> Would you also be able to create a reproducer, so that we can replicate
the problem and write a test?

Yeah, I just have to make some indentation text invisible.  Where
should such a test live?  Where is your documentation on running a
test?

> It looks like you did not send the patch with git send-emai.
Nope.  Magit patch create.  Attaching another patch.

> This math is not accurate when tabs are present.

You want to short circuit this kind of conversation.  I was not
actually aware of any tabs versus spaces aware functions to build on
top of since I always use spaces.  Had I not already found another way
to correct the behavior, this would have been a dead-end I would have
had to round trip.

I'm presuming tests don't get their own changelog entries.  Is that correct?

[-- Attachment #2: 0001-org-macs.el-org-do-remove-indentation-correction.patch --]
[-- Type: text/x-patch, Size: 1224 bytes --]

From 965b60f58512b009778b7b5279394bf01d407c3f Mon Sep 17 00:00:00 2001
From: Psionik K <73710933+psionic-k@users.noreply.github.com>
Date: Wed, 10 Jan 2024 22:37:28 +0900
Subject: [PATCH] org-macs.el: org-do-remove-indentation correction

* lisp/org-macs.el (org-do-remove-indentation): set
`buffer-invisibility-spec' to nil before detecting the column or
moving to a column.

This fixes src_block indentation removal for org-modern-mode but will
also correct other cases of hidden indentation.
---
 lisp/org-macs.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 8def5cbb..7f5d2ad8 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -408,7 +408,8 @@ line.  Return nil if it fails."
 	;; Remove exactly N indentation, but give up if not possible.
         (when skip-fl (forward-line))
 	(while (not (eobp))
-	  (let ((ind (progn (skip-chars-forward " \t") (current-column))))
+	  (let* ((buffer-invisibility-spec nil)
+                 (ind (progn (skip-chars-forward " \t") (current-column))))
 	    (cond ((< ind n)
                    (if (eolp) (delete-region (line-beginning-position) (point))
                      (throw :exit nil)))
-- 
2.42.0


  reply	other threads:[~2024-01-10 13:56 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
2024-01-10 13:55   ` Psionic K [this message]
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=CADQMGATV7JFOih+XNd-ytFwi9kfmfNQ6RT0vAS+rTT8g8GJNBQ@mail.gmail.com \
    --to=psionik@positron.solutions \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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).