* adapted org-flag-drawer to hide newlines of consecutive drawers to save lines
@ 2013-11-12 15:47 Gregor Kappler
2013-11-12 21:46 ` Bastien
0 siblings, 1 reply; 10+ messages in thread
From: Gregor Kappler @ 2013-11-12 15:47 UTC (permalink / raw)
To: emacs-orgmode
Often several consecutive drawers follow the headline in my setup.
Maybe this code to hide newlines after drawers is of some use.
When drawers are hidden this wastes three lines of screen real estate
: * heading
: :LOGBOOK:...
: :CLOCK:...
: :PROPERTIES:...
per line.
I adapted org-flag-drawer to hide the newlines as well if another drawer
is following:
: * heading
: :LOGBOOK:...:CLOCK:...:PROPERTIES:...
This lead to a much denser editing experience.
Maybe this is not the best way to do this. But this trick caused no
troubles for me during the last months. All the best!
Gregor
#+BEGIN_SRC emacs-lisp
(defun org-flag-drawer (flag)
"When FLAG is non-nil, hide the drawer we are within,
including the newline at end of a drawer,
yet only if another drawer is following.
If FLAG is nil, make drawer it visible."
(save-excursion
(beginning-of-line 1)
(when (looking-at "^[ \t]*:[a-zA-Z][a-zA-Z0-9]*:")
(let ((b (match-end 0))
(selective-display-ellipses nil))
(if (re-search-forward
"^[ \t]*:END:"
(save-excursion (outline-next-heading) (point)) t)
(outline-flag-region b (save-excursion
(forward-line)
(if (looking-at org-drawer-regexp)
(point-at-bol)
(match-end 0)))
flag)
(error ":END: line missing at position %s in buffer %s" b (buffer-name)))))))
#+END_SRC
Refererences
-- org.el::org-cycle-hide-drawers
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: adapted org-flag-drawer to hide newlines of consecutive drawers to save lines
2013-11-12 15:47 adapted org-flag-drawer to hide newlines of consecutive drawers to save lines Gregor Kappler
@ 2013-11-12 21:46 ` Bastien
2013-11-13 8:20 ` Nicolas Goaziou
0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2013-11-12 21:46 UTC (permalink / raw)
To: Gregor Kappler; +Cc: emacs-orgmode
Hi Gregor,
Gregor Kappler <g.kappler@gmx.net> writes:
> When drawers are hidden this wastes three lines of screen real estate
> : * heading
> : :LOGBOOK:...
> : :CLOCK:...
> : :PROPERTIES:...
> per line.
>
> I adapted org-flag-drawer to hide the newlines as well if another drawer
> is following:
> : * heading
> : :LOGBOOK:...:CLOCK:...:PROPERTIES:...
>
> This lead to a much denser editing experience.
Probably a matter of taste, so I won't argue too much, but I'd rather
stick to the current folding style, where "..." consistently means
that there is a hidden region.
Beside, `org-flag-drawer' is currently under revision since Michael
report on slowliness (and recent discussion with Tod and Aaron.)
Best,
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: adapted org-flag-drawer to hide newlines of consecutive drawers to save lines
2013-11-12 21:46 ` Bastien
@ 2013-11-13 8:20 ` Nicolas Goaziou
2013-11-13 8:52 ` Bastien
0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2013-11-13 8:20 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode, Gregor Kappler
Hello,
Bastien <bzg@gnu.org> writes:
> Beside, `org-flag-drawer' is currently under revision since Michael
> report on slowliness (and recent discussion with Tod and Aaron.)
I rewrote `org-flag-drawer' a few days ago. It shouldn't be slow if
cache is activated.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: adapted org-flag-drawer to hide newlines of consecutive drawers to save lines
2013-11-13 8:20 ` Nicolas Goaziou
@ 2013-11-13 8:52 ` Bastien
2013-11-13 11:24 ` Nicolas Goaziou
0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2013-11-13 8:52 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode, Gregor Kappler
Hi Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Bastien <bzg@gnu.org> writes:
>
>> Beside, `org-flag-drawer' is currently under revision since Michael
>> report on slowliness (and recent discussion with Tod and Aaron.)
>
> I rewrote `org-flag-drawer' a few days ago. It shouldn't be slow if
> cache is activated.
Is the cache activated by default? If so, does it come with some
inconveniency? If not, should we simply activate it all the time?
Thanks,
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: adapted org-flag-drawer to hide newlines of consecutive drawers to save lines
2013-11-13 8:52 ` Bastien
@ 2013-11-13 11:24 ` Nicolas Goaziou
2013-11-13 11:43 ` Bastien
0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2013-11-13 11:24 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode, Gregor Kappler
Bastien <bzg@gnu.org> writes:
> Is the cache activated by default?
Yes, it is.
There's an emergency variable, `org-element-use-cache' to disable it,
but it should be used for debugging purpose only. From the user point of
view, if the cache appears to be corrupted due to a bug, it may be
simpler to call `org-element-cache-reset'.
> If so, does it come with some inconveniency?
As every cache, you pay the full price the first time you fill it. For
example, there may be a small overhead when opening an Org file.
Most editing operations only remove the current element from the cache,
but some of them (mostly operations on blocks and drawers boundaries)
delete larger parts of it. As such, these are more expensive than the
average.
> If not, should we simply activate it all the time?
We really should.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: adapted org-flag-drawer to hide newlines of consecutive drawers to save lines
2013-11-13 11:24 ` Nicolas Goaziou
@ 2013-11-13 11:43 ` Bastien
2013-11-14 17:43 ` Nicolas Goaziou
0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2013-11-13 11:43 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode, Gregor Kappler
Thanks for the details. I think I've seen the cache corrupted
several times, I didn't know it was this. Any direction on how
to debug such problems? The symptoms were that moving around
with M-<down> and friends was completely erratic.
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: adapted org-flag-drawer to hide newlines of consecutive drawers to save lines
2013-11-13 11:43 ` Bastien
@ 2013-11-14 17:43 ` Nicolas Goaziou
2013-11-14 22:55 ` Bastien
0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2013-11-14 17:43 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode, Gregor Kappler
Hello,
Bastien <bzg@gnu.org> writes:
> Thanks for the details. I think I've seen the cache corrupted
> several times, I didn't know it was this. Any direction on how
> to debug such problems?
Not really. Cache bugs are a bit difficult to resolve because there can
be quite a long time between the cause and the consequence.
I'm hunting down two bugs related to lists. I understand the first one
but the second one still eludes me.
> The symptoms were that moving around with M-<down> and friends was
> completely erratic.
OK. I'll look into it.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: adapted org-flag-drawer to hide newlines of consecutive drawers to save lines
2013-11-14 17:43 ` Nicolas Goaziou
@ 2013-11-14 22:55 ` Bastien
2013-11-15 16:56 ` Nicolas Goaziou
0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2013-11-14 22:55 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode, Gregor Kappler
Hi Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
>> The symptoms were that moving around with M-<down> and friends was
>> completely erratic.
>
> OK. I'll look into it.
If M-x org-element-cache-reset RET always solve such problems, then my
problems was not related to the cache, as org-element-cache-reset did
not solve it.
Anyway, thanks for looking into this.
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: adapted org-flag-drawer to hide newlines of consecutive drawers to save lines
2013-11-14 22:55 ` Bastien
@ 2013-11-15 16:56 ` Nicolas Goaziou
2013-11-15 19:30 ` Bastien
0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2013-11-15 16:56 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode, Gregor Kappler
Hello,
Bastien <bzg@gnu.org> writes:
> If M-x org-element-cache-reset RET always solve such problems, then my
> problems was not related to the cache, as org-element-cache-reset did
> not solve it.
The only reliable way to know if it is cache related is to try with
`org-element-use-cache' set to nil.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: adapted org-flag-drawer to hide newlines of consecutive drawers to save lines
2013-11-15 16:56 ` Nicolas Goaziou
@ 2013-11-15 19:30 ` Bastien
0 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2013-11-15 19:30 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode, Gregor Kappler
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> The only reliable way to know if it is cache related is to try with
> `org-element-use-cache' set to nil.
Right, I'll try this for a while if I'm hit again by the bug.
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-11-15 19:30 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-12 15:47 adapted org-flag-drawer to hide newlines of consecutive drawers to save lines Gregor Kappler
2013-11-12 21:46 ` Bastien
2013-11-13 8:20 ` Nicolas Goaziou
2013-11-13 8:52 ` Bastien
2013-11-13 11:24 ` Nicolas Goaziou
2013-11-13 11:43 ` Bastien
2013-11-14 17:43 ` Nicolas Goaziou
2013-11-14 22:55 ` Bastien
2013-11-15 16:56 ` Nicolas Goaziou
2013-11-15 19:30 ` Bastien
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).