From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:700:3204::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id oIjQFZNhnmWrQAEAkFu2QA (envelope-from ) for ; Wed, 10 Jan 2024 10:21:23 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id NFsCD5NhnmV6GgAAe85BDQ (envelope-from ) for ; Wed, 10 Jan 2024 10:21:23 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=positron.solutions header.s=google header.b=Ta2D+3J5; 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"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1704878483; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vbaL7kAw0qNKr4Ibnp8US+rwV/mCajV/YfKVzWH9SEA=; b=QrQWfFp8SvlVDBLqqEk4Gdcoq9F8/uvwuXwvzNrpMnqj5k7O1XkJv0Kr+d0Hhq2huSCk6T I1UwG6H5iGugurdtE3H+oGfxUpmWD0NeBXwp4/9XxwH2cFjRlrrp2R7AcS0JXAjfZhU8VN q919aYkdXmwLPNoi9v4plKy9LrEyOVctuXulSDoHI0AtwrmBrVlyX5KPgG7T4sFReIauNO Kkk01VyjyR8Vx21WSoA6NQRH5yXnpAOQPciIXG5JXL3IRLQYaWSACh5uMAIhAWVgJ78Vya 1avka0JHAtEqPdnLofGU3GCGjWf1lG9TYPNWdSh2WKxqznn35aTDcZxrDLySQg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1704878483; a=rsa-sha256; cv=none; b=gdPpBRpyd58E6vzMQQtzYIsWd+n7xnV/SuAOmsP6Cj9hzs2Yup2sGbYhXLBajOIQTD1kyN A5rTWkmkLGTYexJN+Uvv/jtaTF8R3A300sfxD4FRwNUIwYJ7rRPXMYzRmm7XObY8USkinO T4dpE+H3o8WjXH6LnQMj1joFZ59ghUxeMbc06/Vm9sOoaXS78cKDt0g4eS6Jqn/4iljaQc +nnn2HUx3y/ycFwpykE0R+3gymMgZQzPkvaXM/TGCK3btjXMAfT49RWJySCVnO1zRZnMWI tZP5bnqqY4/3CsBGCYXZabML2WgwkXj71w/8iEWHGdve1/JnEnG78jDTf0Q5Gg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=positron.solutions header.s=google header.b=Ta2D+3J5; 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"; dmarc=none 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 B393124878 for ; Wed, 10 Jan 2024 10:21:22 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNUl6-0002XG-7C; Wed, 10 Jan 2024 04:20:24 -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 1rNUl4-0002Wd-1M for emacs-orgmode@gnu.org; Wed, 10 Jan 2024 04:20:22 -0500 Received: from mail-yb1-xb2f.google.com ([2607:f8b0:4864:20::b2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNUl2-0004IS-CH for emacs-orgmode@gnu.org; Wed, 10 Jan 2024 04:20:21 -0500 Received: by mail-yb1-xb2f.google.com with SMTP id 3f1490d57ef6-dbd721384c0so2990285276.1 for ; Wed, 10 Jan 2024 01:20:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=positron.solutions; s=google; t=1704878418; x=1705483218; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=vbaL7kAw0qNKr4Ibnp8US+rwV/mCajV/YfKVzWH9SEA=; b=Ta2D+3J5zN/yZOw2XHlpReehILeVjl/bxTJ0QkJgduzj8rxWuDknJCys92PhJVm3TP 6vfPNwqEk7hvFkddpMxWMWO7lsc9dBE1Lw4LQxDhNw2Ld1wFErIE8K56eDcfMkIDBacc GW+9JogJKVePqVwjxFzd3B0kzwwucFJ75d/D8P5z+1KdHNGMeDEtQ3wMnxG8oHUMosF0 p1WSB8nZILJbBa6tk0M8lUw+LMWgHS5UiOXtGenjOGEkjkdeM5lvwAmPUCG2lmetLb0o bxUOi97LmDzS71M586xY0qC9NHEa0TAyjqOeRT+jQ8c133wtQPJVA12m1xrlU34SU0r6 LnxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704878418; x=1705483218; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=vbaL7kAw0qNKr4Ibnp8US+rwV/mCajV/YfKVzWH9SEA=; b=n+q55ZK2sAr8Uhv8va8/VVebg4zBHifT0m4JQhbhIU7AAvyq8R+aNWnDqJi06R7Q9E 9ss9Xhd01EPKxXUGgs7rMIccHzaV9lvxjmsgphkkZg2ReMa1uI4fG0cPTx10OVwrPOFT 7FhII9dCh/VOWA7beTjMwYnyVbSfHCwFk+HL1CjeNFpcyXqiUH6x0aGnN0U6yiRlO4nc EPmDtmFlQhhbHsYpbscHzgftcQ8zOun7ZdKy6R9pdjUhkUm61cvd3+Z930oIyL/7oiw/ 53fQhZ+Kypbo+C38ssLbjZA3TClLt3I1tgrYBjzcyy+eFHny7Cf3OdEsFaQlAujLDgrp LzKw== X-Gm-Message-State: AOJu0Yyf+t8JYJ8b/qEpFsBHj/7UMB4QG7GcayU7Jp5ubW6pml8mGQFt adLPd4JNW+oW+1Pnl68MHBMpERNMq7JZvPvBVpjEPPp+pDv1S9Jom6vjbvdKX0M= X-Google-Smtp-Source: AGHT+IFCwzcghe86m3QT0BLR5K4JWqpUMfG331HbLIRLDOclxht2L4phaEnNru/OWFYRV8anwe2GXxeCvq2XbzT+uv4= X-Received: by 2002:a05:6902:1686:b0:dbd:497a:f546 with SMTP id bx6-20020a056902168600b00dbd497af546mr654132ybb.0.1704878418242; Wed, 10 Jan 2024 01:20:18 -0800 (PST) MIME-Version: 1.0 From: Psionic K Date: Wed, 10 Jan 2024 18:20:07 +0900 Message-ID: Subject: [PATCH] Unindentation fixup for code blocks To: emacs-orgmode@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::b2f; envelope-from=exec@positron.solutions; helo=mail-yb1-xb2f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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: -7.01 X-Spam-Score: -7.01 X-Migadu-Queue-Id: B393124878 X-Migadu-Scanner: mx12.migadu.com X-TUID: fI6hKeh31mEJ 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. 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 org-current-text-indentation sets invisibility spec to nil temporarily. 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. --- lisp/org-macs.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 8def5cbb..0512cc48 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -408,13 +408,13 @@ 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 ((ind (org-current-text-indentation))) (cond ((< ind n) - (if (eolp) (delete-region (line-beginning-position) (point)) + (if (eolp) (delete-region (line-beginning-position) + (line-end-position)) (throw :exit nil))) (t (delete-region (line-beginning-position) - (progn (move-to-column n t) - (point))))) + (+ (line-beginning-position) n)))) (forward-line))) ;; Signal success. t)))) -- 2.42.0