From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Vivier Subject: Bug: Bug: org-clock commands spawn drawer outside of narrowing [9.2.1 (9.2.1-2-gc6d37c-elpaplus @ /home/zaeph/.emacs.d/elpa/org-plus-contrib-20190204/)] Date: Mon, 11 Feb 2019 19:44:10 +0100 Message-ID: <87lg2m6u85.fsf@hidden> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([209.51.188.92]:55376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtGYz-0005MG-I2 for emacs-orgmode@gnu.org; Mon, 11 Feb 2019 13:44:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtGYy-0007Us-KH for emacs-orgmode@gnu.org; Mon, 11 Feb 2019 13:44:17 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:40111) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gtGYy-0007UE-8a for emacs-orgmode@gnu.org; Mon, 11 Feb 2019 13:44:16 -0500 Received: by mail-wr1-x436.google.com with SMTP id q1so5888982wrp.7 for ; Mon, 11 Feb 2019 10:44:15 -0800 (PST) Received: from thinkpad.localdomain (lcs07-lyo-176-188-242-162.sfr.lns.abo.bbox.fr. [176.188.242.162]) by smtp.gmail.com with ESMTPSA id m6sm6118457wrv.24.2019.02.11.10.44.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Feb 2019 10:44:13 -0800 (PST) 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: emacs-orgmode@gnu.org Hello, Version info: - Emacs : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30), of 2018-07-05 - Package: Org mode version 9.2.1 (9.2.1-2-gc6d37c-elpaplus) The bug only happens in narrowed org-mode buffers when the tree at point (or targeted by the resolving) is a single line not followed by a blank line. I was able to replicate the problem with `emacs -q`. MWE: --------------------------------[START]-------------------------------- * Tree 1 * Tree 2 ---------------------------------[END]--------------------------------- - Narrow to =E2=80=98Tree 1=E2=80=99l - Clock in. Observations: - No clock drawer visible in the narrowed buffer. - Feedback in the minibuffer that the clock was started. - Widening the buffer confirms the presence of the buffer where it should be. Whilst the observations would lead one to think that everything =E2=80=98Ju= st Works=E2=84=A2=E2=80=99, it causes a slew of problems. Two examples: - After clocking in, adding a new heading =E2=80=98Subtree=E2=80=99 bellow = =E2=80=98Tree 1=E2=80=99 would make the drawer belong to =E2=80=98Subtree=E2=80=99 instead of =E2= =80=98Tree 1=E2=80=99 - `org-clock-out-when-done` isn=E2=80=99t respected since the drawer is not visible It seems to be part of a larger set of bugs related to single-line trees, such as the one I=E2=80=99d reported before and which was addressed = in 503ede74bc0a1db59fd2fb7bac0bf1ba7352d15b. I tried to fix it on my own by tracking down the problem with edebug, and that led me to the `save-restriction` used in `org-clock-in`, `org-clock-out`, and `org-clock-resolve-clock`. Those calls to `save-restriction` are sometimes embedded into macros, such as `org-with-wide-buffer` or `org-with-point-at`. I initially thought that replacing those calls in favour of a `widen` followed by a `org-narrow-to-subtree` would refresh the bounds of the narrowing. This proved to be a lot more finicky than I anticipated, and I=E2=80=99d hate to break anything. Would you be able to look into it? Thank you for your time, --=20 Leo Vivier English Studies & General Linguistics Master Student, English Department Universit=C3=A9 Rennes 2