From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id INpwIWOo0V7zMwAA0tVLHw (envelope-from ) for ; Sat, 30 May 2020 00:27:15 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id kJltHWOo0V69QwAAB5/wlQ (envelope-from ) for ; Sat, 30 May 2020 00:27:15 +0000 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 84439940390 for ; Sat, 30 May 2020 00:27:13 +0000 (UTC) Received: from localhost ([::1]:47470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jepLE-0006gT-HB for larch@yhetil.org; Fri, 29 May 2020 20:27:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jepKn-0006e4-4h for emacs-orgmode@gnu.org; Fri, 29 May 2020 20:26:45 -0400 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21182) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jepKm-0001tE-CV for emacs-orgmode@gnu.org; Fri, 29 May 2020 20:26:44 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1590798401; cv=none; d=zohomail.com; s=zohoarc; b=YlpUynRO0MtABAFYI5hof9ynKJLZ6sBD2kl0KZKRrhtBWE0TO3nTuSXPjAESV/HUnx31g819msdIe6ocaIsz8J9RYakkB/BrD+ksyHMZpc9fH/NjAOcM08urfwLho/MvrhzcIVRwxiAyj+pqahL+Kv+S7E4l8S2xRhbxHYtTEhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590798401; h=Content-Type:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ejPMu5qvv+0HgVnGG/4cLkcoSodl1o+cm5/UKNsD2mM=; b=j8zBqVqJU0XgHQi1t7MXMuqhriSn203LJYHVjkz6QZOfW30SP50RSfwV+iRhEjlrKG4VKnC0yn0hncjBknq/FHUlqakcWO73D6XvgmnJNBvRV+74FsNT8kNyJqvAGBBNECab7bt44HTiSVFfuMNWZQK6BoJGM0UJdpgoeA/mtv8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=nivekuil.com; spf=pass smtp.mailfrom=kevin@nivekuil.com; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1590798401; s=mail; d=nivekuil.com; i=kevin@nivekuil.com; h=References:From:To:Subject:In-reply-to:Date:Message-ID:MIME-Version:Content-Type; bh=ejPMu5qvv+0HgVnGG/4cLkcoSodl1o+cm5/UKNsD2mM=; b=j3VepBIXbuR73+usGND/lZXZE1UdPLjY/7efcfZ0RH4YVo8cluhqxMjZGFic0N2n iCiRXquYqDQz+MvW3o0DbKzIYyrP/Hf9SPmCcz+fts+30sNqLYTT3uujTAeghW4bhS9 LQaJ6HyTHdhe+8TaT7l01FR2RkeKeMhW8vwUmqzI= Received: from machina (71.212.158.154 [71.212.158.154]) by mx.zohomail.com with SMTPS id 1590798400069829.9562979421222; Fri, 29 May 2020 17:26:40 -0700 (PDT) References: <87v9keclqv.fsf@nivekuil.com> User-agent: mu4e 1.5.1; emacs 27.0.91 From: Kevin Liu To: emacs-orgmode@gnu.org Subject: Re: [PATCH] Fix org-capture-place-entry narrow bounds In-reply-to: <87v9keclqv.fsf@nivekuil.com> Date: Fri, 29 May 2020 17:26:39 -0700 Message-ID: <87sgficlog.fsf@nivekuil.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-ZohoMailClient: External X-Zoho-Virus-Status: 1 Received-SPF: none client-ip=136.143.188.51; envelope-from=kevin@nivekuil.com; helo=sender4-of-o51.zoho.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/29 20:25:17 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, T_DKIM_INVALID=0.01, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 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-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none (invalid DKIM record) header.d=nivekuil.com header.s=mail header.b=j3VepBIX; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -2.01 X-TUID: ymqMoHHq7OeG --=-=-= Content-Type: text/plain Sorry, corrected patch format: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-capture-Fix-org-capture-place-entry-narrow-bounds.patch >From 8e7b28054492424170f14f11297b416ef7575540 Mon Sep 17 00:00:00 2001 From: nivekuil Date: Fri, 29 May 2020 16:48:31 -0700 Subject: [PATCH] capture: Fix org-capture-place-entry narrow bounds * lisp/org-capture.el (org-capture-place-entry): Prevent breaking the following headline inside the capture buffer. This should match the behavior from 9.3. (org-capture-finalize): Reverts cb2774d1a, which solves a similar problem but only in the finalize stage, so the subtree structure would still be broken in the middle of editing the capture. --- lisp/org-capture.el | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 9136d331b..4d2c3e8d4 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -728,16 +728,6 @@ captured item after finalizing." (run-hooks 'org-capture-prepare-finalize-hook) - ;; Fix missing final newline, as it may have been deleted by accident - (when (eq (org-capture-get :type 'local) 'entry) - (save-excursion - (goto-char (point-max)) - (and (not (looking-at-p "^")) - (org-with-wide-buffer - (and (not (looking-at-p org-heading-regexp)) - (not (eobp)))) - (insert "\n")))) - ;; Did we start the clock in this capture buffer? (when (and org-capture-clock-was-started org-clock-marker @@ -1166,7 +1156,7 @@ may have been stored before." (org-capture-empty-lines-after) (unless (org-at-heading-p) (outline-next-heading)) (org-capture-mark-kill-region origin (point)) - (org-capture-narrow beg (point)) + (org-capture-narrow beg (if (eobp) (point) (1- (point)))) (org-capture--position-cursor beg (point)))))) (defun org-capture-place-item () -- 2.26.2 --=-=-= Content-Type: text/plain On 29 May 2020 17:25, Kevin Liu wrote: > This is a patch to fix my previous report of a regression in capture > behavior between 9.3 and 9.3.6: > >> Basically, the last position in the narrowed org-capture is actually >> the first position on the next line, so when you go to (end-of-buffer) >> and start typing you start clobbering the next headline. > > The fix already landed in cb2774d1a is inadequate for me as the subtree > structure can still be broken during the capture process. I think this > is the more correct approach, though I haven't done much testing outside > of my own workflow and `make test`. It seems to be the same behavior as > 9.3. > > From e6f4faacd2db9ea3f5dc6d6582e0e58ee11c8bef Mon Sep 17 00:00:00 2001 > From: nivekuil > Date: Fri, 29 May 2020 16:48:31 -0700 > Subject: [PATCH] Fix org-capture-narrow > > --- > lisp/org-capture.el | 12 +----------- > 1 file changed, 1 insertion(+), 11 deletions(-) > > diff --git a/lisp/org-capture.el b/lisp/org-capture.el > index 9136d331b..4d2c3e8d4 100644 > --- a/lisp/org-capture.el > +++ b/lisp/org-capture.el > @@ -728,16 +728,6 @@ captured item after finalizing." > > (run-hooks 'org-capture-prepare-finalize-hook) > > - ;; Fix missing final newline, as it may have been deleted by accident > - (when (eq (org-capture-get :type 'local) 'entry) > - (save-excursion > - (goto-char (point-max)) > - (and (not (looking-at-p "^")) > - (org-with-wide-buffer > - (and (not (looking-at-p org-heading-regexp)) > - (not (eobp)))) > - (insert "\n")))) > - > ;; Did we start the clock in this capture buffer? > (when (and org-capture-clock-was-started > org-clock-marker > @@ -1166,7 +1156,7 @@ may have been stored before." > (org-capture-empty-lines-after) > (unless (org-at-heading-p) (outline-next-heading)) > (org-capture-mark-kill-region origin (point)) > - (org-capture-narrow beg (point)) > + (org-capture-narrow beg (if (eobp) (point) (1- (point)))) > (org-capture--position-cursor beg (point)))))) > > (defun org-capture-place-item () --=-=-=--