Org-mode capture without location and date - emacs

I would like to customize my org-mode capture so that the output in my notes.org file will be in the simpler form:
* TODO WhatIwanttodo
without anything else. At the moment I get something like this:
* TODO Make a new post in the blog explaining how u can put TODO in org mode using the android app by IFTTT [2015-03-14 Sat 09:21 [[file:~/Dropbox/org/dailywork.org::*ES][TODOES]]

Here are two variations:
The first one adds a todo to a file under header TODO-HEADER. The second simply appends it to the end of file.
(setq org-capture-templates
'(
("s" "Simple" entry (file+headline "my-org-todo-file" "TODO-HEADER")
"* TODO %?")
("x" "Very Simple" entry (file "my-org-todo-file")
"* TODO %?")
))
Template can be very powerful. I recommend you read
http://orgmode.org/manual/Capture-templates.html#Capture-templates

Related

Orgmode Latex Export: #+EMAIL is not exported

I am trying to add email address in my org mode document which has to be exported to PDF.
This is my header tags.
#+TITLE: Main Title
#+SUBTITLE: Sub Title
#+AUTHOR: Author Name
#+EMAIL: author#email.com
All the first three tags are getting exported except email header.
I tried the option
#+OPTIONS: toc:nil email:t
but still it is not working.
Could anyone throw light on where I am doing the mistake?
Exporting to PDF is via LaTeX and there is no standard entry for email in the LaTeX export. In other words, the standard LaTeX article class, used by the exporter by default, does not know what to do with an email address.
However, org creates a macro, email, which you can use to place the email address in any place you wish within the document by using {{{email}}}, including, for instance, after the author name on the #+AUTHOR line.
I got the solution from emacs-orgmode mailing list.
Accessing #+EMAIL in latex export.
We need to create a filter function to replace #EMAIL# in the contents (I don't what's the content we are getting) and add this function to org-export-filter-final-output-functions. The code snippet is:
(defun nd-email-filter (contents backend info)
(let ((email (plist-get info :email)))
(replace-regexp-in-string "#EMAIL#" email contents t)))
(add-to-list 'org-export-filter-final-output-functions (function nd-email-filter))
(setq amsart-class
'("amsart"
"\\documentclass{amsart}
[DEFAULT-PACKAGES]
[PACKAGES]
[EXTRA]
{#EMAIL#}"
("\\section{%s}" . "\\section{%s}")
("\\subsection{%s}" . "\\subsection{%s}")
("\\subsubsection{%s}" . "\\subsubsection{%s}")))
(add-to-list 'org-latex-classes amsart-class)
Then, within our latex class definition as shown above, we can use #EMAIL# where ever, we want the email to be displayed.
I used it as follows:
(add-to-list 'org-latex-classes
'("ethz"
"\\documentclass[a4paper,11pt,article]{memoir}
\\usepackage[utf8]{inputenc}
...
\\usepackage{parskip}
\\makeatletter
\\renewcommand{\\maketitle}{%
\\begingroup\\parindent0pt
\\Small{Aum Tat Sat!}\\par\\bigskip
\\Huge{\\bfseries\\#title}\\par
\\LARGE{\\#subtitle}\\par\\bigskip
\\small{\\#author}\\par\\smallskip
\\small{#EMAIL#}\\par\\smallskip
\\normalsize\\#date\\par\\bigskip
\\endgroup\\#afterindentfalse\\#afterheading}
\\makeatother
[PACKAGES]
[EXTRA]
\\linespread{1.1}
...
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

Emacs org-mode markdown export: #+TITLE option not exported

I use the great org-mode to easily push modifications of README.md to GitHub projects. Markdown export works great, except for the #+TITLE option not being exported to Markdown - which works flawlessly for HTML export.
I want to keep the file name README.org for convenient converting to Markdown, else I could have chosen the title as file name, which displays the title correctly on GitHub.
Any suggestions on how to achieve this?
Based on your question and subsequent comments, you seem to want to achieve three things:
Define a custom title that gets exported as a top-level headline.
Insert the TOC after the title.
The TOC should not include the title.
Custom location for TOC
Inserting the TOC at a custom location is easy, so let's start with that: Add
#+OPTIONS: toc:nil
to the export options at the top of README.org. By itself, this tells org-mode not to include the default TOC when exporting. You can then place the TOC where you want it to go by inserting
#+TOC: headlines
at the desired location. (This method is not specific to Markdown export.)
Custom title that doesn't show up in TOC
Defining a custom title that is not included in the TOC is a bit trickier, but the basic idea is to exclude the title from the TOC by formatting it as a Markdown headline instead of an org headline. As a first step, change README.org to look like this:
#+OPTIONS: toc:nil
# Emacs als Python-Power-Editor für den RasPi
#+TOC: headlines
* Wieso nur ausgerechnet Emacs???
...
Out of the box this won't yield the desired results because org will interpret the title as a comment and by default the Markdown exporter is configured to ignore comments. However, in order to change the default behavior you can
define a custom transcoder for comments in your .emacs:
(defun org-md-comment (comment contents info)
"Transcode COMMENT object into Markdown format.
CONTENTS is nil. INFO is a plist holding contextual information."
(format "# %s" (org-element-property :value comment)))
redefine the Markdown export backend to make use of this transcoder:
(org-export-define-derived-backend 'md 'html
;; ...
:translate-alist '((bold . org-md-bold)
(code . org-md-verbatim)
(comment . org-md-comment) ;; <--- Use custom transcoder
(comment-block . (lambda (&rest args) ""))
;; ...
))
The original definition of the backend can be found in the file ox-md.el; this file is located in the directory of your org-mode installation. You'll need to copy the full definition to your .emacs file and change the line
(comment . (lambda (&rest args) ""))
as shown above.
Results
With these customizations the resulting README.md file looks like this:
# Emacs als Python-Power-Editor für den RasPi
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li>1. Wieso nur ausgerechnet Emacs???</li>
<li>2. Die Maus ist tot, es leben die shortcuts!</li>
<li>3. Auf den Emacs, fertig, los!</li>
</ul>
</div>
</div>
# Wieso nur ausgerechnet Emacs???
...
See http://article.gmane.org/gmane.emacs.orgmode/82634.
The problem is supposed to be fixed. Only waiting for an update of the converter on GitHub site...
This is useful to get what the answer expects but I think it is not the right path to resolve this question. Let me explain it
I think the issue is about exporting options from org-mode to md but I also want to keep my docs in org-mode and this hacks org-mode export option adding another line for title exporting to md headline 1 but not manages the whole thing.
What I expect and I guess this is the important issue is to export orgmode to md properly, I mean:
the title from orgmode to md heading one (#) -as orgmode to html does.
the heading one from orgmode (*) to md heading two (##)
If this issue is not about it I should open a new one :)
Best!

Org-mode capture %g only autocompletes for some tags in my target file

I am using org-mode to collect notes for a research project, and each note I assign various tags which are shared with some other notes, or are new.
I have a long list of notes, each with tags and properties. However, when I go to capture, or I do C-c C-q or C-c C-c to assign tags to a headline, I only get an incomplete list of tags. I.e., only some of the tags in my file show up.
Here is my capture template:
(setq org-capture-templates
'(("n" "Research" entry (file "~/Dropbox/University/Friendship/research.org")
"* %? %^g %^{source}p %^{pg}p")))
Any idea what is wrong?
You are using
"%^g"
(lowercase);
instead you should use
"%^G"
(uppercase).
%^g Prompt for tags, with completion on tags in target file.
%^G Prompt for tags, with completion on all tags in all agenda
files.

In emacs org-agenda clock report, the headline display as ... if it is a long hyperlinks?

In org-agenda, we can use clock report (org-agenda-clockreport-mode) for time spent. Now I encounter such issue:
1) A task header line with long hyperlink format, for example:
* TODO [[outlook:00000000D94CA2AC786588429B27FF9F5ADE02C207003CACBF968BF6D844ACDE08872A34BAA7000000236CFA0000641BF72F869D49499551670BAC68BD2600001BC8C6620000][Just a test email from outlook]]
2) Set the parameter-plist as this, note that I need the ':link t' parameter.
(setq org-agenda-clockreport-parameter-plist
(quote (:link t :maxlevel 5 :fileskip0 t :compact t :narrow 80)))
3) Generate the clock report in org-agenda (day/weekly), but the Headline only display '...' because it is too long.
How can it remove the [outlook:....] part in the org-agenda-clock-report mode?
The easiest solution would be to change your capture template or method of adding tasks to avoid links in headlines. Links in headlines can cause odd behaviour in the Agenda as well as in exports potentially.
If you change the example to:
* TODO Just a test email from Outlook
[[outlook:00000000D94CA2AC786588429B27FF9F5ADE02C207003CACBF968BF6D844ACDE08872A34BAA7000000236CFA0000641BF72F869D49499551670BAC68BD2600001BC8C6620000][Just a test email from outlook]]

Org-mode & Latex export: Any way to put short & long names in sectioning commands? Workarounds?

In standard Latex, one can use something like...
\section[short head]{A longer and more meaningful heading version for the section}
...that gives both a long and short version of a section (or other sectioning command) Thus, allowing for both meaningful sectioning 'titles' and, also, reasonable-looking running heads, TOCs, beamer navigation, etc..
Is there any way to easily achieve this in org mode? (That is without hard coding the sectioning commands in LATEX snippets and, thus, defeating most of the flexibility of changing sectioning levels and repurposing content for beamer, book, and article classes that is my reason for wanting to try orgmode, in first place?)
I tried a "workaround" that did not work. I tried editing the possible latex export classes by adding another class to org-export-latex-classes. This new class changes sectioning commands from \section{%s} to \section%s(EDIT-Fixed typo in slashes). Then I tested using [short]{longer version} in orgmode sections of the file. It worked, except it acted as if the longer version section heading was just "{" and "longer version" was body text! What is up with that?
Since version 8.0 the "org-export-latex-classes" strategy won't work anymore.
Instead, and dare I say much more elegantly, you can set the ALT_TITLE property for the heading.
See http://orgmode.org/manual/Table-of-contents.html.
The following org code:
* The Long Title of Section 1
:PROPERTIES:
:ALT_TITLE: Section 1
:END:
Lorem ipsum.
** The Long Title of Subsection 1-1
:PROPERTIES:
:ALT_TITLE: Subsection 1-1
:END:
Dolor sit amet.
will export to LaTeX as:
[...]
\section[Section 1]{The Long Title of Section 1}
\label{sec-1}
Lorem ipsum.
\subsection[Subsection 1-1]{The Long Title of Subsection 1-1}
\label{sec-1-1}
Dolor sit amet.
You had the right idea with creating your own LaTeX class. The problem lies with the way the templates are filled by the default org-fill-template function. I'm not so great with Lisp, but this this hack will do the trick. Add the following to your .emacs file:
(defun my-section (level text)
(let* ((in "") (out "")
(short-title (if (string-match "\\[.*\\]" text)
(substring text (match-beginning 0)
(match-end 0))
nil)))
(if short-title (setq text (substring text (match-end 0) -1)))
(setq in (org-fill-template
"\\section%S{%s}"
(list (cons "S" (or short-title ""))
(cons "s" (or text ""))))
out (copy-sequence "\\end{section}"))
(cons text (list in out in out))))
(add-to-list 'org-export-latex-classes
'("test"
"\\documentclass{article}"
my-section))
This declares a new latex class by adding a "test" class to the org-export-latex-classes. Here we declare, instead of the normal \\section{%s} stuff a function that takes two parameters --- the current level and the headline text --- and returns a modified cons cell. Some details of this information can be found in org-latex-export.el.
Above the adding to the list is where we actually define the function. This is honestly a hacky version, and I pulled a lot from the org-beamer-sectioning function in org-beamer.el file. This function basically searches the headline for anything that is like a LaTeX short label (i.e. [....]) removes it from the headline and sticks it before the actual section label. Right now this hack will only generate \section statements, no matter how deep the level - if you want something more intelligent like \chapter or \subsection or even unnumbered items, you'll need to do some more Lisping; again, see org-beamer.el for some help.
This bit of org-mode code
#+latex_class: test
* [short 1] this is 1 star
test
** this is a 2 star
test
*** [short 3] this is a 3 star
test
**** what happens
exports to LaTeX as (only relevant sections shown here):
\section[short 1]{ this is 1 star}
\label{sec-1}
test
\section{ this is a 2 star }
\label{sec-1-1}
test
\section[short 3]{ this is a 3 star}
\label{sec-1-1-1}
test
\section{ what happens }
\label{sec-1-1-1-1}
\end{section}
\end{section}
\end{section}
\end{section}
Although it's not a straight org-mode solution, it seems to work and can be a starting point for you. One of these days I might try to write it up properly and get it folded into the org-mode distribution.
It is possible to use the following commands in latex to define the text that should appear in the header to replace section names. But the TOC will still contain the original names.
\chaptermarks
\sectionmarks
\subsectionmarks
...
So, in org-mode you can write
* Long section title
#+LaTeX: \sectionmark{Short title}
edit: it actually doesn't work on the very page where the section name appears. On this one only, the full name is still put in the header.