From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id GFU1DROo0V5IIwAA0tVLHw (envelope-from ) for ; Sat, 30 May 2020 00:25:55 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id YP8FCROo0V4FRQAA1q6Kng (envelope-from ) for ; Sat, 30 May 2020 00:25:55 +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 625679404E0 for ; Sat, 30 May 2020 00:25:54 +0000 (UTC) Received: from localhost ([::1]:45298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jepJv-0005QE-Vt for larch@yhetil.org; Fri, 29 May 2020 20:25:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jepJS-0005Pv-1q for emacs-orgmode@gnu.org; Fri, 29 May 2020 20:25:22 -0400 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21169) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jepJQ-0001DU-Hp for emacs-orgmode@gnu.org; Fri, 29 May 2020 20:25:21 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1590798315; cv=none; d=zohomail.com; s=zohoarc; b=HevqpsNKd8MOKcldWq9szo2zJFtkuF2ZznHHvWTGlhG7PM+JWv/H/jNbYoOJ+3mzgztItEA2iT5sJiqd0Mua00cfTjU3Dh+tT1bW3MA7wmfPYSpgzNaocS9PPkAPhbWgtSPkYAJ/fXPgtVpAxqpk7hmb0CcJYEMEzYaWhKvBnHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590798315; h=Content-Type:Date:From:MIME-Version:Message-ID:Subject:To; bh=2CVdQLYtEgONSv6XivcUXp0pzQWrzbOorWXolen7LF8=; b=JNUz+Kv13TW5XTpwv+iAlOZeHrTy8UJ3TUs9LtZl39NITjgwrV4jbD78OltoVXKgAdRAldrAmWk7+FSy702jyrmhNqK3SY89RJKa5TmbREctyvThu7r9bw9bxDS5hMLeI9NycIyg+6OE+OVryynNekZnamWH759Cf/3TQi/2oeQ= 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=1590798315; s=mail; d=nivekuil.com; i=kevin@nivekuil.com; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=2CVdQLYtEgONSv6XivcUXp0pzQWrzbOorWXolen7LF8=; b=jO6s5gy0yn35zVASv3w72e69bKKHwEAYjvFxFohc++ZvFdUrzJcpv4ktvl38xeoI HzohqJgmrN7dsDMBNbI7OXEkH80sQ53s7W7UsUEMw6qF1GSc9O/uhaf4peZ5HyDuG/6 cAtuOR1p/KvOACyHzV2EfgPa5DNcFY04ae954jI0= Received: from machina (71.212.158.154 [71.212.158.154]) by mx.zohomail.com with SMTPS id 1590798313359931.5221997875575; Fri, 29 May 2020 17:25:13 -0700 (PDT) User-agent: mu4e 1.5.1; emacs 27.0.91 From: Kevin Liu To: emacs-orgmode@gnu.org Subject: [PATCH] Fix org-capture-place-entry narrow bounds Date: Fri, 29 May 2020 17:25:12 -0700 Message-ID: <87v9keclqv.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=jO6s5gy0; 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: L50hwc3f9Dmv --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-org-capture-narrow.patch Content-Description: patch >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 () -- 2.26.2 --=-=-=--