From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mN6JMesLomIz7gAAbAwnHQ (envelope-from ) for ; Thu, 09 Jun 2022 17:04:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id oD9JMesLomLaVAEAauVa8A (envelope-from ) for ; Thu, 09 Jun 2022 17:04:11 +0200 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 5B5192D6A5 for ; Thu, 9 Jun 2022 17:04:11 +0200 (CEST) Received: from localhost ([::1]:60358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzJhh-0007ZH-Ug for larch@yhetil.org; Thu, 09 Jun 2022 11:04:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzI9v-0005VR-3K for emacs-orgmode@gnu.org; Thu, 09 Jun 2022 09:25:11 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:53805) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzI9h-00013j-Lx for emacs-orgmode@gnu.org; Thu, 09 Jun 2022 09:25:10 -0400 Received: by mail-pj1-x1036.google.com with SMTP id a10so21338961pju.3 for ; Thu, 09 Jun 2022 06:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=KIpBzwXcV105hmbgF2bXXqhmNYfEKiLw83dAmv93SJc=; b=gi3oxsE1oZJynXZjjJNdb6TnfCt4ysxM2DgCNDeGQvQR6uGe5LGOcR2d/77C7NqmcL puZUO/6ijgah++bu2YVjGAHGArI40iV2xa3UFllyR/fWvXn/jNZGOg7zpLYsgDYp6dgD BZ+rOdllirfViHfFaNiWVU1XJWinZMexZCjqCL9z+OiALfRtcKDhZB8VbgHMaNG+S5gB M4YfUW3X+3za6q4bQhyQsmsX2EIdByCKs9+HG4dUEsYLE0TOR2Uw11DuaVrEOA7Z8uTv 3z+Wp68rcFEyjkagTrxMWAFXRr8dntMJC2K41MQAfEPI9hA2AFZWXmdOCNywhLlIcIil cLjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=KIpBzwXcV105hmbgF2bXXqhmNYfEKiLw83dAmv93SJc=; b=I6K4RgCHdpjC6Yt2vcJ4HZlPttyrxibCvu+guSLmcPVgh4nwyB8xIxIFfuZzDqsGms uLbtvk3Cit0YLue9HgUlT+4X7n7iViiFqGYokMeY7bSzH1yIe84s/I6sOhBRW9Qa89kl Jl8/wp7yqSK9h34nUThjU3Q5FUruZJfkMqM0Dinh+Oyit7gQAZTnkbjRZXoYy0wIYdRg mXaTKVfYVTzl4hLG85gY9UYZdv3BHVuatesnd3NqQiULgdWe9/5+iksffPLemMIGnwQ8 Zbsd1JsRpCA35r+3EOoO9ybUbCd3AEtc1ZuNpBCK5ngpxK/MHl5bhyrug483lqn7TE5b JSGA== X-Gm-Message-State: AOAM532K4ruXm1784875P/FFzzma5FH2ymqUAraYDocnZzEognSRKB8J jM9anowhD9MCAEkKQJdoyukwCEaXam7b/g== X-Google-Smtp-Source: ABdhPJwff5uwkZGFvPPbvOdapL+oPlE6lSd6Q/gIzh6s4/gHjunkB3FfUGI61+hcnz/11ZghduNBgQ== X-Received: by 2002:a17:902:7594:b0:15e:bbac:8d49 with SMTP id j20-20020a170902759400b0015ebbac8d49mr39024983pll.124.1654781096230; Thu, 09 Jun 2022 06:24:56 -0700 (PDT) Received: from localhost ([64.32.23.62]) by smtp.gmail.com with ESMTPSA id f11-20020aa7968b000000b0051b90ac6c15sm17485000pfk.125.2022.06.09.06.24.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 06:24:55 -0700 (PDT) From: Ihor Radchenko To: Bodertz Cc: emacs-orgmode@gnu.org Subject: [PATCH v2] Bug: Indenting empty description list item leaves point at beginning of line [9.4.4] In-Reply-To: <87ilxku6lk.fsf@gmail.com> References: <87o88hlkvv.fsf@gmail.com> <87y27bwvnc.fsf@localhost> <87lf2h9qj2.fsf@localhost> <87ilxku6lk.fsf@gmail.com> Date: Thu, 09 Jun 2022 21:25:34 +0800 Message-ID: <878rq6hstt.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1036.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1654787051; 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=KIpBzwXcV105hmbgF2bXXqhmNYfEKiLw83dAmv93SJc=; b=SjX+2lTb1jcBVoaRjTWa6/+uh8M0ye4+ZX8F373XiJYhTu/FB3AvWHk7q2mir5QZK4F/7f 3FYVouDxkqCdSC/o4oWVowqzS4ZoyD2E17yQfJAV7SmAbyMUQlWhN+uqEgijBwK4ZwI/il Xrx7W846VSGH6iKK7TClSo7AsFeNxBRqvkB0BKi7aQS+WLLJwLQuxvK95RsaJyc1uW1cOT eaPgcYNDrQbs7lCLzgdBhQBNqFyjJy6YVUxVeW/YvJgKx3XEnxlwdnBUqlJfe9GmpPdpKT 6Vn5IjB5383BVYgcff3PT5EkAXu9OMgBd3UDk8DyCv9l0G1bWYZMd4xK+L7UPw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654787051; a=rsa-sha256; cv=none; b=kQWPrEjWC9Gk2Z95N1mjBQw3eMVcagGaAcSyEKax+3uJTI0zpkLIvQq7RgiXjbMWuaSlvE 92j6ixuF08tSjXVvTx/ZxPPd3XFmcVlB91t+ofWvILV/YYaUw1cJri+5/X6EPyQzNtcKR6 jTu0ryLvhJzB6QKjOeZ/oZsGH3e7KHVA0ENOo4tgBTmNt8wkS4BDiKinq4fqyeeSVWI1LP 3vnXS/7u6EJeE+uoshUjvMj3M/imBcIRj5I73ILA91hF4JuOZnIC3wqAMol87VrMEGx++r BUKgPFvKZUDnimOxO2hrqP5N4v96ZkkP6L+T/ln/iojBzHZMFjpT5Q2cpw6FsA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=gi3oxsE1; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Spam-Score: -7.00 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=gi3oxsE1; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Queue-Id: 5B5192D6A5 X-Spam-Score: -7.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: qxCXe2k8+aJ7 --=-=-= Content-Type: text/plain Bodertz writes: > Apologies, I wasn't aware you were asking for feedback. > > The issue I described no longer occurs. > > However, there is still a minor issue with the proposed fix. > > After creating a new empty description list item by pressing {M-RET} > after a description list item, the item created is the following: > Thanks for letting me know and sorry for the late reply. This patch has been sunk in the depths of the todo list. I have updated the patch to address your concern. See the attached. Best, Ihor --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-list-Do-not-move-point-and-change-space-when-pro.patch >From 86f4e9b1bec488a420b28b91e3813a2cd74d586f Mon Sep 17 00:00:00 2001 Message-Id: <86f4e9b1bec488a420b28b91e3813a2cd74d586f.1654781017.git.yantar92@gmail.com> From: Ihor Radchenko Date: Sat, 2 Oct 2021 18:32:34 +0800 Subject: [PATCH] org-list: Do not move point and change space when promoting/demoting items * lisp/org-list.el (org-list-struct-apply-struct): Make sure the origin marker is not moved to bol when promoting/demoting item in special case: - item - :: Do not remove the trailing space after point as well. (org-insert-item): Do not expect point to remain at bol after writing list struct. * testing/lisp/test-org-list.el (test-org-list/indent-item): Add test Fixes https://orgmode.org/list/87o88hlkvv.fsf@gmail.com --- lisp/org-list.el | 15 ++++++++++++++- testing/lisp/test-org-list.el | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index 515763036..97d856fc9 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -1940,7 +1940,19 @@ (defun org-list-struct-apply-struct (struct old-struct) (looking-at org-list-full-item-re) ;; a. Replace bullet (unless (equal old-bul new-bul) - (replace-match new-bul nil nil nil 1)) + (let ((keep-space "")) + (save-excursion + ;; If origin is inside the bullet, preserve the + ;; spaces after origin. + (when (<= (match-beginning 1) origin (match-end 1)) + (org-with-point-at origin + (save-match-data + (when (looking-at "[ \t]+") + (setq keep-space (match-string 0)))))) + (replace-match "" nil nil nil 1) + (goto-char (match-end 1)) + (insert-before-markers new-bul) + (insert keep-space)))) ;; b. Replace checkbox. (cond ((equal (match-string 3) new-box)) @@ -2286,6 +2298,7 @@ (defun org-insert-item (&optional checkbox) (setq struct (org-list-insert-item pos struct prevs checkbox desc)) (org-list-write-struct struct (org-list-parents-alist struct)) (when checkbox (org-update-checkbox-count-maybe)) + (beginning-of-line) (looking-at org-list-full-item-re) (goto-char (if (and (match-beginning 4) (save-match-data diff --git a/testing/lisp/test-org-list.el b/testing/lisp/test-org-list.el index bc8faa672..d3e6fc176 100644 --- a/testing/lisp/test-org-list.el +++ b/testing/lisp/test-org-list.el @@ -298,7 +298,21 @@ (ert-deftest test-org-list/indent-item () (push-mark (point) t t) (goto-char (point-max)) (let (org-list-demote-modify-bullet) (org-indent-item)) - (buffer-string))))) + (buffer-string)))) + ;; When point is right after empty item, do not move point. + (should + (= 13 + (org-test-with-temp-text " +- item +- ::" + (org-indent-item) + (point)))) + ;; Preserve space after point upon promoting level. + (org-test-with-temp-text " +- item +- ::" + (org-indent-item) + (should (looking-at-p " \t")))) (ert-deftest test-org-list/indent-item-tree () "Test `org-indent-item-tree' specifications." -- 2.35.1 --=-=-=--