Agenda Issues

119 views
Skip to first unread message

W. Bentley MacLeod

unread,
Dec 16, 2012, 9:13:24 AM12/16/12
to vimorg...@googlegroups.com
Hi Herb,

I tried out your latest version from github and have the following problem when I run the agenda command (,ag a)
E212 Undefined variable b:v
E15 Invalid exploress "syntax match DONETODO,"

More generally, with the previous version, after I run the agenda command, I see all my org files, but folding, and adjustments to structure no longer works?  The agenda mini-buffer seems to work as advertized.  This bug is a serious issue for me since it means that I cannot edit org files after running the agenda command (I have to just open the files one by one).

Thoughts on the problem?

many thanks bm

Herbert Sitz

unread,
Dec 16, 2012, 1:55:02 PM12/16/12
to vimorg...@googlegroups.com
On Sun, Dec 16, 2012 at 6:13 AM, W. Bentley MacLeod <wbma...@gmail.com> wrote:
> Hi Herb,
>
> I tried out your latest version from github and have the following problem
> when I run the agenda command (,ag a)
> E212 Undefined variable b:v
> E15 Invalid exploress "syntax match DONETODO,"

Bentley --

This could be a result of insufficient testing by me of latest bugifx.
I'll check it out.

>
> More generally, with the previous version, after I run the agenda command, I
> see all my org files, but folding, and adjustments to structure no longer
> works? The agenda mini-buffer seems to work as advertized. This bug is a
> serious issue for me since it means that I cannot edit org files after
> running the agenda command (I have to just open the files one by one).

Given your description I think what you're seeing may be the expected
behavior. See if my explanation below fits with what you're
experiencing. If after an agenda search folding still works in any
files you've opened directly but not in files that were opened
automatically by agenda search, then the explanation below is relevant
to your issue.

You are first person to bring this to my attention, perhaps because
not many people are seriously using VimOrganizer with many agenda
files (or because other people just (1) said nothing and gave up or
(2) naturally found navigation method that avoids the folding
problem).

If the explanation below is for something different from what you're
seeing, please let me know. I haven't documented this behavior very
well and it is helpful to know it for many use-cases of VimOrganizer,
so it wasn't wasted effort on my part even if your issue is something
else. I should get more info on this into the main help file. . . .

Anyway, hope this helps.

-- Herb

EXPLANATION FOR WHY FOLDING MAY BE OFF IN AN ORG BUFFER:
First, I should say that one issue with replicating Org in Vim is that
the folding in Vim is implemented differently from folding in Emacs.
One major difference is that in Vim when folding is initialized in a
file (e.g., generally when file is loaded into a Vim "window") it
takes some time to initialize, which with larger files can be
noticeable. On my slow machine I think it generally takes a second or
so for every two or three thousand lines in file. This is not
noticeable with a single small file but it can be come noticeable with
(1) a large file, and/or (2) agenda searches where many files are
being opened for first time.

Because agendas can include ten, twenty, or a hundred or more files, I
made decision to avoid initialization of folding when files are opened
by an agenda search. This means an agenda search -- even of hundreds
of files -- can run quickly, but has downside that the files opened by
the search will have folding disabled. To make this more palatable,
things are set up so that folding is automatically turned on in a file
if you navigate to it by an operation from the agenda. For example,
pressing <enter> on an entry in the agenda will focus the associated
org file AND turn folding on if it's not already. This generally
works fine, since even if you had 100 files in agenda your search went
fast, then you just have a possible fraction of a second delay for
each file you move to from agenda (the delays for initialization of
folding become spread out and not noticeable).

So one way to avoid problem with folding not being on is to navigate
to the document by using an operation from the agenda buffer. The
other way is to move between org files using the 'Goto' command from
the Agenda Files Dashboard. This is accessed by built-in keymap of
,afg , where ,af opens the dashboard and 'g' shows list of open
agenda files and allows single key access. (This method is not
optimal for agendas where there are scores of agenda files, since
currently list is useful only for some smaller number.)

Given the explanation above, you can understand why when moving
between some org documents by using mouse on tab headers, or by using
standard Vim commands, the folding will not get turned on
automatically. Let me emphasize that folding is initially off only
for files that were opened automatically in an agenda buffer search,
never for a file opened directly by you.

A related but different issue is that, in general, you will want to
keep your org documents open on different tab pages. Folding gets
initialized in a vim document whenever it is loaded into a "window".
Any command that changes the buffer that is viewed in the current
window "loads" the target buffer into the window (even if buffer was
already loaded in Vim) and folding will be initialized, or
reinitialized even if it's be initialized before. This means that
using standard buffer navigation to move between org documents in a
single window can have significant lag. The lag is completely avoided
if documents are kept in separate tabs, which effectively keeps them
in a "permanent" window (i.e., initializes folding only once).

All of the above is why VimOrganizer was designed to operate using
tabs for different org files, to not do so would have had unacceptable
performance problems. It becomes completely natural to observe the
"each org file in its own tab" rule and to not have problems with
folding being off once you know the rules. If you don't like
appearance of tabs the tab headings can be turned off so there is no
visual cue that tabs are being used rather than buffers (:set
showtabline=0) .

Herbert Sitz

unread,
Dec 16, 2012, 2:03:11 PM12/16/12
to vimorg...@googlegroups.com
On Sun, Dec 16, 2012 at 6:13 AM, W. Bentley MacLeod <wbma...@gmail.com> wrote:
> More generally, with the previous version, after I run the agenda command, I
> see all my org files, but folding, and adjustments to structure no longer
> works? The agenda mini-buffer seems to work as advertized. This bug is a
> serious issue for me since it means that I cannot edit org files after
> running the agenda command (I have to just open the files one by one).
>
> Thoughts on the problem?
>
> many thanks bm

In addition to the longer explanation I gave in previous message, I
should add that the workaround is just to set the foldmethod in the
problem buffer. That is, if folding is not on issue this command:

:set foldmethod=expr

or

:set fdm=expr

This should initialize proper folding in an org buffer if for some
reason you've gotten there without using a VimOrganizer navigation
method that would have done this for you automatically.

-- Herb

Herbert Sitz

unread,
Dec 16, 2012, 2:58:45 PM12/16/12
to vimorg...@googlegroups.com
On Sun, Dec 16, 2012 at 10:55 AM, Herbert Sitz <hes...@gmail.com> wrote:
> If after an agenda search folding still works in any
> files you've opened directly but not in files that were opened
> automatically by agenda search, then the explanation below is relevant
> to your issue.
>

That's not quite right. This would be more accurate:

If after an agenda search folding still works in any
files you've opened directly AND ALWAYS KEPT ON THEIR
OWN TAB PAGE, but not in files that were opened
automatically by agenda search OR WHICH WERE ALREADY
OPEN BUT NOT ON THEIR OWN TAB PAGE,

W. Bentley MacLeod

unread,
Feb 7, 2013, 2:47:55 PM2/7/13
to vimorg...@googlegroups.com
Hi Herb, I have updated my system to opensuse 12.2 and getting around
to setting up vim organizer. Version 56477.. works fine, but when I
checkout out 68527, where you did work on the highlighting it crashes
for me as described above. That narrows it down to 27 lines of code.
I am wondering if you can check it? Thanks so much bentley
--
W. Bentley MacLeod
Sami Mnaymneh Professor of Economics
Professor of International & Public Affairs
Columbia University in the City of New York
wbentleymacleod.wikischolars.columbia.edu

Herbert Sitz

unread,
Feb 7, 2013, 3:35:08 PM2/7/13
to vimorg...@googlegroups.com
On Thu, Feb 7, 2013 at 11:47 AM, W. Bentley MacLeod
<bentley...@columbia.edu> wrote:
> Hi Herb, I have updated my system to opensuse 12.2 and getting around
> to setting up vim organizer. Version 56477.. works fine, but when I
> checkout out 68527, where you did work on the highlighting it crashes
> for me as described above. That narrows it down to 27 lines of code.
> I am wondering if you can check it? Thanks so much bentley

Bentley --

I'm not clear on what issue you're seeing. Initial crash was that
folding was not working when you used agenda to navigate to different
buffer? You seemed to say that was fixed at one point but said you
still had problem with ',<tab>' and <ctrl-Enter>.

If you're still having problems with folding working then merely
looking at code will probably not get me very far. This isn't
generally an issue and I think it may stem from the order or method
you're using to open files. So I think I would need more detailed way
for simplest method you have to reproduce it, along perhaps with
seeing your vimrc file.

Not sure about the ',<tab>' issue either.

The issue with <ctrl-Enter> would be expected if you're working with a
console/terminal version of Vim. Most terminals don't allow for
mapping of <ctrl-Enter> and will just read it as <enter>. Emacs and
other programs have same issue when used in terminals. You can look
at ':h vimorg-keybindings' for a little fuller explanation.

-- Herb

Herbert Sitz

unread,
Feb 8, 2013, 1:29:52 PM2/8/13
to vimorg...@googlegroups.com
On Thu, Feb 7, 2013 at 12:35 PM, Herbert Sitz <hes...@gmail.com> wrote:
> So I think I would need more detailed way
> for simplest method you have to reproduce it, along perhaps with
> seeing your vimrc file.
>

The problems you're seeing could stem from Vim's 'filetype' options
not being set correctly. They should be set in your vimrc with a
command ':filetype plugin indent on' but it could be that command is
in vimrc and reversed somewhere lower in vimrc or in a different
plugin.

To test whether this is the problem you can check the settings once
you have a file open and/or when you're experiencing problems with
.org files (to make sure options aren't getting modified somewhere
else). Type command ':filetype' and see what output you get. If all
three options are not 'ON' then this is likely the problem.

-- Herb

W. Bentley MacLeod

unread,
Feb 19, 2013, 12:14:13 PM2/19/13
to vimorg...@googlegroups.com
Hi Herb,
I am sorry to bug you with yet another question. When I do the agenda
command ,ag and then a I get a nice agenda, which also opens all my
org files. I would like each one to have set fdm=expr, but when I add
a modeline " vim:dfm=expr this does not work (nor adding a comman in
my .vimrc file). I have a dozen or so files, so doing it manually is
very slow. Is there a way to have fdm set when the agency command
opens all my org files?

Thanks so much! b.

Herbert Sitz

unread,
Feb 20, 2013, 3:48:55 PM2/20/13
to vimorg...@googlegroups.com
On Tue, Feb 19, 2013 at 9:14 AM, W. Bentley MacLeod
<bentley...@columbia.edu> wrote:
> Hi Herb,
> I am sorry to bug you with yet another question. When I do the agenda
> command ,ag and then a I get a nice agenda, which also opens all my
> org files. I would like each one to have set fdm=expr, but when I add
> a modeline " vim:dfm=expr this does not work (nor adding a comman in
> my .vimrc file). I have a dozen or so files, so doing it manually is
> very slow. Is there a way to have fdm set when the agency command
> opens all my org files?
>
> Thanks so much! b.
>

Bentley -- This is actually the issue I explained before, which was
design decision to _not_ have folding set for files that get opened
automatically in agenda search. This is because the initial setup of
folding can take a noticeable amount of time, which increases as file
size increases. (E.g., folding in typical 2,000 line file may take a
second or so.) What may seem like insignificant amount of time for
one file gets magnified by however many agenda files there are. So I
made decision that when files are opened for first time in agenda
search folding would not be set. So agenda searches are always fast,
rather than having first searches delayed by 1 second, 10 seconds, or
more depending on how many files are in agenda list and how larger
they are.

Things are set up so folding does get set automatically in normal
course of using VimOrganizer, though. E.g., if you press <enter> on a
line in the agenda it will automatically show the chosen buffer, and
if folding is not turned in that buffer it will automatically activate
it. Or if you use the ',afg' to move to the tab/buffer folding will
be set automatically.

Having said all of that, I think it's probably a good idea to add an
option to initiate folding even when files are being opened for first
time in agenda search. People with relatively few agenda files and/or
relatively small agenda files may never notice the small performance
hit, and it makes sense to have this behavior as an option. I'll take
a look into it and report back. . .

Regards,

Herb

W.Bentley MacLeod

unread,
Feb 20, 2013, 4:18:42 PM2/20/13
to vimorg...@googlegroups.com
Thanks - in my case i have a dozen or so files, but scrolling through a
2000 line file takes much more time that going through a folded file,
which uses the hierarchy to efficiently get to where I want.

What I have to do is for each file do set fdm=expr, which takes way more
time than a sec, since I often mistype and so on.

The folding IS the reason I use orgmode. Without folding I might as well
go back to a regular file and search for tags.

While I can use google for todos, the hierarchial folding in orgmode is
not available anywhere else.

Thanks so much. b.

____________________________

W. Bentley MacLeod
Sami Mnaymneh Professor of Economics
Professor of International & Public Affairs
Columbia University in the City of New York
wbentleymacleod.wikischolars.columbia.edu
____________________________

On Wed, 20 Feb 2013, Herbert Sitz wrote:

> To: vimorg...@googlegroups.com
> --
> You received this message because you are subscribed to the Google Groups "VimOrganizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vimorganizer...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

Herbert Sitz

unread,
Feb 20, 2013, 4:54:15 PM2/20/13
to vimorg...@googlegroups.com
On Wed, Feb 20, 2013 at 1:18 PM, W.Bentley MacLeod
<bentley...@columbia.edu> wrote:
> Thanks - in my case i have a dozen or so files, but scrolling through a 2000
> line file takes much more time that going through a folded file, which uses
> the hierarchy to efficiently get to where I want.
>
> What I have to do is for each file do set fdm=expr, which takes way more
> time than a sec, since I often mistype and so on.

This is really an apples to oranges comparison. If you use the Agenda
as base for navigation you should _never_ have to set folding
manually. Not sure why you would not be using Agenda for navigating
among your agenda files. I can't remember the last time I set up
folding manually.

In any case, not to worry, since I expect I will be adding the option
you want. But you may want to check into making full use of the
Agenda functionality.

-- Herb
Reply all
Reply to author
Forward
0 new messages