emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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/)]
@ 2019-02-11 18:44 Leo Vivier
  2019-02-14 14:53 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Leo Vivier @ 2019-02-11 18:44 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-15  8:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87pnruq81e.fsf@nicolasgoaziou.fr>
2019-02-15  8:48 ` 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/)] Leo Vivier
2019-02-11 18:44 Leo Vivier
2019-02-14 14:53 ` Nicolas Goaziou

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).