emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Leo Vivier <leo.vivier@gmail.com>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87lg2m6u85.fsf@hidden> (raw)

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 ‘Tree 1’l
- 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 ‘Just
Works™’, it causes a slew of problems.  Two examples:
- After clocking in, adding a new heading ‘Subtree’ bellow ‘Tree 1’
  would make the drawer belong to ‘Subtree’ instead of ‘Tree 1’
- `org-clock-out-when-done` isn’t 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’d 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’d hate to break anything.

Would you be able to look into it?

Thank you for your time,
-- 
Leo Vivier
English Studies & General Linguistics
Master Student, English Department
Université Rennes 2

             reply	other threads:[~2019-02-11 18:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11 18:44 Leo Vivier [this message]
2019-02-14 14:53 ` 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/)] Nicolas Goaziou
     [not found] <87pnruq81e.fsf@nicolasgoaziou.fr>
2019-02-15  8:48 ` Leo Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lg2m6u85.fsf@hidden \
    --to=leo.vivier@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).