Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement agenda view #34

Closed
jceb opened this issue Jul 9, 2011 · 15 comments
Closed

Implement agenda view #34

jceb opened this issue Jul 9, 2011 · 15 comments

Comments

@jceb
Copy link
Owner

jceb commented Jul 9, 2011

Implement agenda view

@sotte
Copy link
Contributor

sotte commented Aug 4, 2011

I'm thinking about how to implement this properly.

I'd create an agenda class that contains several documents. The user can define the documents. The nesesary information of the documents get extracted depending on the type of the agenda. The agenda info gets dumped in a new vimbuffer.

That is the rough idea. Any suggestions?

@jceb
Copy link
Owner Author

jceb commented Aug 4, 2011

Sounds good to me. The agenda class should be part of liborgmode. The documents should be configurable by vim variables, similar to the TODO implementation. An imaginary orgcmd program, that implements a command line front-end to liborgmode can then override the configuration with it's own values.

Regarding the agenda buffer in vim, I recommend implementing the auto command BufReadCmd for org:agenda or something similar.

@sotte
Copy link
Contributor

sotte commented Aug 24, 2011

as reference #60


jceb said:
0. extend liborgmode/Heading to support dates
I'd say SCHEDULED, DEADLINE are the keywords

  1. add an agenda class to liborgmode
    this class should contain all basic functionality to build an agenda
    an agenda is just a (flat) list of headings that belong to one or more documents
    this list can be sorted or filtered in various ways to allow the user to get the view port he wants
    the agenda class should not contain any highlevel UI code - all that UI stuff goes into a plugin
  2. (optional, could be implemented later) add support for linked documents to liborgmode/Document.
  3. implement/extend a plugin that does the job of displaying the agenda
    this includes a global variable that defines which org documents are included in the agenda
    it should do the job of allowing the user to narrow down the displayed headings.

Thanks for the suggestion!

0: org only needs an active date like <2011-11-22 Mon> for the agenda. SCHEDULED and DEADLINE have different semantics. Besides that I introduced active_date in the Heading and wrote some unittests.

I kinda want to split liborgmode.py. It's getting to huge. Even some classes are really big. I would introduce some factory methods, e.G. parse_heading_from_data(...) in the Heading class. That would also improve the testabillity.

I would move Heading and HeadingList in heading.py.

A OrgDate class would be helpful as well. It would simplify the Date plugin and and the agenda feature.

Is that fine with you?

@jceb
Copy link
Owner Author

jceb commented Aug 24, 2011

That's fine for me. I'd recommend creating a python module "liborgmode" and putting all the separate files (heading.py & co.) in there.

@sotte
Copy link
Contributor

sotte commented Aug 25, 2011

I started with the refactoring and have a tiny agenda running: https://github.com/sotte/vim-orgmode/tree/agenda
It's by no means ready for anything yet...but just in case you want to take a look at how everything is laid out now.

Next I'll add the OrgDate classeses I want to use for the agenda (and a few other places).

@jceb
Copy link
Owner Author

jceb commented Aug 25, 2011

Great. I hope I'll find some time to look at it at the weekend.

@sotte
Copy link
Contributor

sotte commented Sep 1, 2011

Is there any specific reason why init of Document should not be called directly? The Document as main class in liborgmode should be allowed to be instanciated directly.

I'm about to write some unittest for the agenda manager and I need a Document object with some Headings in it.

@sotte
Copy link
Contributor

sotte commented Sep 1, 2011

I want to be able to sort a list of headings by date. For this I would implement __lt__() for Heading. This might be to specific. But for the entire Agenda it would be really helpful. Basically all views of an agenda are sorted by date.

What do you think?

@jceb
Copy link
Owner Author

jceb commented Sep 1, 2011

Re: init. Of course you can instantiate Document directly. Except from test cases this is hardly ever needed because of the lack of a connection to any kind of file/buffer/... resource.

Re: lt. Go ahead an implement __lt__() for the Heading class.

@sotte
Copy link
Contributor

sotte commented Sep 3, 2011

Ok, my branch has the basic functionality for the agenda view. I restructured quite a bit and there is some more work needed.

Current limitations:

  • Only the current document is used for the agenda view.
  • No separate syntax file yet. (Can we reuse syntax-elements from different syntax files?)
  • No selection window for agenda views. The agenda view is opened directly.
  • No functionality in the agenda view.
  • Can't jump to the corresponding position in the document. Any idea how I can achieve this?

Feel free to test. Also, if you integrate it into v0.4 we both can work on it.

@sotte
Copy link
Contributor

sotte commented Sep 3, 2011

How can I get the bufnr of a buffer with a given name ('somefile.org')?

@jceb
Copy link
Owner Author

jceb commented Sep 4, 2011

Re bufnr: I suppose there is no direct api call that will return the bufnr. You have to know the full filename of the buffer, then you can iterate over vim.buffers to find the corresponding buffer.

I reduced the plans for v0.4 to the agenda feature, so my plan is to merge all your work. Currently I'm very busy, I recommend that you continue working on your implementation till I merge it. I added you as a collaborator, so you can also merge it yourself :-)

@sotte
Copy link
Contributor

sotte commented Sep 4, 2011

I guess iterating works.

Thanks for making me a collaborator! I'll keep working on the agenda feature...

@sotte
Copy link
Contributor

sotte commented Sep 5, 2011

  • DONE Only the current document is used for the agenda view.
  • DONE No separate syntax file yet.
  • TODO Can we reuse syntax-elements from different syntax files? --> v0.5
  • TODO Hyperlinks don't get recognized properly
  • DONE No selection window for agenda views. The agenda view is opened directly.
    Still no selection window, but there are only two views so far and it's not really necessary. Once we have a better way to open tmp buffers we could implement it. --> v0.5
  • DONE Can't jump to the corresponding position in the document.

@sotte
Copy link
Contributor

sotte commented Sep 5, 2011

I merged it into v0.4 and created a separate issue for the hyperlinks problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants