From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id iO9FH9cHrWXtAQAA62LTzQ:P1 (envelope-from ) for ; Sun, 21 Jan 2024 13:02:31 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id iO9FH9cHrWXtAQAA62LTzQ (envelope-from ) for ; Sun, 21 Jan 2024 13:02:31 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="YOo2/0Ry"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1705838551; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=+2JIBoE/NRVn+Ju9CYbFI/4K7SZQB3UMSF4lFm88ghs=; b=Xsk1smvALPaxhzHqxM91MbCvRGXrzHDwzZQnPkfhHb8yCxAU/d5oR93vvGPn+v7IHMQmA5 IUEmg/Er6xp003X+NoFrS1wksiNNDBtKQYeO71eGJ5Icrswnp06t/zCDgjmfXnulUCkKWr J+0eehZpsic5e8C71Ny+bX1f86UhLqOApg60HqhNYsqxo74PmtTa576ovtJhx7nVFA8jUS M3J9wCK3TJY29EEYWIeySuvGxkdnF0LN4XS/Qf4yJsZi+1Q41hLiNq3J5vPXUPwhIOAj5V rAgmhMWZI53bAXLK9qnvJnD1nJDq6dLxrbdLVtRZZd7AyOM5prcax75DgAoV+g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="YOo2/0Ry"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705838551; a=rsa-sha256; cv=none; b=k2cLdppu0gOWCFtH+d4XnL8ybkoCVKHMiNVeBptojH/m4YjVBPaLc44F5NExiAQ5jMVN1Z iHbgdZ7tDRw80sG0hXa5EecSU6j/XhCzgXRQJKclesp0+5ZtT8fDu0NZu8+QOTvK5g/v1Y QFEIMW9qKkOUZ+O5+0V/A6bkHB7Nz72MNqJ6nqBc18gASEitGctPiDfNQyGZ6sgwu1AuWZ ZLELJ/jclYr/5Md66y6QQnUOqxVci7+gjz+kcQVHd3BTulINcH90FjYEiEww/IV94SczWA p64+cVMytfxw2XoQUI52OyiuaOeQIM4iAWFGH+W1vuNo8rza6utY/SjO43IUgA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4F4752728C for ; Sun, 21 Jan 2024 13:02:30 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRWWJ-000634-FN; Sun, 21 Jan 2024 07:01:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rRWWI-00062w-5P for emacs-orgmode@gnu.org; Sun, 21 Jan 2024 07:01:46 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rRWWF-0005ub-6j for emacs-orgmode@gnu.org; Sun, 21 Jan 2024 07:01:45 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 4B296240027 for ; Sun, 21 Jan 2024 13:01:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1705838496; bh=7oSFEktN//f5lqpGn3TwzfXXMC72RIUNsvvjvreRdw8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=YOo2/0RylRPAmubVJHIgYPGGrPjtYMRdKiGsxuvA8qEsOldJO/MceHJfbL73ZcB7X f4vTvF62oPXicBFbsvDmadI9mjRFRDzIBGRbOovomail53B/raQtSEXvEAzzOKglBK CqVZXOo6Mcw9Fm5Mb6Ie5mc4uaoZ9Mg0Sa1x4/woJQyBgdDcSIG4IaNpGG9tD6idae VvJB8Z7INjjY4fzEg9mhlWx0qiNoait+rCd+oNj5kz073d+1APjDxdp9xDIIVhejMZ exIMXE4VLvgsNTaZMrF2EZWUHfNFnBJkMu2k8VKeZowASszO496HjapTB/X73gAOAL GT9dQCxr62NfQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4THsQR2X9qz6tyG; Sun, 21 Jan 2024 13:01:34 +0100 (CET) From: Ihor Radchenko To: Psionic K Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Unindentation fixup for code blocks In-Reply-To: <87o7dtkx8r.fsf@localhost> References: <877ckhqso8.fsf@localhost> <87o7dtkx8r.fsf@localhost> Date: Sun, 21 Jan 2024 12:04:53 +0000 Message-ID: <874jf6hoyi.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -8.39 X-Spam-Score: -8.39 X-Migadu-Queue-Id: 4F4752728C X-Migadu-Scanner: mx12.migadu.com X-TUID: 0A5ar+8M2pFg --=-=-= Content-Type: text/plain Ihor Radchenko writes: > Thanks! This patch does apply. > I am not yet sure if I like this patch or the previous one more. I am > thinking about combining them and implementing something like > `org-move-to-text-column'. I do not see immediate use of `org-move-to-text-column', so let's keep things simple. I am attaching an amended patch with modified commit message and docstring describing the invisible text is accounted as visible. I also added TINYCHANGE cookie as you do not appear to have FSF copyright assignment. Let me know if you want to make any changes to the new version of the patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=v2-0001-org-do-remove-indentation-Ignore-invisible-text.patch >From b7eb76647395eac256602bdecaab4aea3ffbe68c Mon Sep 17 00:00:00 2001 Message-ID: From: Psionik K <73710933+psionic-k@users.noreply.github.com> Date: Wed, 10 Jan 2024 22:37:28 +0900 Subject: [PATCH v2] org-do-remove-indentation: Ignore invisible text * 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. TINYCHANGE --- lisp/org-macs.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 8def5cbb2..fc4fd7975 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -388,6 +388,8 @@ (defmacro org-current-text-indentation () (defun org-do-remove-indentation (&optional n skip-fl) "Remove the maximum common indentation from the buffer. +Do not consider invisible text when calculating indentation. + When optional argument N is a positive integer, remove exactly that much characters from indentation, if possible. When optional argument SKIP-FL is non-nil, skip the first @@ -408,7 +410,8 @@ (defun org-do-remove-indentation (&optional n skip-fl) ;; 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) ; do not treat invisible text specially + (ind (progn (skip-chars-forward " \t") (current-column)))) (cond ((< ind n) (if (eolp) (delete-region (line-beginning-position) (point)) (throw :exit nil))) -- 2.43.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--