Emacs Org-mode: How to include properties in diary anniversaries? - emacs

I am trying to have the "Birthday" and "Name" properties of an Org-mode entry added to the agenda automatically:
* John
:PROPERTIES:
:Name: John
:Birthday: (5 4 1900)
:END:
I found a way to add an entry at the correct anniversary date in the agenda by inserting the following line right after the properties:
%%(apply 'diary-anniversary (read (org-entry-get nil "Birthday"))) John
However, using this code, I still have to enter the name manually. Is there a way to have the value of the "Name" property added to the diary text automatically for all entries?
EDIT 1: the example did not work before, now added parantheses around the value of the birthday property

Maybe https://julien.danjou.info/projects/emacs-packages#org-contacts is the solution to your problem. org-contacts is a address book for org-mode.

It is probably better to ask this at the Org mailing list, they are very active, and Carsten Dominik (the creator of org-mode) usually answers posts on this list almost immediately (BTW, this is the main list email.

Perhaps you a taking a path which requires you to write some lisp to get what you want. The org-mode manual gives an example of something similar, but I'm guessing you wanted a simpler format, when it describes the calendar/agenda integration http://www.gnu.org/software/emacs/manual/html_node/org/Weekly_002fdaily-agenda.html
* Birthdays and similar stuff
#+CATEGORY: Holiday
%%(org-calendar-holiday) ; special function for holiday names
#+CATEGORY: Ann
%%(diary-anniversary 14 5 1956) Arthur Dent is %d years old
%%(diary-anniversary 2 10 1869) Mahatma Gandhi would be %d years old
I would think you have other options if you want a custom setup: either a new type of export or dynamic blocks might be used. This may highlight the different use-case of agenda over the diary. The agenda seems more geared towards day to day tasks.

Related

Emacs Org-Mode: Reset Line Indention Within org-indent-mode

I love Emacs and Org-Mode. But I can only stand to use Org Mode in the clean view (or whatever it's called - with org-indent-mode on).
My problem is that I often want to use headers that don't have a bullet in front of them. I want one asterisk to be the start of the list, not the header.
Example:
List 1
List 2
Header 1
List 3
List 4
But when I try to do this, Header 1 gets indented to the level of List 2.
I know just turning off org-indent-mode and getting used to that is one solution. But is there a way to reset the indentation for Header 1?
The things you are talking about changing are pretty fundamental to org-mode; basically you are trying to change the org-mode syntax. The reason why Header 1 in your example is not being dedented, is that org-mode does not see it as a headline, because headlines by definition start with leading stars. Also, while it is technically supported to use * to identify a plain list item, this is not recommended, and can cause some unexpected behavior (see footnote 1 here).
That being said, you can have some control over the appearance of headlines. For example, you can use the org-bullets package. You can then define the bullets to use in place of * like this:
(setq org-bullets-bullet-list
'("◉" "◎" "⚫" "○" "►" "◇"))
which will define the bullets used for the first six levels of headlines. You can replace the bullets in that list with other utf-8 symbols, and you can even use " " as one of the symbols, so that your Headlines will be preceded by a single space. However, note that this only affects the way headlines are displayed; they will still be preceded by * in the actual file.
I know it is not very helpful, but my overall suggestion would be to stick with the org-mode syntax if you want to use org-mode, i.e., use a structure like this:
- List one
- List two
* Header 1
- List three
- List four
with * starting a headline, and - starting a plain list. Since org-mode files are just plain text, the magic of that mode depends heavily on those files having a set structure. In my own experience, if you try to change that structure (another example is changing timestamp formats), it will cause more headaches than it relieves, and cause a lot of the functionality that makes org-mode so great to break.
Just as a side note: I prefer a cleaner view as well, and one option I like to enable in addition to org-indent-mode is (setq org-hide-leading-stars t), which will display only a single star/bullet per headline (although the leading stars will still be present in the actual text file).

Autonumber in org-mode

In all the docs I'm reading about org mode it seems that numbered lists will auto number when moving to next list item but it seems that I can't trigger it. So, I'm not understanding how [#50] (to start at 50 instead of 1) works.
Am I just missing some thing about numbered lists?
Assuming that org mode is in fact enabled (either with editing a file with the .org extension, or by manually triggering it with org-mode), you can auto-increment a numbered list by hitting M-<RET> after a list item.
1. First entry (M-<RET>)
2.
Edit: Looking back, seems I may have misunderstood your question. This is how to trigger the autoincrementing of the list items, but are you instead asking how to start at number other than 1?
(Keeping this as an answer because it does provide a solution, at least to the assumed question.)

How to maintain notes organized with org-mode?

I have a bunch of papers to read and taking notes. The problem is I don't have much time to spend looking for a way to organize my note taking system. For me emacs org-mode seems to be a quite powerfull solution, and pretty straightforward.
I encounter another problem, how can I keep my notes organized with a single file, in a way that I can rapidly access all the notes?
Since you're short time, you might do well to start with a simple system in which you can capture the notes you need to take, and worry later about organization. Consider the following:
* Title of a paper
** First section name
- A note
- Another note
** Second section name
- Yet another note
- A fourth note
- A fifth note
* Title of another paper
** First section name
- Yet more notes
** Second section name
- &c., &c.
Using paper titles as top-level section headings makes it easy to navigate among papers with isearch; C-s Title of a paper RET brings you to the section containing all your notes on that paper. From there, you can search for a section title, or just use TAB on headings to fold and unfold until you're looking at what you want.
Unless I've misunderstood your requirement, that should give you a pretty quick and straightforward way to dive in and start taking your notes, without losing navigability. That'll also give you an opportunity for some initial, shallow exploration of the problem domain; then, once you've gotten past the current glut of work and have time to think about how you want your note-taking system to work, you can explore the problem more deeply, using org-mode's quick outline rearrangement tools at need to turn the scheme you've got into the scheme you need.

Use arbitrary LaTeX itemize in Org Mode

If I want to export a itemized list from Org to LaTeX, is there a way to set arbitrary itemization? The usual Org plain list, i.e. - item will result in an \begin{itemize} environment, but I would like to set arbitrary itemization. For example, is there any kind of Org list markup that will output this kind of LaTeX list environment?
\begin{itemize}
\item[2013]
This item happened in 2013
\item[2012]
This item happened in 2012
\end{itemize}
Edit:
The problem is that Org is recognising the years as inactive timestamps or footnote references and this is screwing up the LaTeX export. Solution below.
I can't tell whether it's what you're looking for, but
- 2013 :: This happened in 2013
- 2012 :: This happened in 2012
will produce
\begin{description}
\item[2013] This happened in 2013
\item[2012] This happened in 2012
\end{description}
I haven't tried, but according to this WikiBook it seems as though there will be no dot trailing the year.
Following fniessen's suggestion below I found the solution to produce an itemize environment without having the years turn into inactive timestamps or footnote references. The key is to insert or surround the year with spaces, which will be ignored by the TeX conversion.
- [ 2013 ] This item happened in 2013
- [ 2012 ] This item happened in 2012
If there is a more official way to do this I'd like to here it.
The other answers provide great solutions for creating both enumerate and description environments, but it was specifically itemize I was after.
Use something such as:
1. [#2013] This item happened in 2013
2. [#2012] This item happened in 2012
The solution appointed by the org-mode manual is ::, so:
Important actors in this film are:
- Elijah Wood :: He plays Frodo
- Sean Astin :: He plays Sam, Frodo's friend.
by the way, [ text ] didn't work for me.
If as me you don't like the decription style with "- ::" syntax (that produces weird latex export) a workaround is simply to use
- ##latex:[2013]## This item happened in 2013
- ##latex:[2012]## This item happened in 2012
and, more generally,
- ##latex:[yourcustomitem]## blah blah

Combine org mode capture and drill modules to learn vocabulary

I want to use the capture module of org-mode to create a data base of new words that I want to learn, and then use the drill module to learn them (flash cards style).
In my org-capture-templates I added the following:
("v" "Vocabulary" entry
(file+headline (concat org-directory "/vocab.org")
"Vocabulary")
"* Word :drill:\n%^ \n** Answer \n%^")
This is a rather naive template which I borrowed from here. It works fine but it is too limited. Unfortunately I'm rather new to elisp and I don't know how to improve it.
I think the above template has to be improved in the following there aspects:
Headline Currently the first input string is the (new) word and the headline is fixed. How can the headline be the same (input) word? I think that the following result is desirable:
* Vocabulary
** Foo :drill:
Foo
*** Answer
What is foo
Actually an even better way would be to have 3 input strings.
The new word (for example foo) which will be the headline.
If the second is empty, then it gets the same string as (1). Otherwise, concatenates the string to the one from (1). E.g. having as second input bar would yield foo bar. This will be the content of the entry.
The word's definition which should come in the answer sub-headline.
Duplications (see again this) If at some later point I try to capture foo again, I would like to know it, and be directed to edit the already existing entry - skipping all the inputs.
Sorting After capturing I think it would be nice to sort the list of words. This should not be too hard given that the headline of each entry is the word itself. In this case one can probably use the org-sort-entries function.
I know this is a rather big questions but I also think that if it can be solved here it will be of great use to many users.
Edits:
Using #juan_g suggestions, I improved my template and now it is:
("v" "Vocabulary" entry
(file+headline (concat org-directory "/vocab.org")
"Vocabulary")
"* %^{The word} :drill:\n %t\n %^{Extended word (may be empty)} \n** Answer \n%^{The definition}")
I didn't manage to set the default value of the second input to be the 1st one. I tried something like %^{Extended word (may be empty)|%\1} but it returns ^A which is not helpful.
In any case, this improved version seems to be already usable.
About the input question, in Org Mode Manual: 9.1.3.2 Template expansion, there is the %\1 special escape code:
%\n Insert the text entered at the nth %^{prompt}, where n a number, starting from 1.
The duplications question probably would need some Emacs Lisp coding.
For sorting, see C-c ^ (org-sort).
BTW, org-drill seems indeed a really interesting package, based on SuperMemo's spaced repetition algorithms.
You need an extra "\", therefore %\\1 works as expected.