From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Vivier Subject: Re: [PATCH] Fix narrowed 1-line subtrees Date: Fri, 22 Feb 2019 21:23:51 +0100 Message-ID: <87ftsfy3l4.fsf@hidden> References: <20190218002547.30325-1-leo.vivier@gmail.com> <87mumsqepg.fsf@nicolasgoaziou.fr> <871s44cbzb.fsf@hidden> <87sgwkoue5.fsf@nicolasgoaziou.fr> <87d0nnnbkf.fsf@hidden> <877edvn6g3.fsf@hidden> <874l8zn5vz.fsf@hidden> <87y36asiap.fsf@nicolasgoaziou.fr> <87y36atwdl.fsf@hidden> <878sy9ywwm.fsf@hidden> <8736ohywqw.fsf@hidden> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:55231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxHMX-00082z-KY for emacs-orgmode@gnu.org; Fri, 22 Feb 2019 15:24:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gxHMW-0000I7-AO for emacs-orgmode@gnu.org; Fri, 22 Feb 2019 15:24:01 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:40348) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gxHMV-0000DH-O4 for emacs-orgmode@gnu.org; Fri, 22 Feb 2019 15:24:00 -0500 Received: by mail-wr1-x441.google.com with SMTP id q1so3701733wrp.7 for ; Fri, 22 Feb 2019 12:23:56 -0800 (PST) In-Reply-To: <8736ohywqw.fsf@hidden> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, I've found and fixed three new functions which didn=E2=80=99t behave proper= ly when the buffer was restricted to a subtree: * lisp/org.el (org-log-beginning): Fix drawer creation. * lisp/org.el (org-store-log-note): Fix drawer-less logging. * lisp/org-capture.el (org-clock-in): Fix drawer-less clocking. You'll find those three patches at the bottom alongside another with all the patches until now squashed together (except the patch for `org-remove-timestamp-with-keyword' which wasn't related). HTH. Best, --=20 Leo Vivier English Studies & General Linguistics Master Student, English Department Universit=C3=A9 Rennes 2 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-log-beginning-Fix-drawer-creation.patch >From 745e106406a5f5b296bbd9dbda9f9dbd965a2e30 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Fri, 22 Feb 2019 18:03:24 +0100 Subject: [PATCH 1/3] org-log-beginning: Fix drawer creation * lisp/org.el (org-log-beginning): Ensure insertion in current restriction. This commit ensures that the log-drawer for state-changes and notes is created within the current restriction. --- lisp/org.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 4c3c3cd78..f22f8b807 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13118,12 +13118,13 @@ narrowing." ;; No drawer found. Create one, if permitted. (when create (unless (bolp) (insert "\n")) - (let ((beg (point))) - (insert ":" drawer ":\n:END:\n") + (let ((beg (1- (point)))) + (forward-char -1) + (insert "\n:" drawer ":\n:END:") (org-indent-region beg (point)) (org-flag-region - (line-end-position -1) (1- (point)) t 'org-hide-drawer)) - (end-of-line -1))))) + (line-end-position 0) (point) t 'org-hide-drawer)) + (end-of-line 0))))) (t (org-end-of-meta-data org-log-state-notes-insert-after-drawers) (skip-chars-forward " \t\n") -- 2.20.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-org-store-log-note-Fix-drawer-less-logging.patch >From c94c86fdac09a933337267c29f7e3d4dcf5c3398 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Fri, 22 Feb 2019 18:17:35 +0100 Subject: [PATCH 2/3] org-store-log-note: Fix drawer-less logging * lisp/org.el (org-log-beginning): Ensure insertion in current restriction. This commit ensures that drawer-less state-changes and notes are created within the current restriction. --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index f22f8b807..27cd2bbd7 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13263,7 +13263,7 @@ EXTRA is additional text that will be inserted into the notes buffer." ;; Note associated to a clock is to be located right after ;; the clock. Do not move point. (unless (eq org-log-note-purpose 'clock-out) - (goto-char (org-log-beginning t))) + (goto-char (1- (org-log-beginning t)))) ;; Make sure point is at the beginning of an empty line. (cond ((not (bolp)) (let ((inhibit-read-only t)) (insert "\n"))) ((looking-at "[ \t]*\\S-") (save-excursion (insert "\n")))) -- 2.20.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-org-clock-in-Fix-drawer-less-clocking.patch >From 2fc86ae438725e5f0656c8966eaa4935e0203ee4 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Fri, 22 Feb 2019 18:23:40 +0100 Subject: [PATCH 3/3] org-clock-in: Fix drawer-less clocking * lisp/org-clock.el (org-clock-in): Ensure insertion in current restriction. This commit ensures that drawer-less clock-lines are created within the current restriction. --- lisp/org-clock.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 5624af32a..5c9b0a1cf 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1292,6 +1292,7 @@ the default behavior." (org-todo org-clock-in-switch-to-state))) (setq org-clock-heading (org-clock--mode-line-heading)) (org-clock-find-position org-clock-in-resume) + (forward-char -1) (cond ((and org-clock-in-resume (looking-at @@ -1315,8 +1316,8 @@ the default behavior." (sit-for 2) (throw 'abort nil)) (t - (insert-before-markers "\n") - (backward-char 1) + (insert "\n") + (org-indent-line) (org-indent-line) (when (and (save-excursion (end-of-line 0) -- 2.20.1 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-Fix-spaces-with-org-remove-timestamp-with-keyword.patch Content-Transfer-Encoding: quoted-printable >From bb5a7feee1684cf47f1e8a29805c442c8ae64c37 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Thu, 21 Feb 2019 12:44:26 +0100 Subject: [PATCH] Fix spaces with `org-remove-timestamp-with-keyword' MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * lisp/org.el (org-remove-timestamp-with-keyword): Fix space deletion between timestamps When an entry had a CLOSED, a DEADLINE and a SCHEDULED timestamps, removing the middle one caused the space between the 1st and 3rd to be removed as well. Checking whether we=E2=80=99re at the end of the line bef= ore deleting the space fixes it. --- lisp/org.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/org.el b/lisp/org.el index ef6e40ca9..b8e378e73 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -12944,6 +12944,7 @@ nil." (while (re-search-backward re beg t) (replace-match "") (if (and (string-match "\\S-" (buffer-substring (point-at-bol) (point))) + (eolp) (equal (char-before) ?\ )) (backward-delete-char 1) (when (string-match "^[ \t]*$" (buffer-substring --=20 2.20.1 --=-=-=--