Add a few FAQ
[Worg.git] / org-faq.org
blob376f970a4d5e43841f8719c657abcd82500d6a49
1 #+EMAIL:     carsten.dominik@gmail.com
2 #+AUTHOR:    Worg people
3 #+LANGUAGE:  en
4 #+TITLE:     Org-mode Frequently Asked Questions
5 #+OPTIONS:   toc:t H:2
7 #+begin_html
8   <style type="text/css">
9     <!--/*--><![CDATA[/*><!--*/
10       #table-of-contents {
11         font-size: inherit;
12         position: relative;
13         background: white;
14         -webkit-box-shadow: 0 0 0 0;
15         -moz-box-shadow: 0 0 0 0;
16         -webkit-border-bottom-left-radius: 0;
17         -moz-border-radius-bottomleft: 0;
18         text-align: left;
19         max-height: none;
20         overflow: none; }
21         #table-of-contents h2 {
22           font-size: inherit;
23           max-width: none;
24           font-weight: bold;
25           padding-left: 0;
26           padding-left: 0;
27           padding-top: 0;
28           padding-bottom: 0; }
29         #table-of-contents #text-table-of-contents {
30           display: block;
31           text-align: left; }
32         #table-of-contents:hover #text-table-of-contents {
33           display: block;
34           padding: 0;
35           margin-top: 0; }
36     /*]]>*/-->
37   </style>
38 #+end_html
40 [[file:index.org][{Back to Worg's index}]]
42 * What is org-mode?
43   :PROPERTIES:
44   :CUSTOM_ID: What-is-org-mode
45   :END:
46 ** Can I implement a GTD workflow with Org-mode?
47    :PROPERTIES:
48    :CUSTOM_ID: GTD-workflow-with-Org-mode
49    :END:
51    Yes, you can.  Check for discussions and pointers [[http://orgmode.org/worg/org-gtd-etc.html][here]].
53 ** What is the difference between Org and TaskPaper?
54    :PROPERTIES:
55    :CUSTOM_ID: Org-and-TaskPaper
56    :END:
58   There is really no difference.  Org is as /simple/ as [[http://hogbaysoftware.com/products/taskpaper][TaskPaper]].  It
59   is just that, when using Org within Emacs, it lets you do many things
60   that you wouldn't be able to do with TaskPaper.  Yes, TaskPaper is
61   fiddle-proof and people using Emacs tends to like fiddling (which is
62   orthogonal to the idea of using todo-list efficiently), but this is
63   just a matter of discipline and common sense, not one of Org's design.
65   Read [[http://article.gmane.org/gmane.emacs.orgmode/6224][Carsten's enlightening statement]] on this.
66 ** What is the meaning of the Unicorn on Org's website?
67    :PROPERTIES:
68    :CUSTOM_ID: unicorn
69    :END:
71 The Unicorn is the logo of Org-mode because:
73 - Org-mode is the UNICs of ORgaNizers.
75 - Org-mode is an Emacs mode, so it makes sense to use an animal
76   similar or related to the gnu used for GNU Emacs.
78 - Org-mode is meant to show you the way, and an animal with two horns
79   can not do this very well, can it?
81 - Unicorn tears are said to reverse petrification, and wasn't this how
82   we all felt before getting to some degree of time and task
83   management?
85 - It will take forever to learn everything there is to know about a
86   unicorn.
88 - A unicorn is a fabulous creature.  Org-mode wants to be a fabulous
89   creation.
91 Using a unicorn was originally /Bastien Guerry's/ idea, his friend
92 /Christophe Bataillon/ designed the logo for us, and /Greg Newman/
93 gave it a refresh some time later.  Bastien writes why he chose a
94 unicorn:
96 #+BEGIN_QUOTE
97 The first reason is not linked to the animal, but to the sounding of the
98 word "Unicorn" - because Org gives you a /uni/que way of producing files
99 in several format (HTML, LaTeX, etc.)
101 The second reason is that a Unicorn doesn't really exist, it is just
102 something you can dream about, and make others believe it does exist.
103 Just like the perfect organizer.
104 #+END_QUOTE
106 There was a [[http://thread.gmane.org/gmane.emacs.orgmode/11641/focus%3D11641][thread about unicorns]] on the mailing list.  [[http://thread.gmane.org/gmane.emacs.orgmode/11641/focus%3D11641][Christopher
107 Suckling]] posted a link showing how to make a simple foldable unicorn
108 (very appropriate for an outlining program!).
110 [[http://article.gmane.org/gmane.emacs.orgmode/11735][Tim Burt]] made a very complicated one which is now a treasured
111 possession of the Org-mode author.
113 - Official logo: [[http://orgmode.org/img/org-mode-unicorn.png]]
114   This logo is available in a number of different formats including
115   Photoshop /.psd/ and scaleable vector graphics /.svg/ [[http://orgmode.org/img/][here]].
117 - An [[http://orgmode.org/img/nrocinu4.jpg][alternative version]] from Christophe Bataillon (c):
119 - [[http://article.gmane.org/gmane.emacs.orgmode/14293][Chris Randle]] made a [[http://orgmode.org/img/nrocinu.txt][text version]] using the logo and [[http://glassgiant.com][glassgiant.com]]:
121 - [[http://article.gmane.org/gmane.emacs.orgmode/14362][Stefan Vollmar]] made a [[http://orgmode.org/img/nrocinu.pdf][pdf version]] (here in [[http://orgmode.org/img/nrocinu_pdf.png][png]]) using "a simple
122   threshold technique".
124 - [[http://article.gmane.org/gmane.emacs.orgmode/11735/match%3D][Tim Burt]] made a folded Unicorn to match the spirit of Org - see the
125   whole set of pictures [[http://www.flickr.com/photos/tcburt/sets/72157614543357071/][on his flickr page]].
127 - Are unicorns real?  Answer [[http://article.gmane.org/gmane.emacs.orgmode/11687/match%3Drosslaird%2Bunicorn][here]] by Ross Laird.
129 * Mailing list
130 ** Why hasn't my email to the mailing list shown up yet?
131    :PROPERTIES:
132    :CUSTOM_ID: ml-post-delay
133    :END:
135 The org-mode mailing list is moderated. Thus, if you are not
136 subscribed to the mailing list, your mail will only appear on the list
137 after it has been approved by a moderator. To ensure that your mail
138 appears quickly, please [[http://lists.gnu.org/mailman/listinfo/emacs-orgmode][subscribe to the list]].
140 ** I read the mailing list through gmane. Should I subscribe?
141    :PROPERTIES:
142    :CUSTOM_ID: ml-subscription-and-gmane
143    :END:
145 The org-mode mailing list is available via nntp at [[http://dir.gmane.org/gmane.emacs.orgmode][Gmane]]. Many
146 participants in the list prefer read the list in a newsreader, such as
147 Gnus, instead of receiving emails. If you choose to read the list via
148 nntp, you can still [[http://lists.gnu.org/mailman/listinfo/emacs-orgmode][subscribe]] to the list and then opt not to receive
149 any emails on the mailman settings page (see the "Mail Delivery"
150 setting).
152 This will ensure that your messages to the list get through quickly,
153 reduce the work load of the mailing list moderators (who need to clear
154 every mail from non-members), and provide more accurate information
155 about the number of list readers.
157 * Keeping current
158   :PROPERTIES:
159   :CUSTOM_ID: Keeping-current
160   :END:
161 ** My Emacs ships with an older version Org-mode! How do I upgrade?
162    :PROPERTIES:
163    :CUSTOM_ID: updating-org
164    :END:
166 Org-mode develops quickly, which means that versions of Org-mode
167 shipped with Emacs are more or less out-of-date. If you'd like to
168 upgrade to the most recent version of org-mode, you have a number of
169 options.
171  1. Download the most recent release of org-mode ([[http://orgmode.org/org-7.3.zip][zip]] or [[http://orgmode.org/org-7.3.tar.gz][tarball]]) and
172     follow the [[http://orgmode.org/manual/Installation.html#Installation][installation instructions]] in the manual.
173  2. Clone and install the development git repository as [[#keeping-current-with-Org-mode-development][explained
174     here]]. If you don't want to run the bleeding edge, you can still
175     use git [[#using-stable-releases-only][to track the most recent stable releases]].
176  3. Install and updated org-mode automatically through the Emacs
177     Package Manager as [[#installing-via-elpa][explained in this FAQ]].
179 ** How do I keep current with bleeding edge development?
180    :PROPERTIES:
181    :CUSTOM_ID: keeping-current-with-Org-mode-development
182    :END:
184    Org mode is developed in [[http://en.wikipedia.org/wiki/Git_(software)][Git]]. You can keep up-to-date with Org-mode
185    developement by cloning Org mode repository and refreshing your
186    copy with latest changes whenever you wish. You only need to use
187    two Git commands (clone and pull.) Here are the steps in brief
188    (please customize locations to suit your setup):
190    1. Select a location to house the Org mode repository (approx. 40
191       MB; includes documentation, compiled elisp files and history
192       going all the way back to v4.12a)
194       : $ mkdir $HOME/elisp && cd $HOME/elisp
196    2. Clone the Org mode Git repository.
198       Recommended approach:
200       : $ git clone git://orgmode.org/org-mode.git
202       You can also clone from this mirror (lagging one hour behind
203       orgmode.org repo):
205       : $ git clone git://repo.or.cz/org-mode.git
207       For those of you behind a firewall that allows only HTTP, you can
208       clone like this (can be somewhat slow), either from orgmode.org or
209       from repo.or.cz:
211       : $ git clone http://orgmode.org/org-mode.git
212       : $ git clone http://repo.or.cz/r/org-mode.git
214    3. Compile and install Org mode and build documentation.
216       : $ cd org-mode && make && make doc && make install
218       Please note that you can choose to /not/ compile at all and run
219       using source =.el= files only.  Compiled files speed things up.
221       Also note that running =make install= is necessary only if you'd
222       like to install org-mode system-wide.
224    4. This is where you configure Org mode with Emacs.  Please refer
225       to [[./org-tutorials/index.org][Org tutorials]].
227    5. Keeping up-to-date.
229       Cloning the repository is a one time activity.  From this point
230       onwards you only need to /pull/ the latest changes.
232       : $ cd $HOME/elisp/org-mode
234       and then
236       : $ git pull && make clean && make && make doc && make install
238    6. You should restart org mode to have the changes take effect (if
239       you are not rebooting Emacs.)  Also since the intention is to
240       "keep up" with Org mode, you should visit updated sections of
241       documentation for latest updates (use =git log=.)
243    7. As you use your repository over time it will accumulate loose objects.
244       You can reduce the total size of your git repository with
246       : $ git gc
248       which will consolidate loose git objects into pack files.  This
249       reduces the size of the repository and speeds up data access to
250       the objects.
252 ** How can I keep local changes and still track Org mode development?
253    :PROPERTIES:
254    :CUSTOM_ID: keeping-local-changes-current-with-Org-mode-development
255    :END:
257   Say you want to make minor changes to the Makefile to reflect your
258   location for =emacs=.
260   Create a local branch for your changes on top of origin/master as
261   follows:
263   : $ git checkout -b local origin/master
264   : $ git config branch.local.rebase true
265   : # Make your changes to the Makefile and create a new commit
266   : $ git add Makefile
267   : $ git commit -m 'My local Makefile configurations'
268   : # Update git to a newer version
269   : $ git pull
271   Now each time you pull new commits from the distribution repository
272   your local commits will be rewound and replayed on top of the new
273   origin/master.
275 -----------
277   You would normally work on your =local= branch which includes your
278   custom commits; there's no need to switch back to the =master=
279   branch.
281 -----------
283 Here is an example of dealing with conflict resolution during git pull.
285 If you get a conflict during a =git pull= you will need to edit the
286 file with the conflict to fix up the conflicting lines and then tell
287 git that you have resolved the conflict.
289 Conflict resolution goes something like this:
291 1. =git pull= fails with a conflict
292 2. edit the file
293 3. =git add= the file to mark the conflict resolved
294 4. =git rebase --continue=
295 5. lather, rinse, and repeat 2-4 as needed
297 For this example we have the following Makefile:
299 : #
300 : # Example Makefile
301 : #
303 : EMACS=emacs
305 : VERSION=V1.0
307 and we need to change the =EMACS=emacs= line to =EMACS=myemacs= to
308 make it work well on our system.
310 To do this we
312   - create a local branch for our work
314     : $ git checkout -b local origin/master
315     : $ git config branch.local.rebase true
317     This marks the branch so that all local commits on it are rebased
318     on top of any new commits we get in origin/master during a =git
319     pull= operation.
321   - Make our custom changes
323     Edit the makefile so it looks like this:
325     : #
326     : # Example Makefile
327     : #
328     :
329     : EMACS=myemacs
330     :
331     : VERSION=V1.0
333   - Create a commit with our custom changes
334     : $ git add Makefile
335     : $ git commit -m 'My local Makefile configurations'
337   - Later we do a =git pull= but that fails with conflicts.
339     : $ git pull
340     : remote: Counting objects: 5, done.
341     : ...
342     : Patch failed at 0001.
343     :
344     : When you have resolved this problem run "git rebase --continue".
345     : If you would prefer to skip this patch, instead run "git rebase --skip".
346     : To restore the original branch and stop rebasing run "git rebase --abort".
348   - Fix the conflict in your favourite editor
350     Conflict markers look like this:
352     : <<<<<<< HEAD:Makefile
353     : EMACS=emacs22
354     : =======
355     : EMACS=myemacs
356     : >>>>>>> Change emacs location:Makefile
358     This attempted =git pull= caused a conflict.  Fire up your
359     favourite editor and fix the conflict in the Makefile.  The
360     conflict markers are <<<<<<<<<< , ======= , and >>>>>>>>>>.  Fix
361     the Makefile appropriately and delete the conflict markers.  You
362     already edited these lines earlier so fixing it should be trivial.
364     In this case we changed =EMACS=emacs= to =EMACS=myemacs= and
365     upstream changed =EMACS=emacs= to =EMACS=emacs22=.  Just fix the
366     file and save it by deleting the conflict markers and keeping the
367     code you need (in this case the =EMACS=myemacs= line which we
368     originally modified.)
370   - Mark the file's conflict resolved
372     : $ git add Makefile
374     You use =git add= because you are adding new content to be tracked - you're not adding a file, but you are adding changes in content.
376   - Continue the rebase operation
378     : $ git rebase --continue
380     If any other conflicts arise you fix them the same way - edit the file, mark the conflict resolved, and continue.
382 At anytime during the rebase conflict resolution you can say "oops this is all wrong - put it back the way it was before I did a pull"
383 using
384 : $ git rebase --abort
386 ** How can I use a stable release version instead of the bleeding edge master?
387    :PROPERTIES:
388    :CUSTOM_ID: using-stable-releases-only
389    :END:
391 The master branch of the git repository always contains the bleeding
392 edge development code.  This is important for Org's fast development,
393 because code on master gets checked out by many people daily and we
394 quickly receive bug reports if something is wrong.  On rare occasions,
395 this code may not function perfectly for a limited time while we are
396 trying to fix things.
398 Not everyone like to use this bleeding-edge code and face the danger
399 to hit a surprising bug.
401 Therefore, from time to time, we make a release.  This typically
402 happens when the maintainers feel that
404 1. they have reached a good point in the development
405 2. the code has a feature set that should stay and be supported in the
406    future
408 Stable releases are used as the basis for [[http://orgmode.org/index.html#sec-3_3][alternative distributions]] of
409 Org, and they are also the code that gets merged into the Emacs
410 distribution. If you want to work only with stable releases, you can
411 always download [[http://orgmode.org/index.html#sec-3][them here]], but you can also also use the git
412 repository to keep automatically up-to-date with the most recent
413 stable releases (and save bandwidth!). Here's how to do so:
415 *** Run a specific stable release
417 In the repository, do
419 : $ git fetch --tags
420 : $ git tag
422 To see which release tags are available.  Let's say you decide to use
423 =release_7.01f=.
425 : $ git checkout release_7.01f
427 This set the working tree of the repository to the state of Org at the
428 moment of release 7.01f.  You can then run Org from the repository be
429 sure to use the stable release while development continues on the
430 master branch.
432 Later, when we release 7.02, you can switch to that using
434 : $ git fetch --tags                   # to get all the new stuff
435 : $ git tag
436 : $ git checkout release_7.02
438 *** Always run the most recent stable release
440 Alternatively, if you just want to always run whatever the latest
441 stable release is, you can do
443 : $ git checkout -b stable origin/maint
445 and then regularly update this branch by doing
447 : $ git pull
449 ** How can I install an up-to-date version of org-mode without "make" tools?
450    :PROPERTIES:
451    :CUSTOM_ID: installing-org-without-make-tools
452    :END:
454 If you are using org-mode on a computer that lacks developer tools for
455 compiling software, such as [[http://www.gnu.org/software/make/][GNU Make]], you will have to use a
456 *different* installation method than [[http://orgmode.org/manual/Installation.html#Installation][the one outlined in the manual]].
458 Please see [[http://article.gmane.org/gmane.emacs.orgmode/15264][this thread]] on the mailing list for several different ways
459 you can install a recent version of org-mode without using the
460 customary =make clean && make && make install=.
462 The result of that discussion is the file/function found in
463 [[http://orgmode.org/worg/org-hacks.html#compiling-org-without-make]].
465 ** I don't use git. Can I download bleeding edge .zip and .tar.gz archives?
467    Yes. You can download [[http://orgmode.org/org-latest.zip][org-latest.zip]] or [[http://orgmode.org/org-latest.tar.gz][org-latest.tar.gz]] of Org-mode --
468    these archives are udpated every day at midnight.
470    Alternatively, you can download a [[http://orgmode.org/w/org-mode.git/snapshot][tar.gz snapshot from orgmode.org]].
472 ** How can I install Org-mode through Emacs' Package Manager?
473    :PROPERTIES:
474    :CUSTOM_ID: installing-via-elpa
475    :END:
477    Emacs 24 includes an automated package management tool ([[http://tromey.com/elpa/][ELPA]]) that
478    can be used to install and upgrade elisp packages such as Org-mode.
479    If you are running an older version of Emacs (23 or earlier), you
480    will have to install the package manager before using it to install
481    Org-mode. See [[#installing-elpa][this FAQ]] for more details.
483    Org-mode is distributed as an ELPA package from [[http://elpa.gnu.org/packages/][GNU Emacs Lisp
484    Package Archive]] as well as from [[http://orgmode.org/pkg/daily/][Org-mode Emacs Lisp Archive]].
485    
486    Steps for adding Org-mode as a package archive:
487    1. Add Org-mode as a package archive. This can be done in two ways.
488       1. Use =M-x customize-variable RET package-archives=
489       2. Add the following line to your =.emacs= and reload Emacs.
491          #+begin_src emacs-lisp
492            (add-to-list 'package-archives '("Org-mode" . "http://orgmode.org/pkg/daily/"))
493          #+end_src
494                 
495    2. Use the Emacs package manager's =M-x list-packages= to browse
496       and install the latest version.
498    3. If you get the following error "*Failed to download `Org-mode'
499       archive.*" in step 2, you can manually download the tarball and
500       install it. Refer [[Installing from ELPA-tar][this FAQ entry]] for more information.
502 ** How do I install Emacs package manager?
503    :PROPERTIES:
504    :CUSTOM_ID: installing-elpa
505    :END:
506    
507    If you are running Emacs-24 or find the command =M-x list-packages=
508    available you already have the package manager installed.
509    
510    Steps for installing package manager:
511    1. Download the latest package manager -
512       [[http://repo.or.cz/w/emacs.git/blob_plain/HEAD:/lisp/emacs-lisp/package.el][package.el]].
513    2. Add the following to your =.emacs= and reload Emacs.
514       #+begin_src emacs-lisp
515         ;; change "~/elisp/" as appropiate
516         (setq load-path (cons "~/elisp" load-path))
517         (require 'package)
518         (package-initialize)
519       #+end_src
520    
521 ** I don't see Org-mode as an installation option in Package Manager Menu?
522    :PROPERTIES:
523    :CUSTOM_ID: why-no-org-in-elpa
524    :END:
525    
526    Emacs Package Manager is a very recent addition to Emacs. Work is
527    under way to have have Org-mode seamlessly integrate with Emacs'
528    Package Manager. As a result, it will be some time before the
529    Org-mode packages are available and usable from either GNU or
530    Org-mode package archives.
531    
532    In the meanwhile, you can install Org-mode via package manager
533    through ELPA-compatible tar. Refer [[Installing from ELPA-tar][this FAQ entry]] for more information.
534    
535 ** How do I install Org-mode from a ELPA-compatible tarball?
536    :PROPERTIES:
537    :CUSTOM_ID: installing-from-elpa-tarball
538    :END:
539 # <<Installing from ELPA-tar>>
540    
541    Org-mode is distributed as an ELPA-compatible tar which can be used
542    in conjunction with Emacs' package manager.
543    
544    1. If you are already running Org-mode, note the current version
545       reported by M-x org-version.
546    2. Download the latest tarball from [[http://orgmode.org/pkg/daily/][Org-mode repo]].
547    3. Do =M-x package-install-file=. When prompted for =Package file
548       name=, point it to .tar file downloaded in step 2.
549       
550       You will now see Package Manager compiling the files and
551       installing it.
552    4. Reload emacs. This step is very important.
553    5. Note the version of the new installation using M-x
554       org-version. If the new and old versions are different, the
555       installation is done and you are all set to enjoy the updated
556       Org-mode. Otherwise skip to step 6.
557    6. Review you load-path using =C-h v load-path=. Most likely that
558       your old installation path takes precedence over the path chosen
559       by package manager (which is typically
560       =~/.emacs.d/elpa/...=). Fix this anamoly by moving
561       =(package-initialize)= line in .emacs to a more appropriate
562       location.
563       
564    - Additional Note on =org-install.el= :: Functionality of Org-mode's
565      =org-install.el= is supplanted by Package Manager's
566      =org-autoloads.el=. Since Package Manager autoloads Org-mode for
567      you, the following line =(require 'org-install)= in your =.emacs=
568      is no longer required and can be safely removed.
569      
570 ** Why would I use ELPA tarballs instead of the snapshot tarballs?
571    :PROPERTIES:
572    :CUSTOM_ID: why-elpa
573    :END:
574    
575    ELPA-tarballs automate much the process of upgrading org-mode. Much
576    of the following grunt work is done automatically by the Package
577    Manager:
578    
579    1. Downloading, compiling, and activating of org-mode (including
580       setting org-mode's =load-path= and autoloads).
581    2. Updating info files.
583 * Setup
584   :PROPERTIES:
585   :CUSTOM_ID: Setup
586   :END:
587 ** How can I quickly browse all Org options?
589 =M-x org-customize RET=
591 See also [[file:org-tutorials/org-customize.org][Carsten's Org customize tutorial]] and [[file:org-configs/org-customization-guide.org][this customization guide]]
592 for details.
594 ** Can I use the editing features of org-mode in other modes?
595    :PROPERTIES:
596    :CUSTOM_ID: use-editing-features-in-other-modes
597    :END:
599    Not really---but there are a few editing features you can use in
600    other modes.
602    - For tables there is =orgtbl-mode= which implements the table
603      editor as a minor mode. (To enable, type =M-x orgtbl-mode=)
604    - For ordered lists there is =orgstuct-mode= which allows for easy
605      list editing as a minor mode. (To enable, type =M-x
606      orgstruct-mode=)
608    You can activate these modes automatically by using hooks:
610    : (add-hook 'mail-mode-hook 'turn-on-orgtbl)
611    : (add-hook 'mail-mode-hook 'turn-on-orgstruct)
613    For footnotes, there is the function =org-footnote-action=, which
614    works in non-org buffers. This function is a powerful tool for
615    creating and sorting footnotes. To use it globally, you can add the
616    following keybinding to your =.emacs= file (requires Org 6.17 or
617    greater):
619    : (global-set-key (kbd "C-c f") 'org-footnote-action)
621    For other features you need to switch to Org-mode temporarily, or
622    prepare text in a different buffer.
624 ** Why isn't feature "X" working the way it is described in the manual?
625    :PROPERTIES:
626    :CUSTOM_ID: making-sure-org-mode-is-up-to-date
627    :END:
629 Org-mode develops very quickly. If you are using a version of Org-mode
630 that shipped with emacs, there is a good chance that it is somewhat
631 out of date.
633 Many of the users on the Org-mode mailing list are using either a
634 recent release of Org-mode or the
635 [[http://orgmode.org/index.html#sec-3.2][development version of
636 org-mode from the git repository]].
638 If some settings and features aren't working the way you expect, make
639 sure that the version of the manual you are consulting matches the
640 version of Org-mode you are using.
642    - You can check which version of Org-mode you are using by
643      selection =Org --> Documentation --> Show Version= in the Emacs
644      menu.
646    - The [[http://orgmode.org/manual/index.html][online manual]] at [[http://orgmode.org][orgmode.org]] corresponds to the most recent
647      release.
649    - The [[http://www.gnu.org/software/emacs/manual/html_node/org/index.html][manual]] at [[http://www.gnu.org][www.gnu.org]] corresponds to the version of Org-mode
650      released with the latest official Gnu Emacs release. Compared
651      with the manual at the orgmode.org, the manual at www.gnu.org is
652      somewhat out of date.
654 For instructions on how to stay current with Org-mode, consult [[keeping-current-with-Org-mode-development][this
655 FAQ]] or follow the instructions on [[http://orgmode.org][the official Org-mode site]].
657 ** Can I get the visibility-cycling features in outline-mode and outline-minor-mode?
658    :PROPERTIES:
659    :CUSTOM_ID: use-visibility-cycling-in-outline-mode
660    :END:
662    Yes, these functions are written in a way that they are independent of
663    the outline setup.  The following setup provides standard Org-mode
664    functionality in outline-mode on =TAB= and =S-TAB=.  For
665    outline-minor-mode, we use =C-TAB= instead of =TAB=,
666    because =TAB= usually has mode-specific tasks.
668 #+BEGIN_SRC emacs-lisp
669 (add-hook 'outline-minor-mode-hook
670   (lambda ()
671     (define-key outline-minor-mode-map [(control tab)] 'org-cycle)
672     (define-key outline-minor-mode-map [(shift tab)] 'org-global-cycle)))
673 (add-hook 'outline-mode-hook
674   (lambda ()
675     (define-key outline-mode-map [(tab)] 'org-cycle)
676     (define-key outline-mode-map [(shift tab)] 'org-global-cycle)))
677 #+END_SRC
679 Or check out /outline-magic.el/, which does this and also provides
680 promotion and demotion functionality.  /outline-magic.el/ is
681 available at [[http://www.astro.uva.nl/~dominik/Tools/outline-magic.el][Outline Magic]].
683 ** Can I save/restore the visibility state of an org-mode buffer?
684    :PROPERTIES:
685    :CUSTOM_ID: saving-visibility-state
686    :END:
688 Well, no---at least not automatically. You can, however, control the
689 visibility of an org-file or of individual trees by adding
690 instructions to your org file. See [[http://orgmode.org/manual/Visibility-cycling.html#Visibility-cycling][this section of the manual]] for more
691 information.
693 ** How can I keep track of changes in my Org files?
694    :PROPERTIES:
695    :CUSTOM_ID: track-of-changes-in-Org-files
696    :END:
698   Use git to track the history of the files, use a cronjob to check in
699   changes regularly.  Such a setup is described by Bernt Hansen
700   in [[http://article.gmane.org/gmane.emacs.orgmode/6233][this message]] on [[http://dir.gmane.org/gmane.emacs.orgmode][emacs-orgmode]].
702 ** Can I use Org-mode as the default mode for all README files?
703    :PROPERTIES:
704    :CUSTOM_ID: Org-mode-as-default-mode
705    :END:
707 Add the following to your .emacs file:
709 : (add-to-list 'auto-mode-alist '("README$" . org-mode))
711 You can even make it the default mode for any files with unspecified
712 mode using
714 : (setq default-major-mode 'org-mode)
716 ** Can I use ido.el for completing stuff in Org?
717    :PROPERTIES:
718    :CUSTOM_ID: ido-complete
719    :END:
721    Yes, you can.  If you are an ido user and ido-mode is active, the
722    following setting will make Org use =ido-completing-read= for most
723    of its completing prompts.
725 : (setq org-completion-use-ido t)
727 ** Should I use one big org file or multiple files?
728    :PROPERTIES:
729    :CUSTOM_ID: how-to-organize-org-mode-files
730    :END:
732 Org-mode is flexible enough to accomodate a variety of organizational
733 and time management schemes. Org's [[http://orgmode.org/manual/Document-Structure.html#Document-Structure][outline cycling and convenient
734 editing and navigation commands]] make it possible to maintain all of
735 your projects and notes in a single file. But org-mode's [[http://orgmode.org/manual/Hyperlinks.html#Hyperlinks][quick and
736 easy hyperlinks]], along with [[http://orgmode.org/manual/Refiling-notes.html#Refiling-notes][easy refiling of notes and todos]], also
737 make it a delight to maintain a private "wiki" consisting of multiple
738 files.
740 No matter how you organize your org files, org-mode's agenda commands
741 make it easy to search all your notes and gather together crucial data
742 in a single view.
744 Moreover, several org-mode settings can be configured either globally
745 in your =.emacs= file or locally (per file or per outline tree). See
746 the [[http://orgmode.org/manual/index.html#Top][manual]] for more details. For an example of local customizations
747 see [[limit-agenda-with-category-match][this FAQ]].
749 Here are a few ideas for organizing org-mode files:
751 - A single file for all your projects and notes.
752 - One file per project.
753 - One file per client.
754 - One file per area of responsibility or type of work (e.g.,
755   household, health, work, etc.).
756 - One file for projects, one for appointments, one for reference
757   material, one for someday/maybe items, etc.
758 - A wiki of hyperlinked files that grows and adapts to meet your
759   needs.
761 For more ideas, see some of the links on the [[file:org-tutorials/index.org][org-tutorial index]] or
762 [[file:org-gtd-etc.org][this page on org-mode and GTD]].
764 ** Why doesn't C-c a call the agenda? Why don't some org keybindings work?
765    :PROPERTIES:
766    :CUSTOM_ID: setting-global-keybindings
767    :END:
769 Org-mode has a few global keybindings that the user must set
770 explicitly in an =.emacs= file. These keybindings include the
771 customary shortcut for calling the agenda (=C-c a=). If nothing
772 happens when you type =C-c a=, then make sure that the following lines
773 are in your =.emacs= file:
775 #+BEGIN_SRC emacs-lisp
776 ;; The following lines are always needed.  Choose your own keys.
777 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
778 (global-set-key "\C-cl" 'org-store-link)
779 (global-set-key "\C-ca" 'org-agenda)
780 (global-set-key "\C-cb" 'org-iswitchb)
781 #+END_SRC emacs-lisp
783 You may, of course, choose whatever keybindings work best for you
784 and do not conflict with other modes.
786 Please see [[http://orgmode.org/manual/Activation.html][this section of the manual]] if you have additional
787 questions.
789 ** Why aren't some of the variables I've customized having an effect?
790    :PROPERTIES:
791    :CUSTOM_ID: load-org-after-setting-variables
792    :END:
794 Some org variables have to be set before org.el is loaded or else they
795 will not work. (An example is the new variable
796 =org-enforce-todo-dependencies=.)
798 To make sure all your variables work you should not use =(require
799 'org)=. Instead use the following setting:
801 : (require 'org-install)
803 You should also make sure that you do not require any other =org-...=
804 files in your =.emacs= file before you have set your org variables,
805 since these will also cause org.el to be loaded. To be safe, load org
806 files *after* you have set your variables.
808 ** How can I make sure that timestamps appear in English?
809    :PROPERTIES:
810    :CUSTOM_ID: timestamps-and-system-time-locale
811    :END:
813 If your system's locale is not set to English, but you would like the
814 timestamps in your org-mode files to appear in English, you can set
815 the following variable:
817 #+begin_src emacs-lisp
818   (setq system-time-locale "C")
819 #+end_src
821 ** What does a minimal .emacs look like?
822    :PROPERTIES:
823    :CUSTOM_ID: minimal-emacs
824    :END:
826 Using a stripped down minimal .emacs files removes broken custom
827 settings as the cause of an issue and makes it easy to reproduce for
828 other people.  The example below has system-specific paths that you'll
829 need to change for your own use.
830 #+begin_src emacs-lisp
831   (add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp"))
832   (add-to-list 'auto-mode-alist '("\\.\\(org\\  |org_archive\\|txt\\)$" . org-mode))
833   (setq org-agenda-files '("/tmp/test.org"))
834   (require 'org-install)
835   (require 'org-habit)
837   (global-set-key "\C-cl" 'org-store-link)
838   (global-set-key "\C-ca" 'org-agenda)
839   (global-set-key "\C-cb" 'org-iswitchb)
840 #+end_src
842 You can save the minimal .emacs file to ~/minimal.emacs, add suspect
843 configuration code to it, then start emacs something like this:
844 #+begin_src sh
845   emacs -Q -l ~/minimal.emacs
846 #+end_src
848 On OS X, starting emacs with minimal configuration might look
849 something like this:
850 #+begin_src sh
851   /Applications/emacs.app/Contents/MacOS/Emacs -Q -l ~/minimal.emacs
852 #+end_src sh
854 ** Can I migrate from Planner?
856    Yes.  This [[http://www.c0t0d0s0.de/plan2org/plan2org.pl][perl script]] or [[http://gitorious.org/bkuhn-small-hacks/org-mode/blobs/master/planner2org.plx
857 ][this Perl script]] can help.
859 * Errors and general problems
860   :PROPERTIES:
861   :CUSTOM_ID: Errors
862   :END:
863 ** Opening Org files in Emacs leads to a crash
864    :PROPERTIES:
865    :CUSTOM_ID: Emacs-crashes-with-org-indent-mode
866    :END:
867    The only known case where Org-mode can crash Emacs is when you are
868    using =org-indent-mode= with Emacs 23.1 (in fact, any version of
869    Emacs before version 23.1.50.3).  Upgrade to Emacs 23.2 and the
870    problem should go away.
872 ** When I try to use Org-mode, I always get the error message =(wrong-type-argument keymapp nil)=
873    :PROPERTIES:
874    :CUSTOM_ID: wrong-type-argument-keymapp
875    :END:
877    This is a conflict with an outdated version of the /allout.el/, see
878    the [[http://orgmode.org/manual/Conflicts.html#Conflicts][Conflicts]] section in the manual
880 ** How can I control the application launched by Org-mode to open a certain file type like pdf, html....
881    :PROPERTIES:
882    :CUSTOM_ID: external-application-launched-to-open-file-link
883    :END:
885 If you want special control about how Org-mode opens files, see the
886 variables =org-file-apps=, =org-file-apps-defaults-gnu=,
887 =org-file-apps-defaults-macosx=, =org-file-apps-defaults-windowsnt=.
889 *However*, normally it is best to just use the mechanism the
890 operating-system provides:
892 *** GNU/Linux systems
893     You you have to check your mailcap settings, find the files:
895     : /etc/mailcap
896     :
897     : or
898     :
899     : $HOME/.mailcap
901 and modify them accordingly. Please read their manual entry.
903 *** Windows systems
904     + for html pages you may configure the =browse-url-= variables through
905       the Customize interface,
906     + the pdf files are automatically opened with Acrobat Reader (if it is
907       installed)
909 *** Mac OSX
910     Change the application responsible for this file type by selecting
911     such a file in the Finder, select =File->Get Info= from the menu
912     and select the application to open this file with.  Then, to
913     propagate the change to all files with the same extension, select
914     the =Change all= button.
916 ** Org-mode takes over the TAB key.  I also want to use YASnippet, is there a way to fix this conflict?
917    :PROPERTIES:
918    :CUSTOM_ID: YASnippet
919    :END:
921 [[http://code.google.com/p/yasnippet/][yasnippet]] is yet another snippet expansion system for Emacs.  It is
922 inspired by TextMate's templating syntax.
923 - watch the [[http://www.youtube.com/watch?v=vOj7btx3ATg][video on YouTube]]
924 - see the [[http://yasnippet.googlecode.com/svn/trunk/doc/index.html][intro and tutorial]]
926 *Note*: yasnippet is not compatible with =org-indent-mode= currently
927 there is no known way to use both successfully with =yas/trigger-key=
928 set to =TAB= (or =[tab]= etc...)
930 The way Org-mode binds the =TAB= key (binding to =[tab]= instead of
931 =\t=) overrules yasnippets' access to this key.  The following code
932 fixes this problem:
934 #+begin_src emacs-lisp
935 (add-hook 'org-mode-hook
936           (lambda ()
937             (org-set-local 'yas/trigger-key [tab])
938             (define-key yas/keymap [tab] 'yas/next-field-group)))
939 #+end_src
941 If the above code doesn't work (which it may not with later versions
942 of yasnippet).  Then try the following
944 #+begin_src emacs-lisp
945   (defun yas/org-very-safe-expand ()
946     (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
948   (add-hook 'org-mode-hook
949             (lambda ()
950               ;; yasnippet (using the new org-cycle hooks)
951               (make-variable-buffer-local 'yas/trigger-key)
952               (setq yas/trigger-key [tab])
953               (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
954               (define-key yas/keymap [tab] 'yas/next-field)))
955 #+end_src
957 Rick Moynihan maintains a [[http://github.com/RickMoynihan/yasnippet-org-mode][git repository]] (or [[http://github.com/eschulte/yasnippet-org-mode][Eric's fork of the same]])
958 with YASnippets for Org-mode.
960 ** Org-mode takes over the S-cursor keys.  I also want to use CUA-mode, is there a way to fix this conflict?
961    :PROPERTIES:
962    :CUSTOM_ID: CUA-mode
963    :END:
965 Yes, see the  [[http://orgmode.org/manual/Conflicts.html#Conflicts][Conflicts]] section of the manual.
967 ** Org-mode takes over the S-cursor keys.  I also want to use windmove.el, is there a way to fix this conflict?
968    :PROPERTIES:
969    :CUSTOM_ID: windmove.el
970    :END:
972 Yes, see the [[http://orgmode.org/manual/Conflicts.html#Conflicts][Conflicts]] section of the manual.
974 ** Org behaves strangely: some keys don't work, some features are missing, my settings have no effect, ...
975    :PROPERTIES:
976    :CUSTOM_ID: loaded-old-org
977    :END:
979 When this sort of things happen, it probably is because Emacs is
980 loading an old version of Org-mode instead of the one you expected.
981 Check it with =M-x org-version=.
983 This happens because Emacs loads first the system org-mode (the one
984 included with Emacs) before the one in your directory. Check the
985 =load-path= variable; you might see that your org-mode appears /after/
986 the system-wide path; this is bad.
988 You should add your directories to the =load-path= at the beginning:
990 :  (add-to-list 'load-path "~/.emacs.d/org-mode/lisp") (require 'org-install)
992 Function =add-to-list= adds at the beginning. Don't use =append=
993 because it appends at the end. Also be sure to use =(require
994 'org-install)= and not =(require 'org)=.
996 This wrong version loading may also happen if you have a byte-compiled
997 =org.elc= from an old version together with a new =org.el=. Since
998 Emacs prefers loading byte-compiled files (even if the =.el= is
999 newer), it will load the old Org-mode.
1001 ** Why doesn't org-batch-agenda work under Win32?
1002    :PROPERTIES:
1003    :CUSTOM_ID: org-batch-agenda-under-win32
1004    :END:
1006 When I run the example batch files to print my agenda to the console
1007 under Win32 I get the failure:
1009 : End of file during parsing
1011 and no agenda is printed.
1013 The problem is the use of single quotes surrounding the eval in the
1014 emacs command-line. This gets confused under Win32. All string
1015 parameters with spaces must be surrounded in double quotes. This means
1016 that double quotes being passed to the eval must be escaped.
1018 Therefore, instead of the following:
1020 : <path to emacs>\emacs.exe -batch -l ~/_emacs_org \
1021 :     -eval '(org-batch-agenda "a")'
1023 you need to use the following:
1025 :  <path to emacs>\emacs.exe -batch -l ~/_emacs_org \
1026 :     -eval "(org-batch-agenda \"a\")"
1028 (all on one line, of course).
1030 ** Org agenda seems very slow
1031    :PROPERTIES:
1032    :CUSTOM_ID: slow-agenda
1033    :END:
1035 If it takes a long time to generate or refresh the agenda, you might
1036 want first check which version of org-mode you are using. There have
1037 been major optimizations of org-agenda since 6.21b, which was the
1038 version of org-mode released with Emacs 23. If you are using 6.21b or
1039 earlier (you can check with =M-x org-version=), then you might want to
1040 consider upgrading to a more recent version of org-mode.
1042 Here are some other ideas for speeding up the agenda:
1044 1. Use a one day agenda view (rather than a seven day view).
1046    =(setq org-agenda-ndays 1)=
1048 2. Archive inactive items to separate files.
1050    =C-c C-x C-s= (org-archive-subtree)
1052 3. Do not include the global todo list in your agenda view.
1054    (setq org-agenda-include-all-todo nil)
1056 4. Make sure that your org files are byte-compiled.
1058    I.e., make sure there are files ending in =.elc= in your org
1059    installation directory.
1061 5. Limit your agenda files (=org-agenda-files=) to files that have
1062    active todos and or projects. 
1064    If you have a number of older reference files---i.e., files you
1065    search only occasionally---in your agenda files list, consider
1066    removing them from your agenda files and adding them to
1067    =org-agenda-text-search-extra-files= instead. Similarly, you might
1068    consider searching some of your older reference files with =M-x
1069    grep= so that Org-mode does not have to load them into memory when
1070    the agenda is called.
1072 ** Visual-line-mode doesn't work well with org-mode
1073    :PROPERTIES:
1074    :CUSTOM_ID: visual-line-mode
1075    :END:
1077 Visual-line-mode "soft wraps" lines so that the visual edge of the
1078 buffer is considered a line break for purposes of navigation, even
1079 though there is no line break in reality.
1081 In older versions of org-mode, org-beginning-of-line and
1082 org-end-of-line do not work well with visual line mode. (The two
1083 commands disregard soft line breaks and move to the beginning and end
1084 of the hard line break.) A patch was introduces to fix this behavior
1085 in July of 2009. n
1087 If you are using an older version of org mode, you can:
1089 1. Add a hook to turn off visual line mode.
1091 2. Add the following to your =.emacs=:
1093 #+begin_src emacs-lisp
1095 (add-hook 'org-mode-hook
1096   (lambda ()
1097     (define-key org-mode-map "\C-a" 'move-beginning-of-line)
1098     (define-key org-mode-map "\C-e" 'move-end-of-line)))
1100 #+end_src
1101 ** Can I hide blocks at startup?
1103 Yes:
1105 #+begin_src emacs-lisp
1106 (setq org-hide-block-startup t)
1107 #+end_src
1109 Or use
1111 #+begin_src org
1112 ,#+STARTUP: hideblocks
1113 #+end_src
1115 on a per-file basis.
1117 * Faces and highlighting
1118   :PROPERTIES:
1119   :CUSTOM_ID: Faces
1120   :END:
1121 ** Org-mode has a lot of colors?  How can I change them?
1122    :PROPERTIES:
1123    :CUSTOM_ID: customizing-org-faces
1124    :END:
1126 This is a question that applies to Emacs as a whole, but it comes up
1127 quite frequently on the org-mode mailing list, so it is appropriate to
1128 discuss it here.
1130 If you would like to change the style of a face in org-mode (or any
1131 other Emacs mode), simply type =M-x customize-face [RET]= while the
1132 cursor is on the color/style you are interested in modifying. You will
1133 be given the opportunity to customize all the faces located at that
1134 point.
1136 If you would like an overview of all the faces in org-mode, you can
1137 type =C-u M-x list-faces-display [RET] org= and you will be shown all
1138 the faces defined by org-mode along with an illustration of their
1139 current settings.
1141 If you would like to customize org-faces and other aspects of
1142 org-appearance, type =M-x customize-group org-font-lock [RET]=.
1144 Finally, if you would like verbose information about the properties of
1145 the text under the cursor, you can type =C-u C-x ==.
1147 See the Worg page on [[file:org-tutorials/org-appearance.org][customizing Org appearance]] for further information.
1148 ** Why do I get a tiny font in column view when using emacs daemon?
1149    :PROPERTIES:
1150    :CUSTOM_ID: column-view-tiny-font
1151    :END:
1153 When using emacs in daemon mode (=emacs --daemon=), client frames
1154 sometimes override the column view face settings, resulting in very
1155 small fonts. Here is a fix:
1157 #+begin_src emacs-lisp
1158   (defun org-column-view-uses-fixed-width-face ()
1159   ;; copy from org-faces.el
1160   (when (fboundp 'set-face-attribute)
1161       ;; Make sure that a fixed-width face is used when we have a column
1162       ;; table.
1163       (set-face-attribute 'org-column nil
1164                           :height (face-attribute 'default :height)
1165                           :family (face-attribute 'default :family))))
1167    (when (and (fboundp 'daemonp) (daemonp))
1168     (add-hook 'org-mode-hook 'org-column-view-uses-fixed-width-face))
1169 #+end_src
1171 This fix was provided in the following mailing list post:
1173 http://article.gmane.org/gmane.emacs.orgmode/27560
1174 ** How can I stop the mouse cursor from highlighting lines in the agenda?
1175    :PROPERTIES:
1176    :CUSTOM_ID: ratpoison-for-agenda-highlighting
1177    :END:
1179 You can add the following to your =.emacs=:
1181 #+begin_src emacs-lisp
1182 (add-hook 'org-finalize-agenda-hook
1183     (lambda () (remove-text-properties
1184                (point-min) (point-max) '(mouse-face t))))
1185 #+end_src
1187 * Outline
1188   :PROPERTIES:
1189   :CUSTOM_ID: Outline
1190   :END:
1191 ** Can I have two windows on the same Org-mode file, with different outline visibilities?
1192    :PROPERTIES:
1193    :CUSTOM_ID: indirect-buffers
1194    :END:
1196    You may use /indirect buffers/ which do exactly this.  See the
1197    documentation on the command =make-indirect-buffer=.
1199    Org-mode has built-in commands that allow you create an indirect
1200    buffer from a subtree of an outline. To open a subtree in new
1201    window, type =C-c C-x b=. Any changes you make in the new window
1202    will be saved to the original file, but the visibility of both
1203    buffers will remain independent of one another.
1205    For multiple indirect buffers from the same file, you must use the
1206    prefix =C-u= when creating the second (or third) buffer. Otherwise
1207    the new indirect buffer will replace the old.
1209    You can also create an independent view of an outline subtree by
1210    typing =b= on an item in the agenda.
1212 ** Emacs outlines are unreadable.  Can I get rid of all those stars?
1213    :PROPERTIES:
1214    :CUSTOM_ID: Emacs-outlines-are-unreadable
1215    :END:
1217    See the section [[http://orgmode.org/manual/Clean-view.html#Clean-view][Clean outline view]] in the manual.
1218 ** C-k is killing whole subtrees!  I lost my work!
1219    :PROPERTIES:
1220    :CUSTOM_ID: C-k-is-killing-subtrees
1221    :END:
1223   =(setq org-special-ctrl-k t)= before losing your work.
1225 ** Why aren't commands working on regions?
1226    :PROPERTIES:
1227    :CUSTOM_ID: transient-mark-mode
1228    :END:
1230 Some org-mode commands, such as M-right and M-left for demoting or
1231 promoting headlines (see [[demote-multiple-headlines][this FAQ]]), can be applied to entire regions.
1232 These commands, however, will only work on active regions set with
1233 [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Transient-Mark.html#Transient-Mark][transient mark mode]]. Transient mark mode is enabled by default in
1234 Emacs 23. To enable it in earlier versions of emacs, put the following
1235 in your =.emacs= file:
1237 : (transient-mark-mode 1)
1239 Alternatively, you may turn off transient mark mode and use [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Momentary-Mark.html][a
1240 momentary mark]] (=C-<SPC> C-<SPC>=).
1242 ** Why is a blank line inserted after headlines and list items?
1243    :PROPERTIES:
1244    :ID:       2463F4D8-F686-4CF3-AA07-08976F8A4972
1245    :END:
1246    :PROPERTIES:
1247    :CUSTOM_ID: blank-line-after-headlines-and-list-items
1248    :END:
1250 In org-mode, typing =M-RET= at the end of a headline will create a new
1251 headline of the same level on a new line. The same is true for plain
1252 lists. By default org-mode uses context to determine if a blank line
1253 should be inserted after each headline or plain list item when =M-RET=
1254 is pressed. For instance, if a there is a blank line before a
1255 headline, then typing =M-RET= at the end of the line will insert a
1256 blank line before the new headline. For instance, hitting =M-RET=
1257 at the end of "Headline Two" below inserts a new headline without a
1258 blank line:
1260 : ** Headline One
1261 : ** Headline Two
1262 : **
1264 If there is a blank line between Headline One and Headline Two,
1265 however, the results will be as follows:
1267 : ** Headline One
1269 : ** Headline Two
1271 : **
1273 If you do not like the default behavior you can change it with the
1274 variable =org-blank-before-new-entry=. You can set headings and/or
1275 plain lists to auto (the default setting), t (always), or nil (never).
1277 ** How can I promote or demote multiple headlines at once?
1278    :PROPERTIES:
1279    :CUSTOM_ID: demote-multiple-headlines
1280    :END:
1282 If you have a long list of first level headlines that you'd like to
1283 demote to second level headlines, you can select the headlines as a
1284 region and then hit =M-<right>= to demote all the headlines at once.
1286 Note: =M-S-<right>= will not work on a selected region. Its use is to
1287 demote a single subtree (i.e., a headline and all sub-headlines).
1289 If M-<right> doesn't seem to work, make sure transient mark mode is
1290 enabled. See [[transient-mark-mode][this FAQ]].
1292 ** What's the deal with all the ellipses in my org outlines?
1293    :PROPERTIES:
1294    :CUSTOM_ID: org-ellipses
1295    :END:
1297 Org-mode uses ellipses to indicate folded (and thus hidden) text. Most
1298 commonly, ellispes occur at the end of headings with folded content:
1300 : * Heading ...
1302 Or, for instance, they may indicate closed drawers:
1304 : :PROPERTIES: ...
1306 Sometimes, as a result of editing and cycling an outline, ellipses may
1307 appear in unexpected places. You should *never* delete these ellipses,
1308 as you may accidentally delete hidden text. Instead, you can type =C-c
1309 C-r= (org-reveal) to display all hidden text in the vicinity. Or you
1310 may type =M-x RET show-all= to reveal all text in the org file.
1312 If you would prefer a symbol or face for indicating hidden text, you
1313 can customize the variable org-ellipses.
1315 ** How do I yank a subtree so it's indented according to the point's location?
1316    :PROPERTIES:
1317    :CUSTOM_ID: yank-indent-subtree
1318    :END:
1320 You can either use =C-c C-w= with a working [[http://orgmode.org/manual/Refiling-notes.html#Refiling-notes][refile-targets]] setup.
1322 Or set =org-yank-adjusted-subtrees= to =t= which will adjust the
1323 yanked headline's level correctly.
1325 Just use =C-k= and =C-y= as you would everywhere else in Emacs.
1327 ** Can I read org-mode outlines in vim?
1328    :PROPERTIES:
1329    :CUSTOM_ID: org-outlines-in-vim
1330    :END:
1332 Yes, there is a script that enables one to view and navigate folded
1333 outline/org files in vim (though without most of org-mode's
1334 functionality, of course).
1336   - [[http://www.vim.org/scripts/script.php?script_id%3D1266][Emacs outline mode - Imitates Emacsen : vim online]]
1338 For instructions on how to set it up, please see [[http://mid.gmane.org/EA275862-B97A-4BAC-B879-177FD07A2D56@gaillourdet.net][this mailing list
1339 post]].
1341 Work is also underway on an org-mode clone for Vim. You can check it
1342 out on git hub:
1344 https://github.com/hsitz/VimOrganizer
1346 * Todos and Tags
1347   :PROPERTIES:
1348   :CUSTOM_ID: Todos-and-Tags
1349   :END:
1350 ** How can I cycle through the TODO keyword of an entry?
1351    :PROPERTIES:
1352    :CUSTOM_ID: cycle-TODO-keywords
1353    :END:
1355   =C-c C-t= or =S-<left/right>= is what you need.
1357 ** How do I track state changes for tasks in Org?
1358    :PROPERTIES:
1359    :CUSTOM_ID: track-state-changes-for-tasks
1360    :END:
1362   Take a look at the [[http://thread.gmane.org/gmane.emacs.orgmode/6082][post by Bernt Hansen]] for setting up TODO keyword
1363   states and logging timestamps for task state changes.
1365 ** Can I select the TODO keywords with a tag-like interface?
1366    :PROPERTIES:
1367    :CUSTOM_ID: select-TODO-keywords-with-tag-like-interface
1368    :END:
1370   Yes.  Use =(setq org-use-fast-todo-selection t)=
1372   If you want to set both your todos and your tags using a single
1373   interface, then check out the variable
1374   =org-fast-tag-selection-include-todo=.
1376   See [[http://orgmode.org/manual/Fast-access-to-TODO-states.html][this section of the manual]] for more details.
1378 ** How can I quickly set the tag of an entry?
1379    :PROPERTIES:
1380    :CUSTOM_ID: quickly-set-tag-of-entry
1381    :END:
1383    Use =C-c C-c= or =C-c C-q= on the headline. =C-c C-q= is useful for
1384    setting tabs in a [[http://orgmode.org/manual/Remember.html#Remember][remember]] buffer, since =C-c C-c= is the default
1385    keybinding for filing a note from the remember buffer.
1387    You can set tags even more quickly by setting one of the character
1388    shortcuts for [[http://orgmode.org/manual/Setting-tags.html#Setting-tags][fast tag selection]].
1390    To set tag shortcuts for all org buffers, put something like the
1391    following in your =.emacs= file (or create the same settings by
1392    typing =M-x customize-variable RET org-tag-alist=):
1394 : (setq org-tag-alist '(("computer" . ?c) ("office" . ?o) ("home" . ?h)))
1396    To set tag shortcuts for a single buffer, put something like the
1397    following at the top of your org file:
1399 : #+TAGS: computer(c) office(o) home(h)
1401 ** How can I change the colors of TODO keywords?
1403 You can use the variable org-todo-keyword-faces. Here are some sample
1404 settings:
1406 #+begin_src emacs-lisp
1407 (setq org-todo-keyword-faces
1408       '(
1409         ("TODO"  . (:foreground "firebrick2" :weight bold))
1410         ("WAITING"  . (:foreground "olivedrab" :weight bold))
1411         ("LATER"  . (:foreground "sienna" :weight bold))
1412         ("PROJECT"  . (:foreground "steelblue" :weight bold))
1413         ("DONE"  . (:foreground "forestgreen" :weight bold))
1414         ("MAYBE"  . (:foreground "dimgrey" :weight bold))
1415         ("CANCELED"  . shadow)
1416         ))
1417 #+end_src
1419 If you want to change the color of all active todos or all inactive
1420 todos, type:
1422 : M-x customize-face RET org-todo
1423 : M-x customize-face RET org-done
1425 You can also set values for each of these in your =.emacs= file:
1427 : (set-face-foreground 'org-todo "firebrick2")
1428 : (set-face-foreground 'org-done "forestgreen")
1430 * Hyperlinks
1431   :PROPERTIES:
1432   :CUSTOM_ID: Hyperlinks
1433   :END:
1434 ** Why do I have to confirm the execution of each shell/elisp link?
1435    :PROPERTIES:
1436    :CUSTOM_ID: confirm-shell/elisp-link
1437    :END:
1439    The confirmation is there to protect you from unwantingly execute
1440    potentially dangerous commands.  For example, imagine a link
1442    : [[shell:rm -rf ~/*][Google Search]]
1444    In an Org-mode buffer, this command would look like /Google Search/,
1445    but really it would remove your home directory.  If you wish, you can
1446    make it easier to respond to the query by setting
1448    : (setq org-confirm-shell-link-function 'y-or-n-p
1449    :       org-confirm-elisp-link-function 'y-or-n-p).
1451    Then a single keypress will be enough to confirm those links.  It is
1452    also possible to turn off this check entirely, but I strongly
1453    recommend against this.  Be warned.
1455 ** Can I use RET or TAB to follow a link?
1456    :PROPERTIES:
1457    :CUSTOM_ID: RET-or-TAB-to-follow-link
1458    :END:
1460    Yes, this is how:
1462    : (setq org-return-follows-link t)
1463    : (setq org-tab-follows-link t)
1465 ** Can I keep mouse-1 clicks from following a link?
1466    :PROPERTIES:
1467    :CUSTOM_ID: mouse-1-following-link
1468    :END:
1470    Activating links with =mouse-1= is a new feature in Emacs 22, to make
1471    link behavior similar to other applications like web browsers.  If
1472    you hold the mouse button down a bit longer, the cursor will be set
1473    without following the link.  If you cannot get used to this behavior,
1474    you can (as in Emacs 21) use =mouse-2= to follow links and turn off
1475    link activation for =mouse-1= with
1477    : (setq org-mouse-1-follows-link nil)
1479 ** How can I get completion of file names when creating a link?
1480    :PROPERTIES:
1481    :CUSTOM_ID: completion-of-file-links
1482    :END:
1484 You can use org-insert-link with a prefix argument:
1486 : C-u C-c C-l
1488 You will be greeted with prompt in the minibuffer that allows for file
1489 completion using your preferred Emacs method for finding files.
1491 ** How can I use invisible targets within lists?
1492    :PROPERTIES:
1493    :CUSTOM_ID: invisible-targets-in-lists
1494    :END:
1496 The usual way of turning radio links invisible is to comment them, but
1497 Org comments need to be at the beginning of the line, which breaks list
1498 indentation.  
1500 The workaround here is to add (INVISIBLE) after your <<target>>
1502 For example:
1504 : 11. <<target>>(INVISIBLE)
1505 :     Some text
1506 : 12. More text [[target][go to]]
1508 ** Org-mode is not opening mailto links in my default mail client
1509    :PROPERTIES:
1510    :CUSTOM_ID: mailto-links
1511    :END:
1513 You can customize the function org-mode uses to open mailto links by
1514 setting the variable =org-link-mailto-program=:
1516 =M-x customize-variable org-link-mailto-program=
1518 The default function called is =browse-url=, which opens a mail
1519 composition buffer within Emacs. The type of buffer opened by
1520 browse-url depends on the setting of the variable =mail-user-agent=.
1521 Thus, if you want to ensure that mailto links use Gnus to open a
1522 message buffer, you could add the following to your =.emacs=:
1524 #+begin_src elisp
1525 (setq mail-user-agent 'gnus-user-agent)
1526 #+end_src
1528 ** Can I use CamelCase links?
1529    :PROPERTIES:
1530    :CUSTOM_ID: CamelCase-links
1531    :END:
1533 Yes, you can with the contributed package org-wikinodes.el. Please
1534 consult the [[http://orgmode.org/worg/org-contrib/org-wikinodes.html][documentation]].
1536 * Plain Lists
1537   :PROPERTIES:
1538   :CUSTOM_ID: Plain-Lists
1539   :END:
1540 ** How can I insert an empty line before each newly inserted headline, but not before each newly inserted plain-list item?
1541    :PROPERTIES:
1542    :CUSTOM_ID: empty-line-before-each-new-headline-but-not-item
1543    :END:
1545 : (setq org-blank-before-new-entry
1546 :       '((heading . t) (plain-list-item . nil))
1548 See also [[id:2463F4D8-F686-4CF3-AA07-08976F8A4972][Why is a blank line inserted after headlines and list items?]].
1550 ** How can I convert itemized lists to enumerated lists?
1551    :PROPERTIES:
1552    :CUSTOM_ID: convert-itemized-to-enumerated-lists
1553    :END:
1555    You can use =C-c -= or =S-<left>/<right>= to cycle through the various
1556    bullet headlines available for lists: =-, +, *, 1., 1)=.
1558    See [[http://orgmode.org/manual/Plain-lists.html#Plain-lists][this section of the manual]] for more information.
1560 ** How can I convert plain lists to headlines and vice versa?
1561    :PROPERTIES:
1562    :CUSTOM_ID: convert-plain-lists-to-headlines
1563    :END:
1565    To convert a plain list item or line to a headline, type =C-c *= on
1566    the headline. This will make the line a subheading of the current
1567    headline.
1569    To convert a headline to a plain list item, type =C-c -= while the
1570    cursor is on the headline.
1572    To convert a headline to an unadorned line of text, type =C-c *= on
1573    the headline.
1575    You can use query replace to accomplish the same things, as Bernt
1576    Hansen explains in [[http://article.gmane.org/gmane.emacs.orgmode/10148][this mailing list post]].
1578 ** Is there a good way to create a description list?
1579    :PROPERTIES:
1580    :CUSTOM_ID: description-lists
1581    :END:
1583   Yes, these are now built-in:
1585 #+BEGIN_EXAMPLE
1586 - item1 :: Description of this item 1
1587 - item2 :: Description of this item 2
1588 - item1 :: Description of this item 3
1589       also in multiple lines
1590 #+END_EXAMPLE
1592 * Tables
1593   :PROPERTIES:
1594   :CUSTOM_ID: Tables
1595   :END:
1596 ** Will there ever be support for multiple lines in a table field?
1597    :PROPERTIES:
1598    :CUSTOM_ID: table-multiline-fields
1599    :END:
1601    No.
1603    You can embed tables created with the table.el package in org-mode
1604    buffers, withmixed success when it comes to export and publishing.
1606 ** How can I make table alignment work with Asian character sets
1607    :PROPERTIES:
1608    :CUSTOM_ID: table-alignment-asian-characters
1609    :END:
1611 When table alignment fails, it usually has to do with character sets
1612 where some characters have non-integer width.  Org will deal correctly
1613 with characters that are one or two or three ASCII characters wide,
1614 but not with characters that are, for example, 1.5 ASCII characters
1615 wide.  To make table alignment work you need to switch to a different
1616 character set.
1618 ** Can I plot data from a table?
1619    :PROPERTIES:
1620    :CUSTOM_ID: plotting-table-data
1621    :END:
1623    Yes, you can, using org-plot.el written by Eric Schulte and now
1624    bundled with Org.  See [[http://orgmode.org/manual/Org_002dPlot.html#Org-Plot][the manual section about this]].
1626    See also [[file:org-tutorials/org-plot.org][this excellent tutorial]] by Eric Schulte.
1628 ** How can I fill a table column with incremental numbers?
1629    :PROPERTIES:
1630    :CUSTOM_ID: fill-table-column-with-incremental-numbers
1631    :END:
1633 Here is how: Use a field formula to set the first value in the column:
1635 #+begin_src org
1636 ,| N   |   |
1637 ,|-----+---|
1638 ,| :=1 |   |
1639 ,|     |   |
1640 ,|     |   |
1641 ,|     |   |
1642 ,#+TBLFM: @2$1=1
1643 #+end_src
1645 Then define a column formula in the second field:
1647 #+begin_src org
1648 ,| N        |   |
1649 ,|----------+---|
1650 ,| 1        |   |
1651 ,| =@-1 + 1 |   |
1652 ,|          |   |
1653 ,|          |   |
1654 ,#+TBLFM: @2$1=1
1655 #+end_src
1657 After recomputing the table, the column will be filled with
1658 incremental numbers:
1660 #+begin_src org
1661 ,| N |   |
1662 ,|---+---|
1663 ,| 1 |   |
1664 ,| 2 |   |
1665 ,| 3 |   |
1666 ,| 4 |   |
1667 ,#+TBLFM: $1=@-1 + 1::@2$1=1
1668 #+end_src
1670 Note that you could use arbitrary starting values and column formulas.
1672 ** Why does my table column get filled with #ERROR?
1673    :PROPERTIES:
1674    :CUSTOM_ID: table-column-filled-with-ERROR
1675    :END:
1677    Org-mode tried to compute the column from other fields using a
1678    formula stored in the =#+TBLFM:= line just below the table, and
1679    the evaluation of the formula fails.  Fix the fields used in the
1680    formula, or fix the formula, or remove it!
1682 ** How can I stop the table editor from creating new lines?
1683    :PROPERTIES:
1684    :CUSTOM_ID: table-editor-creates-new-lines
1685    :END:
1687    When I am in the last column of a table and just above a horizontal
1688    line in the table, pressing TAB creates a new table line before the
1689    horizontal line.  To move to the line below the
1690    horizontal line instead, do this:
1692    Press =down= (to get on the separator line) and then =TAB=.
1693    Or configure the variable
1695    : (setq org-table-tab-jumps-over-hlines t)
1697 ** How can I get table fields starting with "="?
1698    :PROPERTIES:
1699    :CUSTOM_ID: table-fields-starting-with-=
1700    :END:
1702    With the setting
1704    : (setq org-table-formula-evaluate-inline nil)
1706    this will no longer happen.  You can still use formulas using the
1707    commands @<tt>C-c =@</tt> and @<tt>C-u C-c =@</tt>
1709 ** How can I change the indentation of an entire table without fixing every line by hand?
1710    :PROPERTIES:
1711    :CUSTOM_ID: change-indentation-entire-table
1712    :END:
1714    The indentation of a table is set by the first line.  So just fix the
1715    indentation of the first line and realign with =TAB=.
1717 ** In my huge table the realigning after each TAB takes too long.  What can I do?
1718    :PROPERTIES:
1719    :CUSTOM_ID: table-realigning-after-TAB-takes-long
1720    :END:
1722    Either split the table into several by inserting an empty line every
1723    100 lines or so.  Or turn off the automatic re-align with
1725    : (setq org-table-automatic-realign nil)
1727    After this the only way to realign a table is to press =C-c C-c=.  It
1728    will no longer happen automatically, removing the corresponding delays
1729    during editing.
1731 ** Recalculation of my table takes too long.  What can I do?
1732    :PROPERTIES:
1733    :CUSTOM_ID: Recalculation-of-my-table-takes-too-long
1734    :END:
1736    Nothing, really.  The spreadsheet in org is mostly done to make
1737    calculations possible, not so much to make them fast.  Since Org-mode
1738    is firmly committed to the ASCII format, nothing is stopping you from
1739    editing the table by hand.  Therefore, there is no internal
1740    representation of the data.  Each time Org-mode starts a computation,
1741    it must scan the table for special lines, find the fields etc.  This
1742    is slow.  Furthermore, Calc is slow compared to hardware
1743    computations.  To make this work with normal editing, recalculation
1744    is not happening automatically, or only for the current line, so that
1745    the long wait for a full table iteration only happens when you ask
1746    for it.
1748    So for really complex tables, moving to a "real" spreadsheet may
1749    still be the best option.
1751    That said, there are some ways to optimize things in Org-mode, and I
1752    have been thinking about moving a bit further down this line.
1753    However, for my applications this has so far not been an issue at
1754    all.  If you have a good case, you could try to convince me.
1756 ** =S-RET= in a table keeps increasing the copied numbers.  How can I stop this?
1757    :PROPERTIES:
1758    :CUSTOM_ID: S-RET-in-a-table-increases-copied-numbers
1759    :END:
1761    Well, it is /supposed/ to be a feature, to make it easy to create a
1762    column with increasing numbers.  If this gets into your way, turn it
1763    off with
1765    : (setq org-org-table-copy-increment nil)
1767 ** When I export tables to html, they don't have borders.
1768    :PROPERTIES:
1769    :CUSTOM_ID: table-borders-in-html-export
1770    :END:
1772 By default, org mode exports tables without borders.
1774 You can changed this by placing an =#+ATTR_HTML= line before the
1775 table:
1777 :  #+ATTR_HTML: border="2" rules="all" frame="all"
1779 See [[http://orgmode.org/manual/Tables-in-HTML-export.html#Tables-in-HTML-export][the manual]] for more details.
1781 ** Why does the Calc high precision (e. g. =p20=) not work like expected?
1782    :PROPERTIES:
1783    :CUSTOM_ID: table-high-precision
1784    :END:
1786 - *Short answer*
1788   Avoid
1789   : | 1 / 2 * 3 | 0.16666667000000 |
1790   : #+TBLFM: $2 = $1; p20 %.14f
1792   and use
1793   : | 1 / 2 * 3 | 0.16666666666667 |
1794   : #+TBLFM: $2 = $1 +.0; p20 f-14
1796 - *Longer answer*
1798   It is important to distinguish between the precision of
1799   1) =p20=: Calc internal calculation (=calc-internal-prec=)
1800   2) =f-14=: Calc float formatting, unlimited in precision (=calc-float-format=)
1801   3) =%.14f=: the =printf= reformatting, limited in precision
1803   See [[http://orgmode.org/manual/Formula-syntax-for-Calc.html#Formula-syntax-for-Calc][the Org manual]] (org-version 6.35 or newer) for more details.
1805   Use =C-h v org-calc-default-modes RET= to check the Org default settings
1806   which are used if no format specifiers are added to a table formula.
1807   The examples below have been made with the out_of_the_box Org defaults
1808   =calc-internal-prec = 12= and =calc-float-format = 8=.
1810   Remember the formula debugger, toggled with =C-c {=,
1811   to view the processing stages like:
1812   |   | formula debugger label | processing stage           |
1813   | / | <                      | <>                         |
1814   |---+------------------------+----------------------------|
1815   |   | Result:                | output of Calc             |
1816   |   | Format:                | reformatting with =printf= |
1818   Following are some examples to demonstrate
1819   the interaction of the three precisions.
1821   - *display precision limitations for Calc formulas*
1822     - limited by Calc internal calculation precision from Org default
1823       (here =p12=)
1824       : | 0.16666666666700 |
1825       : #+TBLFM: $1 = 1 / 2 * 3;     f-14
1827       : | 0.1666666666670000000 |
1828       : #+TBLFM: $1 = 1 / 2 * 3;     f-19
1830     - limited by Calc float format from Org default (here =f8=)
1831       : | 0.16666667 |
1832       : #+TBLFM: $1 = 1 / 2 * 3
1834       : | 0.16666667 |
1835       : #+TBLFM: $1 = 1 / 2 * 3; p20
1837       : | 0.16666667000000 |
1838       : #+TBLFM: $1 = 1 / 2 * 3;          %.14f
1840       : | 0.16666667000000 |
1841       : #+TBLFM: $1 = 1 / 2 * 3; p20      %.14f
1843     - limited by Calc float format specified
1844       : | 0.166667 |
1845       : #+TBLFM: $1 = 1 / 2 * 3;     f-6
1847       : | 0.16666666666667 |
1848       : #+TBLFM: $1 = 1 / 2 * 3; p20 f-14
1850       : | 0.1666666666666666667 |
1851       : #+TBLFM: $1 = 1 / 2 * 3; p20 f-19
1853     - limited by =printf= conversion to Emacs Lisp float
1854       : | 0.1666666699999999900 | the inaccuracy is platform dependent |
1855       : #+TBLFM: $1 = 1 / 2 * 3;          %.19f
1857       : | 0.1666666699999999900 | the inaccuracy is platform dependent |
1858       : #+TBLFM: $1 = 1 / 2 * 3; p20      %.19f
1860       : | 0.1666666666666666600 | the inaccuracy is platform dependent |
1861       : #+TBLFM: $1 = 1 / 2 * 3; p20 f-20 %.19f
1863     - limited by =printf= format specified
1864       : | 0.166667 |
1865       : #+TBLFM: $1 = 1 / 2 * 3;         %.6f
1867   - *display precision limitations for Emacs Lisp formulas*
1868     - limited by Emacs Lisp float
1869       : | 0.16666666666666666 |
1870       : #+TBLFM: $1 = '(/ 1.0 (* 2 3))
1872       : | 0.1666666666666666574 | the inaccuracy is platform dependent |
1873       : #+TBLFM: $1 = '(/ 1.0 (* 2 3)); %.19f
1875     - limited by =printf= format specified
1876       : | 0.16666666666667 |
1877       : #+TBLFM: $1 = '(/ 1.0 (* 2 3)); %.14f
1879 This FAQ entry is based on this [[http://thread.gmane.org/gmane.emacs.orgmode/22642][mailing list thread]]
1880 and is continued in the [[#table-float-fraction][next FAQ entry]].
1882 ** Which float format shows the fraction part also when the latter is zero?
1883    :PROPERTIES:
1884    :CUSTOM_ID: table-float-fraction
1885    :END:
1887 - *Short answer*
1889   Avoid
1890    : | 1 | 1 |
1891    : #+TBLFM: $2 = $1; f-3
1892   and use
1893    : | 1 | 1.000 |
1894    : #+TBLFM: $2 = $1 +.0; f-3
1896 - *Longer answer*
1898   For =f3= and =f-3= see =`d f' (`calc-fix-notation')= in [[http://www.delorie.com/gnu/docs/calc/calc.html#SEC_Top][the Calc manual]]
1899   in the section Mode Settings -> Display Modes -> Float Formats
1900   [[http://www.delorie.com/gnu/docs/calc/calc_163.html][found here as long as the section numbering is unchanged]].
1902   Remember the formula debugger, toggled with =C-c {=,
1903   to view the processing stages like:
1904   |   | formula debugger label | processing stage           |
1905   | / | <                      | <>                         |
1906   |---+------------------------+----------------------------|
1907   |   | Result:                | output of Calc             |
1908   |   | Format:                | reformatting with =printf= |
1910   Following are some examples to demonstrate different float formats.
1912   - normal precision
1913     : |-----------+---------+-------+---------+----------+-------|
1914     : |    number |      f3 |   f-3 | +.0; f3 | +.0; f-3 |  %.3f |
1915     : |-----------+---------+-------+---------+----------+-------|
1916     : |         1 |       1 |     1 |   1.000 |    1.000 | 1.000 |
1917     : |         0 |       0 |     0 |   0.000 |    0.000 | 0.000 |
1918     : |-----------+---------+-------+---------+----------+-------|
1919     : |       1.0 |   1.000 | 1.000 |   1.000 |    1.000 | 1.000 |
1920     : |       0.0 |   0.000 | 0.000 |   0.000 |    0.000 | 0.000 |
1921     : |-----------+---------+-------+---------+----------+-------|
1922     : | 1.0001666 |   1.000 | 1.000 |   1.000 |    1.000 | 1.000 |
1923     : | 0.0001666 | 1.67e-4 | 0.000 | 1.67e-4 |    0.000 | 0.000 |
1924     : |-----------+---------+-------+---------+----------+-------|
1925     : | 1.0016666 |   1.002 | 1.002 |   1.002 |    1.002 | 1.002 |
1926     : | 0.0016666 |   0.002 | 0.002 |   0.002 |    0.002 | 0.002 |
1927     : |-----------+---------+-------+---------+----------+-------|
1928     : #+TBLFM: $2 = $1; f3 :: $3 = $1; f-3 :: $4 = $1 +.0; f3 :: $5 = $1 +.0; f-3 :: $6 = $1; %.3f
1930   - high precision
1931     : |----------------------+--------------------------+-----------------------|
1932     : | number               |                      f19 |                  f-19 |
1933     : |----------------------+--------------------------+-----------------------|
1934     : | 1                    |                        1 |                     1 |
1935     : | 0                    |                        0 |                     0 |
1936     : |----------------------+--------------------------+-----------------------|
1937     : | 1.0                  |    1.0000000000000000000 | 1.0000000000000000000 |
1938     : | 0.0                  |    0.0000000000000000000 | 0.0000000000000000000 |
1939     : |----------------------+--------------------------+-----------------------|
1940     : | 1 + 1 / 2 * 3 * 1e19 |    1.0000000000000000000 | 1.0000000000000000000 |
1941     : | 0 + 1 / 2 * 3 * 1e19 | 1.666666666666666667e-20 | 0.0000000000000000000 |
1942     : |----------------------+--------------------------+-----------------------|
1943     : | 1 + 1 / 2 * 3 * 1e18 |    1.0000000000000000002 | 1.0000000000000000002 |
1944     : | 0 + 1 / 2 * 3 * 1e18 |    0.0000000000000000002 | 0.0000000000000000002 |
1945     : |----------------------+--------------------------+-----------------------|
1946     : #+TBLFM: $2 = $1; p20 f19 :: $3 = $1; p20 f-19
1948     : |----------------------+--------------------------+-----------------------|
1949     : | number               |                 +.0; f19 |             +.0; f-19 |
1950     : |----------------------+--------------------------+-----------------------|
1951     : | 1                    |    1.0000000000000000000 | 1.0000000000000000000 |
1952     : | 0                    |    0.0000000000000000000 | 0.0000000000000000000 |
1953     : |----------------------+--------------------------+-----------------------|
1954     : | 1.0                  |    1.0000000000000000000 | 1.0000000000000000000 |
1955     : | 0.0                  |    0.0000000000000000000 | 0.0000000000000000000 |
1956     : |----------------------+--------------------------+-----------------------|
1957     : | 1 + 1 / 2 * 3 * 1e19 |    1.0000000000000000000 | 1.0000000000000000000 |
1958     : | 0 + 1 / 2 * 3 * 1e19 | 1.666666666666666667e-20 | 0.0000000000000000000 |
1959     : |----------------------+--------------------------+-----------------------|
1960     : | 1 + 1 / 2 * 3 * 1e18 |    1.0000000000000000002 | 1.0000000000000000002 |
1961     : | 0 + 1 / 2 * 3 * 1e18 |    0.0000000000000000002 | 0.0000000000000000002 |
1962     : |----------------------+--------------------------+-----------------------|
1963     : #+TBLFM: $2 = $1 +.0; p20 f19 :: $3 = $1 +.0; p20 f-19
1965     The =printf= reformatting (=%.19f=) cannot be used with high precision,
1966     see the [[#table-high-precision][previous FAQ entry]].
1968 ** How can I center tables in LaTeX output?
1969    :PROPERTIES:
1970    :CATEGORY: centered-tables-in-latex
1971    :END:
1973 Set the `org-export-latex-tables-centered' to `t':
1975 : (defcustom org-export-latex-tables-centered t
1976 :   "When non-nil, tables are exported in a center environment."
1977 :   :group 'org-export-latex
1978 :   :type 'boolean)
1980 * Markup
1981   :PROPERTIES:
1982   :CUSTOM_ID: Footnotes
1983   :END:
1984 ** How can I get automatic renumbering of footnotes in org-mode?
1985    :PROPERTIES:
1986    :CUSTOM_ID:       footnote-auto-adjust
1987    :END:
1989 You can add the following line to your .emacs file:
1991 : (setq org-footnote-auto-adjust t)
1993 Or, if you prefer, you can turn this option on locally by placing the
1994 following line at the top of your org file:
1996 : #+STARTUP: fnadjust
1998 When auto-adjust is turned on, footnotes in the file with numerical
1999 labels will be renumbered whenever a new footnote is added. Meanwhile,
2000 all footnotes, including those with custom labels such
2001 =[fn:custom-label ]=, will be sorted in the order of their appearance
2002 in the text.
2004 This emulates the footnote behavior that many users may be familiar
2005 with from word-processing programs or from the footnote-mode included
2006 with emacs.
2008 If you do not turn on org-footnote-auto-adjust, you sort and/or
2009 renumber footnotes at any time by calling org-footnote-action with a
2010 prefix argument.
2012 ** Why isn't auto renumbering of footnotes turned on by default?
2013    :PROPERTIES:
2014    :CUSTOM_ID:       why-no-default-auto-adjust
2015    :END:
2017 Org mode has a very robust footnote mechanism allowing for a variety
2018 of types of footnotes. With some of the following footnote notations,
2019 auto-adjust may be either irrelevant or undesired:
2021  - Automatically numbered
2022  - Footnotes with custom labels
2023  - Inline footnotes
2025 In addition, org mode can be customized to place footnotes either at
2026 the end of a document or at the end of the outline heading in which
2027 they appear. Users who change this setting while editing a document
2028 may be disconcerted to find all of their footnotes rearranged
2029 automatically.
2031 ** I have auto-fill-mode set and org-mode is inserting unwanted comment markers!
2032    :PROPERTIES:
2033    :CUSTOM_ID: auto-fill-and-unwanted-comments
2034    :END:
2036 If the following occurs:
2038 #+begin_src org
2039   ,#+OPTIONS: toc:nil
2040   ,Some entered text.
2041   ,# More entered tex.
2042 #+end_src
2044 Make sure that the variable comment-start is nil.
2046 ** Are there any shortcuts for entering source blocks and comment lines?
2047    :PROPERTIES:
2048    :CUSTOM_ID: shortcuts-for-entering-source-blocks
2049    :END:
2051 Org mode has some [[http://orgmode.org/manual/Literal-examples.html#Literal-examples][very convenient markup]] for including literal blocks
2052 and lines of code in a file. (This is especially useful when exporting
2053 documents or using the contributed package [[file:org-contrib/babel/index.org][org-babel]] for executing
2054 blocks of code.)
2056 #+begin_src org
2057   ,#+begin_src perl
2058   ,  print "Hello, world!\n";
2059   ,#+end_src
2060 #+end_src
2062 It can be tiresome to enter the block comment lines manually. There
2063 are several possible shortcuts you can use to enter them:
2065 1) Built-in expansion
2067    - Org mode has a "secret" method of expanding source code blocks
2068      and comment lines.
2070    - If you type "<s" followed by =TAB= or =M-TAB=, a source block will
2071      magically appear.
2073    - For a full list of expansions, type =M-x describe-variable
2074      [RET] org-structure-template-alist=.
2076 2) [[http://orgmode.org/manual/Literal-examples.html#Literal-examples][Registers]]
2078    - Add the following line to your emacs file:
2080      =(set-register ?p "#+begin_src\n\n#+end_src perl")=
2082    - Then type =C-x r i p= to insert the source block. Please note: if
2083      you save another value to the register "p" with =C-x r s p=, it
2084      will overwrite the setting above for the current emacs session.
2086 3) [[http://orgmode.org/manual/Literal-examples.html#Literal-examples][Abbrevs]]
2088    - Activate the abbrev minor-mode in org-mode:
2090      + M-x abbrev-mode
2092      + /Permanently/:
2094        + =(add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))=
2096    - In org-mode, type "sbp" (a sample abbreviation for a perl source
2097      block).
2099    - Immediately after "sbp" type =C-x a i l=.
2101    - Enter the expansion:
2103      - =#+begin_src perl[C-q C-j][C-q C-j]#+end_src=
2105      - Note: =C-q C-j= creates a new line in the minibuffer
2107    - Now, whenever, you type sbp followed by =SPACE= or =RET= in an
2108      org-mode buffer, the src block will magically appear.
2110    - To review your list of abbrevs, type =M-x edit-abbrevs=.
2112 4) [[http://www.slashgear.com/nokia-n900-android-dual-boot-hack-video-2371099/][Skeletons]]
2114    - Skeletons offer a simple way of automatically entering text.
2115      Here's a skeleton that queries for the type of block and wraps
2116      the active region inside it:
2118      #+begin_src elisp
2119        (define-skeleton skel-org-block
2120          "Insert an org block, querying for type."
2121          "Type: "
2122          "#+begin_" str "\n"
2123          _ - \n
2124          "#+end_" str "\n")
2125      #+end_src
2127    - Simply type skel-org-block to insert the block.
2129      - You can bind this to a key.
2131      - You can also create an abbrev that invokes this function:
2133        : (define-abbrev org-mode-abbrev-table "blk" "" 'skel-org-block)
2135 5) [[http://code.google.com/p/yasnippet/][Yasnippet]]
2137    - Several org-mode users install yasnippet for convenient, complex
2138      expansion.
2140    - See Bernt Hansen's [[http://doc.norang.ca/org-mode.html#Yasnippets][org-mode setup]] for a good introduction to
2141      yasnippet.
2143 * Capture and remember
2144   :PROPERTIES:
2145   :CUSTOM_ID: Remember
2146   :END:
2147 ** Can I use a variable or a function inside the `org-capture-templates' variable?
2148    :PROPERTIES:
2149    :CUSTOM_ID: variable-inside-capture-templates
2150    :END:
2152 Yes.  Use [[http://www.gnu.org/s/emacs/manual/html_node/elisp/Backquote.html][backquotes]].
2154 E.g. if you have a variable called =org-test-file= and you want the
2155 variable =org-capture-templates= to "understand" (i.e. evaluate)
2156 =org-test-file= when Emacs evaluates the =(setq org-capture-templates
2157 [...])= expression, use backquotes like this:
2159 #+begin_src emacs-lisp
2160 (setq org-capture-templates
2161       `(("t" "Todo" entry (file+headline ,org-test-file "Tasks")
2162        "* TODO %?\n  %i\n  %a")
2163       ("b" "Buy" item (file+olp ,org-test-file "Stuff to Buy" "House")
2164        "")))
2165 #+end_src
2167 ** Can I use the remember buffer to clock a customer phone call?
2168    :PROPERTIES:
2169    :CUSTOM_ID: use-remember-buffer-to-clock-phone-call
2170    :END:
2172   Yes, you can.  Take a look at the [[http://thread.gmane.org/gmane.emacs.orgmode/5482][setup described by Bernt Hansen]]
2173   and check out (in the same thread) what Nick Docos had to fix to
2174   make Bernt's set-up work for him.
2175 ** Can I automatically start the clock when opening a remember template?
2176    :PROPERTIES:
2177    :CUSTOM_ID: start-clock-when-opening-remember-template
2178    :END:
2180    Yes, this is possible.  Use the following code and make sure that
2181    after executing it, `my-start-clock-if-needed' is in
2182    `remember-mode-hook' /after/ `org-remember-apply-template'.
2184    : (add-hook 'remember-mode-hook 'my-start-clock-if-needed 'append)
2185    : (defun my-start-clock-if-needed ()
2186    :   (save-excursion
2187    :     (goto-char (point-min))
2188    :     (when (re-search-forward " *CLOCK-IN *" nil t)
2189    :       (replace-match "")
2190    :       (org-clock-in))))
2192    Then, when a template contains the key string CLOCK-IN, the clock
2193    will be started.  Starting with Org-mode version 5.20, the clock will
2194    automatically be stopped when storing the remember buffer.
2196 * Searches
2197   :PROPERTIES:
2198   :CUSTOM_ID: Searches
2199   :END:
2200 ** Isearch does not find string hidden in links.  What can I do?
2201    :PROPERTIES:
2202    :CUSTOM_ID: isearch-in-links
2203    :END:
2205   M-x =visible-mode= will display the full link, making them searchable.
2207 ** How can I reduce the amount of context shown in sparse trees?
2208    :PROPERTIES:
2209    :CUSTOM_ID: context-in-sparse-trees
2210    :END:
2212    Take a look at the following variables:
2214    - =org-show-hierarchy-above=
2215    - =org-show-following-headline=
2216    - =org-show-siblings=
2217    - =org-show-entry-blow=
2219    which give command-dependent control over how much context is shown
2220    by a particular operation.
2222 ** How can I combine the results of two calls to =org-occur=?
2223    :PROPERTIES:
2224    :CUSTOM_ID: two-calls-to-org-occur
2225    :END:
2227    You can construct a regular expression that matches all targets you
2228    want.  Alternatively, use a =C-u= prefix with the second and any
2229    further calls to =org-occur= to keep the current visibility and
2230    highlighting in addition to the new ones.
2232 * Agenda
2233   :PROPERTIES:
2234   :CUSTOM_ID: Agenda
2235   :END:
2236 ** How can I change the advanced warning time for deadlines?
2237    :PROPERTIES:
2238    :CUSTOM_ID: warning-period-for-deadlines
2239    :END:
2240 ##<<warning-period-for-deadlines>>
2242 Deadline warnings appear in the daily agenda view a specified number
2243 of days before the deadline is due. The default setting is 14 days.
2244 You can change this with the variable =org-deadline-warning-days=.
2245 (See [[http://orgmode.org/manual/Deadlines-and-scheduling.html#Deadlines-and-scheduling][this section]] of the manual.)
2247 For instance,
2249 : (setq org-deadline-warning-days 30)
2251 would cause warnings for each deadline to appear 30 days in advance.
2253 Naturally, you might not want warnings for all of your deadlines to
2254 appear so far in advance. Thus, you can change the lead time for
2255 individual items as follows:
2257 : * TODO Get a gift for the party
2258 :   DEADLINE: <2009-01-16 Fri -2d>
2260 The "-2d" above changes the lead time for this deadline warning to two
2261 days in advance. You can also use "w" for weeks and "m" for months.
2262 ** How can I postpone a task until a certain date?
2263    :PROPERTIES:
2264    :CUSTOM_ID: deferring-tasks
2265    :END:
2267 The easiest way to postpone a task is to schedule it in the future.
2268 For instance, typing =C-c C-s +2w= on a headline will push a task two
2269 weeks into the future, so that it won't show up on the daily agenda
2270 until two weeks from now.
2272 If you'd like to prevent the task from showing up on your global todo
2273 list, you have a couple of options.
2275 1. You can set the variable =org-agenda-todo-ignore-scheduled= to =t=.
2276    This will exclude any scheduled items from your global list of
2277    active todos (=C-c a t=). (The variable
2278    =org-agenda-todo-ignore-with-date= will exclude both scheduled and
2279    deadline items from your todo list).
2280 2. You can remove the todo keyword from the item (C-c C-t <SPC>). The
2281    item will still appear on your agenda two weeks from today, but it
2282    won't show up on your todo lists.
2283 ** Can I send myself an email containing tasks or other agenda info?
2284    :PROPERTIES:
2285    :CUSTOM_ID: email-containing-tasks-or-other-agenda-info
2286    :END:
2288    Yes.  See [[http://article.gmane.org/gmane.emacs.orgmode/6112][this thread]] on the list.
2290 ** How can I limit the agenda view to my "work" tasks?
2291    :PROPERTIES:
2292    :CUSTOM_ID: limit-agenda-with-tag-filtering
2293    :END:
2295    It is often convenient to group org files into separate categories,
2296    such as "home" and "work" (or "personal" and "professional"). One
2297    of the main reasons for such classification is to create agenda
2298    views that are limited by type of work or area of responsibility.
2299    For instance, while at work, one may want to see only professional
2300    tasks; while away from work, one may want to see only personal
2301    tasks.
2303    One way to categorize files and tasks is to use a "#+FILETAGS"
2304    declaration at the top of each file, such as:
2306    : #+FILETAGS: work
2308    As long as org-use-tag-inheritance is turned on, the filetags will
2309    be inherited by all tasks in the file. A file can have multiple
2310    filetags. And, of course, tags can be added to individual headings.
2312    Tasks can be quickly filtered by tag from within the agenda by
2313    typing "/" and the name of the tag. The full key sequence to filter
2314    for work items in an agenda view would be:
2316    : C-c a a / work [or a tag shortcut]
2318 ** How can I limit the agenda view to a particular category?
2319    :PROPERTIES:
2320    :CUSTOM_ID: limit-agenda-with-category-match
2321    :END:
2323    Another way to filter agenda views by type of work is to use a
2324    "#+CATEGORY" declaration at the top of each file, such as:
2326    : #+CATEGORY: work
2328    Categories can also be added to individual headings within a file:
2330    : * Big project
2331    :   :PROPERTIES:
2332    :   :CATEGORY: work
2333    :   :END:
2335    All todos belonging to the category "work" can be found a with a
2336    simple tags-todo search:
2338    : C-c a M
2340    At the prompt, type:
2342    : CATEGORY="work"
2344    The same results can be achieved with custom agenda commands, such as:
2346 #+BEGIN_SRC emacs-lisp
2347 (setq org-agenda-custom-commands
2348       '(("h" tags-todo "CATEGORY=\"home\"")
2349         ("w" tags-todo "CATEGORY=\"work\"")
2350         ;; other custom agenda commands here
2351         ))
2352 #+END_SRC
2354 ** How can include all org files in a directory in my agenda?
2355    :PROPERTIES:
2356    :CUSTOM_ID: set-agenda-files-using-wildcards
2357    :END:
2359 You can simply include the directory (as one of the items) in the
2360 value of the variable org-agenda-files:
2362 : (setq org-agenda-files '("/my/special/path/org/"))
2364 There is another way of accomplishing the same end:
2366 : (setq org-agenda-files (file-expand-wildcards "/my/special/path/org/*.org"))
2368 ** Why aren't items disappearing from my agenda once they are marked done?
2369    :PROPERTIES:
2370    :CUSTOM_ID: removing-done-items-from-agenda
2371    :END:
2373 If items remain on your daily/weekly agenda after they are marked
2374 done, check the configuration of the following variables:
2376 : org-agenda-skip-scheduled-if-done
2377 : org-agenda-skip-deadline-if-done
2378 : org-agenda-skip-timestamp-if-done
2380 For instance, type:
2382 : M-x customize-variable RET org-agenda-skip-scheduled-if-done
2384 If this variable is turned off (=nil=), then scheduled items will
2385 remain on the agenda even after they are marked done.
2387 If the variable is turned on (=t=), then scheduled items will
2388 disappear from the agenda after they are marked done.
2390 If these settings seem not to behave the way you expect, then make
2391 sure you understand [[scheduled-vs-deadline-vs-timestamp][the
2392 difference between SCHEDULED, DEADLINE, and timestamps]].
2394 ** How do I keep repeating timestamps from being displayed multiple times?
2395    :PROPERTIES:
2396    :CUSTOM_ID: repeating-timestamps-show-once
2397    :END:
2399 To show only the /current/ instance of a repeating timestamp, put the
2400 following in your .emacs:
2402 #+begin_src emacs-lisp
2403 (setq org-agenda-repeating-timestamp-show-all nil)
2404 #+end_src
2406 ** What is the difference between SCHEDULED, DEADLINE, and plain timestamps?
2407    :PROPERTIES:
2408    :CUSTOM_ID: scheduled-vs-deadline-vs-timestamp
2409    :END:
2411 1. SCHEDULED items (set with =C-c C-s=) will appear on your agenda on
2412    the day they are scheduled and on every day thereafter until they
2413    are done. Schedule a task if you want to be reminded to do
2414    something beginning on a certain day and until it is done.
2416    : ** TODO Scheduled item
2417    :    SCHEDULED: <2009-03-01 Sun>
2419 2. Items with a DEADLINE timestamp (set with =C-c C-d=) appear on your
2420    agenda in advance of the when they are due and remain on your
2421    agenda until they are done. Add a DEADLINE to an item if you want
2422    to make sure to complete it by a certain date. (The variable
2423    org-deadline-warning-days determines how far in advance items with
2424    deadlines will show up in the agenda. See [[warning-period-for-deadlines][this FAQ]] for more
2425    information.)
2427    : ** TODO Item with a deadline
2428    :    DEADLINE: <2009-01-20 Tue>
2430 3. An active timestamp (set with =C-c .=) will appear on your agenda
2431    only on the day it is scheduled. Use a timestamp for appointments
2432    or any reminders you want to show up only on a particular day.
2434    : ** TODO Item with an active timestamp
2435    : <2009-04-18 Sat>
2437 Note: items with inactive timestamps (set with C-c ! and marked by
2438 square brackets) will not show up in the agenda at all.
2440 ** Can I add files recursively to my list of agenda files?
2441    :PROPERTIES:
2442    :CUSTOM_ID: set-agenda-files-recursively
2443    :END:
2445 Yes, you can use the library "find-lisp."
2447 : (load-library "find-lisp")
2448 : (setq org-agenda-files (find-lisp-find-files "~/org" "\.org$"))
2450 This will add all files ending in =org= in the directory "~/org"
2451 and all of its subdirectories to your list of agenda files.
2453 See [[http://thread.gmane.org/gmane.emacs.orgmode/8992][this thread]] on the mailing list for more information.
2455 ** Why does an item appearing at the wrong time of day in my agenda?
2456    :PROPERTIES:
2457    :CUSTOM_ID: agenda-wrong-time-of-day
2458    :END:
2460 When preparing the agenda view, org-mode scans each relevant headline
2461 for a time designation. This approach is very nice for adding
2462 free-form timestamps to an item for scheduling. Thus, either of the
2463 following work would work to schedule an item at 10:00am:
2465 #+begin_src org
2466 ,** 10:00am Get dried ice at the magic store
2467 ,   SCHEDULED: <2009-05-27 Wed>
2468 #+end_src
2470 #+begin_src org
2471 ,** Get dried ice at the magic store
2472 ,   SCHEDULED: <2009-05-27 Wed 10:00>
2473 #+end_src
2475 To enable this flexibility, org-mode scans the entire headline for
2476 time of day notation. A potential problem can arise if you use
2477 inactive timestamps in the headline to note when an item was created.
2478 For example,
2480 #+begin_src org
2481 ,** Get dried ice at the magic store [2009-05-26 Tue 12:58]
2482 ,   SCHEDULED: <2009-05-27 Wed>
2483 #+end_src
2485 Org mode would interpret the time in the inactive timestamp as a
2486 time-of-day indicator and the entry would appear in your agenda at
2487 12:58.
2489 If you would like to turn off the time-of-day search, you can
2490 configure the variable =org-agenda-search-headline-for-time= (requires
2491 org-mode >= 6.24).
2493 ** How can I change the visibility of an item from the agenda?
2494    :PROPERTIES:
2495    :CUSTOM_ID: cycling-visibility-from-agenda
2496    :END:
2498 You can add a keybinding as follows:
2500 #+begin_src emacs-lisp
2501 (add-hook 'org-agenda-mode-hook
2502    (lambda ()
2503      (define-key org-agenda-mode-map " " 'org-agenda-cycle-show)))
2504 #+end_src
2506 Then, as you press SPACE on an item on the agenda, it will cycle the
2507 visibility of its original location.
2509 ** Is there any way to set org-mode so that tags don't appear in the agenda view?
2511 See the =org-agenda-remove-tags= variable.
2513 ** I work late at night! How can I extend my current day past midnight?
2514    :PROPERTIES:
2515    :CUSTOM_ID: org-extend-today-until
2516    :END:
2518 If you work past midnight, you may not want your daily agenda view to
2519 switch to the next day at 12 a.m. (the default). To extend your day,
2520 simply set the value of org-extend-today-until to a positive number
2521 corresponding to the number of hours you work past midnight. For
2522 example, the following setting will cause the current day to extend
2523 until 6 a.m.
2525 : (setq org-extend-today-until 6)
2527 * Appointments/Diary
2528   :PROPERTIES:
2529   :CUSTOM_ID: Appointments/Diary
2530   :END:
2531 ** Is it possible to include entries from org-mode files into my emacs diary?
2532    :PROPERTIES:
2533    :CUSTOM_ID: include-entries-from-org-mode-files-into-emacs-diary
2534    :END:
2536    Since the org-mode agenda is much more powerful and can contain the
2537    diary, you should think twice before deciding to do this.  If you
2538    insist, however, integrating Org-mode information into the diary is
2539    possible.  You need to turn on /fancy diary display/ by setting in
2540    .emacs:
2542    : (add-hook 'diary-display-hook 'diary-fancy-display)
2544    Then include the following line into your ~/diary file, in
2545    order to get the entries from all files listed in the variable
2546    =org-agenda-files=
2548    : &%%(org-diary)
2550    You may also select specific files with
2552    : &%%(org-diary) ~/path/to/some/org-file.org
2553    : &%%(org-diary) ~/path/to/another/org-file.org
2555    If you now launch the calendar and press @<tt>d@</tt> to display a
2556    diary, the headlines of entries containing a timestamp, date range,
2557    schedule, or deadline referring to the selected date will be listed.
2558    Just like Org-mode's agenda view, the diary for /today/ contains
2559    additional entries for overdue deadlines and scheduled items.  See
2560    also the documentation of the =org-diary= function.  Under XEmacs, it
2561    is not possible to jump back from the diary to the org, this works
2562    only in the agenda buffer.
2563 ** I want to add my Org scheduled/deadlined entries in my diary!
2564    :PROPERTIES:
2565    :CUSTOM_ID: add-Org-scheduled/deadlined-entries-to-diary!
2566    :END:
2568   Put this in your ~/.diary:
2570   : &%%(org-diary :scheduled :timestamp :deadline)
2572 ** How can I set up automatic reminders based on Org information?
2573    :PROPERTIES:
2574    :CUSTOM_ID: automatic-reminders
2575    :END:
2577   See [[http://article.gmane.org/gmane.emacs.orgmode/5271][this post]] by N. Dokos on the list.
2578 ** How can I make =appt= notice my Org appointments?
2579    :PROPERTIES:
2580    :CUSTOM_ID: appt-notice-my-Org-appointments
2581    :END:
2583   : M-x org-agenda-to-appt RET
2585 ** How can I create more complex appointments in my org-files?
2586    :PROPERTIES:
2587    :CUSTOM_ID: diary-sexp-in-org-files
2588    :END:
2590 Org-mode's active timestamps work very well for scheduling individual
2591 or recurring appointments, such as:
2593 #+begin_src org
2594   ,* 8:00am Dentist appointment <2009-01-16 Fri>
2595 #+end_src
2598 #+begin_src org
2599   ,* Vacation
2600   ,  <2009-03-20 Fri>--<2009-04-01 Wed>
2601 #+end_src
2605 #+begin_src org
2606   ,* Weekly meeting with boss
2607   ,  <2009-01-20 Tue 14:00 +1w>
2608 #+end_src
2610 Sometimes, however, you need to set up more complicated recurring
2611 appointments. Org-mode has built-in support for many of
2612 [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Sexp-Diary-Entries.html][the
2613 powerful sexp entries]] that work in [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Diary.html#Diary][Emacs diary]]. Let's say, for
2614 instance, that you teach a class that meets every Monday evening
2615 between February 16 and April 20, 2009. The way to enter this an
2616 org-mode file is:
2618 #+begin_src org
2619   ,** Class 7:00pm-9:00pm
2620   ,   <%%(and (= 1 (calendar-day-of-week date)) (diary-block 2 16 2009 4 20 2009))>
2621 #+end_src
2623 The expression above designates all Mondays that fall between February
2624 16 and April 20. How exactly does it work?
2626  - (and... :: Indicates that *both* of the conditions that follow have
2627           to be true.
2629    - (= 1 (calendar-day-of-week date)) :: Is the day of the week a
2630         Monday?
2632        - Note: the function calendar-day-of-week converts the date to the day of week
2633          expressed in numeric form, where 0 = Sunday, 1 = Monday, and so on.
2635    - (diary-block 2 16 2009 4 20 2009) :: Does the date fall between
2636         these two dates?
2638 You can make a sexp as complex as you like. If you wanted to omit a
2639 week because of holidays, for instance, you could add another
2640 condition to the sexp:
2642 #+begin_src org
2643   ,** Class 7:00pm-9:00pm
2644   ,   <%%(unless (diary-block 3 9 2009 3 13 2009) (and (= 1 (calendar-day-of-week date)) (diary-block 2 16 2009 4 20 2009)))>
2645 #+end_src
2647 The sexp above would omit Monday during the week of March 9, 2009. For
2648 another way to accomplish the same thing, see [[org-diary-class][this FAQ]].
2650 Another diary function commonly used for more complex scheduling is
2651 diary-float. For instance,
2653 #+begin_src org
2654   ,* Monthly meeting
2655   ,  <%%(diary-float t 3 3)>
2656 #+end_src
2658 ...would appear on the third Wednesday of every month.
2660 For more ideas on how to create diary special expressions, see [[http://www.emacswiki.org/cgi-bin/wiki/DiaryMode][this
2661 page on the Emacs wiki]].
2663 ** How can I schedule a weekly class that lasts for a limited period of time?
2664    :PROPERTIES:
2665    :CUSTOM_ID: org-diary-class
2666    :END:
2668 Org-mode offers a convenient diary sexp function for setting up a
2669 recurring appointment that lasts for a certain period of time, such as
2670 a class. It is called org-diary-class and it can be entered as
2671 follows:
2673 #+begin_src org
2674   ,** Class 7:00pm-9:00pm
2675   ,   <%%(org-diary-class 2 16 2009 4 20 2009 1 10)>
2676 #+end_src
2678 The function above schedules an appointment for every Monday (1)
2679 between February 16 and April 20, 2009, except for ISO week 10 (March
2680 1 to March 7).
2682 The function org-diary-class has the following format:
2684 : (org-diary-class M1 D1 Y1 M2 D2 Y2 DAYNAME &rest SKIP-WEEKS)
2686 M1/2, D1/2, and Y1/2 indicate the beginning and ending dates. Dayname
2687 takes the form of a number indicating the day of the week (0 = Sunday,
2688 1 = Monday, and so on...). In addition, one can add an optional
2689 argument SKIP-WEEKS to indicate weeks on the calendar that should be
2690 skipped. This argument should be expressed as an ISO week number. You
2691 can find the number by invoking emacs' built-in calendar (=M-x
2692 calendar=), navigating to the appropriate week, and typing =p c=
2693 (calendar-iso-print-date).
2695 Please note: the order of the month, day, and year arguments depends
2696 on the variables =calendar-date-style= and/or
2697 =european=calendar=style=. (See the documentation for these variables
2698 with C-h v or M-x describe variable.) For instance, the example above
2699 works if =calendar-date-style= is set to ='american=. If
2700 =calendar-date-style= is set to ='iso=, then the arguments to the
2701 org-diary-class sexp would have the following format:
2703 : (org-diary-class Y1 M1 D1 Y2 M2 D2 DAYNAME &rest SKIP-WEEKS)
2705 Here is an alternative method, shared by Paul Sexton on the org
2706 mailing list:
2708 Let's say you are taking night classes in Spanish. The class is every
2709 Wednesday evening at 7pm, starting on 18 August, and runs for 8 weeks.
2710 Org-mode's timestamps do not support limited occurrences of recurrent
2711 items -- you have to schedule the item with infinite recurrences, then
2712 delete it when it finishes.
2714 To schedule the Spanish classes, put the following in your =.emacs=:
2716 #+begin_src emacs-lisp
2717   (defun diary-limited-cyclic (recurrences interval m d y)
2718     "For use in emacs diary. Cyclic item with limited number of recurrences.
2719   Occurs every INTERVAL days, starting on YYYY-MM-DD, for a total of
2720   RECURRENCES occasions."
2721     (let ((startdate (calendar-absolute-from-gregorian (list m d y)))
2722           (today (calendar-absolute-from-gregorian date)))
2723       (and (not (minusp (- today startdate)))
2724            (zerop (% (- today startdate) interval))
2725            (< (floor (- today startdate) interval) recurrences))))
2726 #+end_src
2727 The item in the org file looks like this:
2729 #+begin_src org
2730   ,** 19:00-21:00 Spanish lessons
2731   ,   <%%(diary-limited-cyclic 8 7 8 18 2010)>
2732 #+end_src
2734 ** How can I set an event to occur every day except Saturday and Sunday?
2736 #+begin_src org
2737   ,** Daily meeting
2738   ,   <%%(memq (calendar-day-of-week date) '(1 2 3 4 5))>
2739 #+end_src
2741 ** How do I schedule events relative to Easter Sunday?
2743    Easter's date moves around from year to year according to a
2744    complicated set of criteria which I do not claim to understand.
2745    However the following code will allow you to schedule recurring
2746    events relative to Easter Sunday.
2748    Note: the function da-easter is from:
2749    http://github.com/soren/elisp/blob/master/da-kalender.el
2751    Put the following in your .emacs:
2753 #+begin_src emacs-lisp
2754   (defun da-easter (year)
2755     "Calculate the date for Easter Sunday in YEAR. Returns the date in the
2756   Gregorian calendar, ie (MM DD YY) format."
2757     (let* ((century (1+ (/ year 100)))
2758            (shifted-epact (% (+ 14 (* 11 (% year 19))
2759                                 (- (/ (* 3 century) 4))
2760                                 (/ (+ 5 (* 8 century)) 25)
2761                                 (* 30 century))
2762                              30))
2763            (adjusted-epact (if (or (= shifted-epact 0)
2764                                    (and (= shifted-epact 1)
2765                                         (< 10 (% year 19))))
2766                                (1+ shifted-epact)
2767                              shifted-epact))
2768            (paschal-moon (- (calendar-absolute-from-gregorian
2769                              (list 4 19 year))
2770                             adjusted-epact)))
2771       (calendar-dayname-on-or-before 0 (+ paschal-moon 7))))
2774   (defun da-easter-gregorian (year)
2775     (calendar-gregorian-from-absolute (da-easter year)))
2777   (defun calendar-days-from-easter ()
2778     "When used in a diary sexp, this function will calculate how many days
2779   are between the current date (DATE) and Easter Sunday."
2780     (- (calendar-absolute-from-gregorian date)
2781        (da-easter (calendar-extract-year date))))
2782 #+end_src
2784     Now we can schedule the public holidays associated with Easter as
2785     recurring events. Good Friday is 2 days before "Easter", Easter
2786     Monday is one day after.
2788 #+begin_src org
2789   ,* Good Friday
2790   ,  <%%(= -2 (calendar-days-from-easter))>
2792   ,* Easter Sunday
2793   ,  <%%(= 0 (calendar-days-from-easter))>
2795   ,* Easter Monday
2796   ,  <%%(= 1 (calendar-days-from-easter))>
2797 #+end_src
2798    [Source: Posted by Paul Sexton on Org-mode mailing list.]
2800 ** How to schedule public holiday that is "the nearest Monday to DATE"?
2802    In New Zealand each regional capital has an "Anniversary Day". The
2803    date of Auckland's anniversary day is "the nearest Monday to 29
2804    January".
2806    Put this in your =.emacs=:
2808 #+begin_src emacs-lisp
2809   (defun calendar-nearest-to (target-dayname target-day target-month)
2810     "Recurring event that occurs in the nearest TARGET-DAYNAME to
2811   the date TARGET-DAY, TARGET-MONTH each year."
2812     (interactive)
2813     (let* ((dayname (calendar-day-of-week date))
2814            (target-date (list target-month target-day (calendar-extract-year date)))
2815            (days-diff (abs (- (calendar-day-number date)
2816                               (calendar-day-number target-date)))))
2817       (and (= dayname target-dayname)
2818            (< days-diff 4))))
2819 #+end_src
2821    Now we can schedule Auckland Anniversary Day. The first argument,
2822    1, means Monday (days of the week are numbered starting with
2823    Sunday=0).
2825    [Source: Originally posted by Paul Sexton on Org-mode mailing list.]
2827 ** How to schedule public holiday on "the 4th Monday in October"?
2829    This does not require any additions to =.emacs=:
2831 #+begin_src org
2832   ,* Labour Day (NZ)
2833   ,  <%%(diary-float 10 1 4)>
2834 #+end_src
2836 ** Why isn't the agenda showing all the times I put under a single entry?
2837    :PROPERTIES:
2838    :CATEGORY: multiple-timestamps-same-entry
2839    :END:
2841 Probably because you have not set the following variable:
2843 : org-agenda-skip-additional-timestamps-same-entry
2845 The default value of this variable is t, which means that entries with
2846 multiple timestamps, such as the following...
2848 #+begin_src org
2849   ,* Work really, really hard
2850   ,  <2010-11-20 Sat 10:00>
2851   ,  <2010-11-20 Sat 14:00>
2852 #+end_src
2854 ...will only appear in the agenda at the time specified by the first
2855 timestamp. If you set org-agenda-skip-additional-timestamps-same-entry
2856 to nil, the item will appear will appear at all the times you specify.
2858 ** Can I import iCal events/appts from Gnus?
2860 Yes.  Vagn Johansen wrote [[http://ozymandias.dk/emacs/org-import-calendar.el][org-import-calendar.el]] which lets you do this.
2862 * Export
2863   :PROPERTIES:
2864   :CUSTOM_ID: Export
2865   :END:
2866 ** Can I get TODO items exported to HTML as lists, rather than as headlines?
2867    :PROPERTIES:
2868    :CUSTOM_ID: export-TODO-items-as-lists
2869    :END:
2871    If you plan to use ASCII or HTML export, make sure things you want to
2872    be exported as item lists are level 4 at least, even if that does
2873    mean there is a level jump.  For example:
2875    : * Todays top priorities
2876    : **** TODO write a letter to xyz
2877    : **** TODO Finish the paper
2878    : **** Pick up kids at the school
2880    Alternatively, if you need a specific value for the heading/item
2881    transition in a particular file, use the =#+OPTIONS= line to
2882    configure the H switch.
2884    : #+OPTIONS:   H:2; ...
2886 ** Can I export only a single subtree?
2887    :PROPERTIES:
2888    :CUSTOM_ID: export-single-subtree
2889    :END:
2891 If you want to export a subtree, mark the subtree as region and then
2892 export. Marking can be done with =C-c @ C-x C-x=, for example.
2894 Alternatively, you can select option =1= in the org export dispatcher
2895 (e.g.., =C-c C-e 1 h= to export the current subtree to html).
2897 By default, the title of the exported file will be set to the heading
2898 of the subtree. You can, however, [[#export-options-for-subtree][customize the title and other export
2899 options]].
2901 ** How can I customize export options for a single subtree?
2902    :PROPERTIES:
2903    :CUSTOM_ID: export-options-for-subtree
2904    :END:
2906 You can set unique export options for a [[#export-single-subtree][single subtree]] by using
2907 properties. Relevant properties include:
2909  - EXPORT_TITLE
2910  - EXPORT_AUTHOR
2911  - EXPORT_DATE
2912  - EXPORT_FILE_NAME
2913  - EXPORT_OPTIONS (corresponds to the =#+OPTIONS:= [[http://orgmode.org/manual/Export-options.html#Export-options][configuration line]])
2915 ** How can I tell my calendar web application about appointments in my agenda files?
2917 Here is what you need to do:
2919 1. a script that calls Emacs in batch mode and produce a .ics file
2920 2. a script that uploads this .ics file somewhere on the web
2921 3. tell your webapp to fetch this .ics file on the web
2923 Here is the script I use for the first step:
2925 #+begin_src shell-script-mode
2926 #!/bin/bash
2928 /usr/local/bin/emacs --batch --eval \
2929 "(progn (load-file \"~/install/git/org-mode/org.el\") \
2930         (load-file \"~/elisp/config/org-batch-config.el\") \
2931         (setq org-combined-agenda-icalendar-file \"~/org/cal/org.ics\")
2932         (setq org-agenda-files (quote (\"~/org/bzg.org\"))))" \
2933     -f org-export-icalendar-combine-agenda-files
2934 #+end_src
2936 Depending on your configuration, you might change the load sequence.
2938 Here is the script I use for the second step:
2940 #+begin_src shell-script-mode
2941 #!/bin/bash
2942 /usr/bin/rsync -rtv ~/org/org.ics -e ssh me@my_server:/home/me/public_html/
2943 #+end_src
2945 Note: if you want to cron this rsync script, you will need to let
2946 =my_server= to know about your SSH public key.  Check [[http://troy.jdmz.net/rsync/index.html][this page]] as a
2947 starter.
2949 Now you can cron the two scripts above and your webapp will always be
2950 up to date with your Org agendas.
2952 Also see [[http://orgmode.org/org.html#Exporting-Agenda-Views][Exporting agenda views]] from Org manual.
2954 ** How can I get Mac OSX 10.3 iCal to import my Org-exported .ics files?
2955    :PROPERTIES:
2956    :CUSTOM_ID: iCal-import-ics-files-old
2957    :END:
2959    When using iCal under Apple MacOS X Tiger, you can create a new
2960    calendar /OrgMode/ (the default name for the calendar created by =C-c
2961    C-e c=, see the variables =org-icalendar-combined-name= and
2962    =org-combined-agenda-icalendar-file=).  Then set Org-mode to
2963    overwrite the corresponding file /~/Library/Calendars/OrgMode.ics/.
2964    You may even use AppleScript to make iCal re-read the calendar files
2965    each time a new version of /OrgMode.ics/ is produced.  Here is the
2966    setup needed for this:
2968    : (setq org-combined-agenda-icalendar-file
2969    :     "~/Library/Calendars/OrgMode.ics")
2970    : (add-hook 'org-after-save-iCalendar-file-hook
2971    :  (lambda ()
2972    :   (shell-command
2973    :    "osascript -e 'tell application \"iCal\" to reload calendars'")))
2975 ** How can I get Mac OSX 10.4 or later iCal to import my Org-exported .ics files?
2976    :PROPERTIES:
2977    :CUSTOM_ID: iCal-import-ics-files-new
2978    :END:
2980    For Mac OS X 10.4, you need to write the ics file to
2981    =/Library/WebServer/Documents/= and then subscribe iCalendar to
2982    =http: //localhost/orgmode.ics=
2984 ** How can I remove timestamps and todo keywords from my exported file?
2985    :PROPERTIES:
2986    :CUSTOM_ID: export-options-remove-timestamps
2987    :END:
2989 You can place an options line at the top of your org file:
2991 : #+OPTIONS: <:nil todo:nil
2993 There is a whole host of export options you can set with an in-buffer
2994 options or via global variables. See [[http://orgmode.org/manual/Export-options.html#Export-options][this section]] of the manual for a
2995 full list.
2997 ** How can I preserve faces when I export an agenda from the command line?
2998    :PROPERTIES:
2999    :CUSTOM_ID: preserving-faces-during-batch-export
3000    :END:
3002 Normally, when you export an org file or an agenda view from within
3003 emacs, htmlize will convert your face definitions to direct color css
3004 styles inlined into each =<span>= object, resulting in an HTML output
3005 that preserves the general look of your Org buffers and agenda views.
3007 Let's say you generate an export from the command line, such as the
3008 following:
3010 : emacs -batch -l ~/.emacs -eval '(org-batch-agenda "e")'
3014 : emacs -batch -l ~/.emacs -eval '(org-publish-all)'
3016 In such an instance, the exported HTML will contain only very basic
3017 color styles. The reason is that when Emacs is run in batch mode, it
3018 does not have a display and therefore only rudimentary face
3019 definitions.  If you'd like to use more complex styles, you'll have to
3020 make sure that the export process only assigns classes instead of
3021 direct color values.  This can be done by binding the variable
3022 =org-export-htmlize-output-style= to =css= for the duration of the
3023 export, for example with
3025 : emacs -batch -l ~/.emacs
3026 :   -eval '(let ((org-export-htmlize-generate-css (quote css)))
3027 :            (org-batch-agenda "e"))'
3029 Then you can use a style file to make these classes look any way you
3030 like.  To generate face definitions for a CSS file based on any faces
3031 you are currently using in Emacs, you can use the following command:
3033 : M-x org-export-htmlize-generate-css RET
3035 This will generate a =<style>...</style>= section, the content of
3036 which you can add to your style file.
3038 ** How can I avoid dark color background when exporting agenda to ps format?
3039    :PROPERTIES:
3040    :CUSTOM_ID: avoiding-dark-background-when-exporting-agenda
3041    :END:
3043 Add this to your .emacs and evaluate it.
3045 #+BEGIN_SRC emacs-lisp
3046   (setq org-agenda-exporter-settings
3047         '((ps-print-color-p 'black-white)))
3048 #+END_SRC
3050 ** How can I include e.g. an abstract in export to Latex and HTML?
3051    :PROPERTIES:
3052    :CUSTOM_ID: include-abstract-in-export-to-latex-and-html
3053    :END:
3055 Org does not currently have special markup for abstracts, but for
3056 export purposes, you can extend the block-level structural and
3057 semantic markup in Org with the contributed package [[file:org-contrib/org-special-blocks.org][org-special-blocks]]
3058 (by Chris Gray). To turn it on, put this in your =.emacs=:
3060 : (require 'org-special-blocks)
3062 Now, you can mark up the abstract of your article like this:
3064 : #+BEGIN_ABSTRACT
3065 : Falling apples were observed and compared with pears. Newton's laws
3066 : were confirmed at the 95% confidence level.
3067 : #+END_ABSTRACT 
3069 Exporting to Latex wraps this in a
3070 =\begin{abstract}....\end{abstract}= environment, which just works.
3072 HTML export wraps it in a ~<div class="abstract">...</div>~
3073 element. The HTML result won't look like anything special until you
3074 style it. Here is some sample CSS to get you started; put these in
3075 your document header:
3077 : #+STYLE: <style>.abstract {margin: 1em; padding: 1em; border: 1px solid black}
3078 : #+STYLE: .abstract:before {content: "Abstract: "; font-weight: bold}</style>
3080 Generally, =#+begin_foo= will work for any simple Latex =foo=
3081 environment not supported by existing Org markup.
3083 If you need to pass parameters, process the block content in some way,
3084 or support other exporters, you may want to consider whether you can
3085 customize it using Eric Schulte's [[file:org-contrib/org-exp-blocks.org][org-exp-blocks]] instead.
3087 ** How can I get colored source code when exporting to LaTeX?
3088    :PROPERTIES:
3089    :CUSTOM_ID: fontified_source_code_w_latex
3090    :END:
3092 As of Sun Aug 9 2009 the "current" version of Org-mode (see
3093 [[keeping-current-with-Org-mode-development]]) supports exporting
3094 source code to LaTeX using the listings package.
3096 To turn on listing export add the following to your Org-mode
3097 customization.
3098 #+begin_src emacs-lisp
3099   ;; requite org-latex so that the following variables are defined
3100   (require 'org-latex)
3102   ;; tell org to use listings
3103   (setq org-export-latex-listings t)
3105   ;; you must include the listings package
3106   (add-to-list 'org-export-latex-packages-alist '("" "listings"))
3108   ;; if you want colored source code then you need to include the color package
3109   (add-to-list 'org-export-latex-packages-alist '("" "color"))
3110 #+end_src
3112 The listings package will now be used to fontify source code in your
3113 LaTeX documents.  By default listings will not color any of your
3114 source code.  If you would like to set colors for keywords and
3115 comments in your latex documents you can do so using LaTeX directives
3116 like the following.
3117 #+begin_src latex
3118   \lstset{keywordstyle=\color{blue},
3119     commentstyle=\color{red},
3120     stringstyle=\color{green}
3121   }
3122 #+end_src
3124 of if you want to get even fancier with your colors you can try
3125 something like the following
3126 #+begin_src latex
3127 \definecolor{keywords}{RGB}{255,0,90}
3128 \definecolor{comments}{RGB}{60,179,113}
3129 \definecolor{fore}{RGB}{249,242,215}
3130 \definecolor{back}{RGB}{51,51,51}
3131 \lstset{
3132   basicstyle=\color{fore},
3133   keywordstyle=\color{keywords},
3134   commentstyle=\color{comments},
3135   backgroundcolor=\color{back}
3137 #+end_src
3139 For more complex listings use cases consult the [[ftp://ftp.tex.ac.uk/tex-archive/macros/latex/contrib/listings/listings.pdf][listings manual]].
3141 ** How can I export to Latex Beamer
3142    :PROPERTIES:
3143    :CUSTOM_ID: beamer
3144    :END:
3145 The latex [[http://latex-beamer.sourceforge.net/][Beamer Class]] is a useful class for generating slide shows.
3146 The following can be used to export Org-mode documents to LaTeX
3147 beamer.
3149 Add the following to your Emacs initialization file.
3150 #+begin_src emacs-lisp
3151   (unless (boundp 'org-export-latex-classes)
3152     (setq org-export-latex-classes nil))
3153   (add-to-list 'org-export-latex-classes
3154                '("beamer"
3155                  "\\documentclass[11pt]{beamer}\n\\usepackage[utf8]{inputenc}\n\\usepackage[T1]{fontenc}\n\\usepackage{hyperref}\n\\usepackage{verbatim}\n"
3156                  ("\\section{%s}" . "\\section*{%s}")
3157                  ("\\begin{frame}\\frametitle{%s}" "\\end{frame}"
3158                   "\\begin{frame}\\frametitle{%s}" "\\end{frame}")))
3159 #+end_src
3161 Then by placing
3162 : #+LaTeX_CLASS: beamer
3163 in the header of your Org-mode document it will automatically export
3164 to the Beamer document class on LaTeX export.  With the above
3165 configuration top-level headers will be mapped to sections in the
3166 Beamer document, second-level headers will be mapped to frames, and
3167 lower level headlines will be mapped to itemize objects.
3169 This above is adapted from an [[http://article.gmane.org/gmane.emacs.orgmode/15077/match=beamer+dokos][email by Nick Dokos]], and an [[http://article.gmane.org/gmane.emacs.orgmode/17767/match=beamer+dokos][email by
3170 Thomas Dye]].  For a much more complex Beamer setup see the [[http://article.gmane.org/gmane.emacs.orgmode/17767/match=beamer+dokos][email by
3171 Thomas Dye]].
3173 ** How can I use RefTeX in Org-mode files for LaTeX export and in Org-babel LaTeX code blocks?
3174    :PROPERTIES:
3175    :CUSTOM_ID: using-reftex-in-org-mode
3176    :END:
3178 [[http://www.gnu.org/software/auctex/reftex.html][RefTeX]] is an indispensable tool for the author of LaTeX documents.  It
3179 aids in creation of bibliographies, cross-references, indexes, and
3180 glossaries.  RefTeX understands the structure of multi-file LaTeX
3181 documents and is able to collect from them information about the
3182 location(s) of external data stores used in creation of the final
3183 document.  RefTeX was written by Carsten Dominik and is currently
3184 being maintained by the [[http://www.gnu.org/software/auctex/index.html][AucTeX]] project.
3186 *** Using RefTeX In Org-mode Files for LaTeX Export
3187 In Org-mode files for LaTeX export, the trick is to find a way to tell
3188 RefTeX the locations of external data stores.  One way is to set the
3189 variable, =reftex-default-bibliography=.  Add lines like these to
3190 .emacs:
3192 #+begin_src emacs-lisp
3193   (setq reftex-default-bibliography
3194         (quote
3195          ("default.bib" "other-default.bib")))
3196 #+end_src
3198 In practice, this is a limited solution and the
3199 typical user will want to pass this information on a per-file basis.
3200 Two solutions to this problem were posted on a blog, [[http://www.mfasold.net/blog/2009/02/using-emacs-org-mode-to-draft-papers/][Mario's
3201 Braindump]].
3203 The first solution, proposed by Mario, enables the RefTeX citation
3204 function in Org-mode.  Add these lines to .emacs:
3206 #+begin_src emacs-lisp
3207   (defun org-mode-reftex-setup ()
3208     (load-library "reftex")
3209     (and (buffer-file-name)
3210          (file-exists-p (buffer-file-name))
3211          (reftex-parse-all))
3212     (define-key org-mode-map (kbd "C-c )") 'reftex-citation))
3213   (add-hook 'org-mode-hook 'org-mode-reftex-setup)
3214 #+end_src
3216 Then add the following lines anywhere in the Org-mode file (Org-mode
3217 will recognize them as LaTeX commands):
3219 #+begin_src org
3220 \bibliographystyle{plain}
3221 \bibliography{BIB-NAME}
3222 #+end_src
3224 With this setup, =C-c )= will invoke =reftex-citation= which will
3225 insert a reference in the usual way:
3227 #+begin_src org
3228   ,* test reftex
3230   ,This is a citation \cite{tierney90}.
3232   ,\bibliographystyle{plain}
3233   ,\bibliography{tsd}
3234 #+end_src
3236 This Org-mode file will export the following LaTeX output:
3238 #+begin_src latex :exports code
3239   % Created 2010-03-22 Mon 14:34
3240   \documentclass[11pt,letter]{article}
3241   \usepackage[utf8]{inputenc}
3242   \usepackage[T1]{fontenc}
3243   \usepackage{hyperref}
3245   \title{test.org}
3246   \author{Tom Dye}
3247   \date{2010-03-22 Mon}
3249   \begin{document}
3251   \maketitle
3253   \setcounter{tocdepth}{3}
3254   \tableofcontents
3255   \vspace*{1cm}
3257   \section{test reftex}
3258   \label{sec-1}
3261   This is a citation \cite{tierney90}.
3263   \bibliographystyle{plain}
3264   \bibliography{tsd}
3266   \end{document}
3267 #+end_src
3270 A second solution, to activate the RefTeX minor mode on a per-file
3271 basis, was posted by Kevin Brubeck Unhammer in response to this idea.
3272 Add the following lines to .emacs:
3274 #+begin_src emacs-lisp
3275   (add-hook ‘org-mode-hook
3276              (lambda ()
3277                (if (member “WRITE” org-todo-keywords-1)
3278                    (org-mode-article-modes))))
3279 #+end_src
3281 where =org-mode-article-modes= is defined as follows:
3283 #+begin_src emacs-lisp
3284   (defun org-mode-article-modes ()
3285     (reftex-mode t)
3286     (bib-cite-minor-mode t)
3287     (and (buffer-file-name)
3288          (file-exists-p (buffer-file-name))
3289          (reftex-parse-all)))
3290 #+end_src
3292 Add the =\bibliographystyle{}= and =\bibliography{}= lines to the
3293 Org-mode file as before and define a TODO keyword, =WRITE=, perhaps
3294 like this:
3296 #+begin_src org
3297   ,#+TODO: TODO(t) STARTED(s) WRITE | DONE(d) DEFERRED(f)
3298 #+end_src
3300 With this setup, you insert a citation with =M-x reftex-citation RET=.
3302 *** Using RefTeX in Org-babel LaTeX Code Blocks
3304 In Org-babel LaTeX code blocks, the trick is to give RefTeX access to
3305 information in other Org-babel LaTeX code blocks.  If you use an Emacs
3306 starter kit where configuration information is held in Org-mode files,
3307 then the second solution is preferable because you won't be asked for
3308 a master file when Emacs is started.  For this reason, the second
3309 solution is modified for use with Org-babel latex code blocks.  No
3310 key-binding is needed here because Org-babel code blocks are edited
3311 within the usual AucTeX environment.
3313 Add the following lines to .emacs (adapted from  Kevin Brubeck Unhammer's [[http://www.mfasold.net/blog/2009/02/using-emacs-org-mode-to-draft-papers/][Reftex Setup]])
3314 #+begin_src emacs-lisp
3315   (defun org-mode-article-modes ()
3316     (reftex-mode t)
3317     (and (buffer-file-name)
3318          (file-exists-p (buffer-file-name))
3319          (reftex-parse-all)))
3321   (add-hook 'org-mode-hook
3322             (lambda ()
3323               (if (member "REFTEX" org-todo-keywords-1)
3324                   (org-mode-article-modes))))
3325 #+end_src
3327 Then add a line like the following line to the top of your org-mode file:
3329 #+begin_src org
3330   ,#+TODO: TODO(t) STARTED(s) | DONE(d) DEFERRED(f) REFTEX
3331 #+end_src
3333 When you open an org-mode file with a line like this, RefTeX will
3334 prompt for the master .tex file, which will be parsed in the usual
3335 way.  This means that the .tex file should already exist, perhaps by
3336 tangling the LaTeX preamble and postamble, before
3337 =org-mode-article-modes= is activated for the Org-mode file.
3339 ** How can I use XeLaTeX for LaTeX export instead of pdfLaTeX?
3340    :PROPERTIES:
3341    :CUSTOM_ID: using-xelatex-for-pdf-export
3342    :END:
3343 [[http://en.wikipedia.org/wiki/XeTeX][ XeLaTeX]] is an alternative to pdfLaTeX for typesetting LaTeX
3344 documents. XeTeX can use any fonts installed in the operating system
3345 without configuring TeX font metrics, and can make direct use of
3346 advanced typographic features of OpenType and other font formats. By
3347 default, org-mode exports =org= files to =pdf= via pdfLaTeX. 
3349 Here is one way to smoothly incorporate XeLaTeX into org-mode's export
3350 process. This solution takes advantage of [[http://www.phys.psu.edu/~collins/software/latexmk-jcc][latexmk]], a perl script that
3351 intelligently and automatically manages latex compilation. It
3352 is included with TeXLive, but at present the version included is not
3353 quite up-to-date enough for our needs. Version 4.20 and higher
3354 includes an option allowing you to specify which program to use when
3355 "pdflatex" is called. Install a current version of latexmk as per the
3356 instructions on the [[http://www.phys.psu.edu/~collins/software/latexmk-jcc][latexmk]] site. If necessary, disable the older
3357 version that comes with TeXLive. This is likely in =/usr/texbin/=, and
3358 you should rename or remove it. Then you can put the following in your
3359 =~/.emacs.d/= or equivalent:
3361 #+begin_src emacs-lisp
3362   (require 'org-latex)
3363   (setq org-export-latex-listings t)
3364   
3365   ;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432
3366   ;; but adapted to use latexmk 4.20 or higher.  
3367   (defun my-auto-tex-cmd ()
3368     "When exporting from .org with latex, automatically run latex,
3369        pdflatex, or xelatex as appropriate, using latexmk."
3370     (let ((texcmd)))
3371     ;; default command: oldstyle latex via dvi
3372     (setq texcmd "latexmk -dvi -pdfps -quiet %f")        
3373     ;; pdflatex -> .pdf
3374     (if (string-match "LATEX_CMD: pdflatex" (buffer-string))
3375         (setq texcmd "latexmk -pdf -quiet %f"))
3376     ;; xelatex -> .pdf
3377     (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3378         (setq texcmd "latexmk -pdflatex=xelatex -pdf -quiet %f"))
3379     ;; LaTeX compilation command
3380     (setq org-latex-to-pdf-process (list texcmd)))
3381   
3382   (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-cmd)
3383   
3384   
3385   ;; Specify default packages to be included in every tex file, whether pdflatex or xelatex
3386   (setq org-export-latex-packages-alist
3387         '(("" "graphicx" t)
3388               ("" "longtable" nil)
3389               ("" "float" nil)))
3390     
3391   (defun my-auto-tex-parameters ()
3392         "Automatically select the tex packages to include."
3393         ;; default packages for ordinary latex or pdflatex export
3394         (setq org-export-latex-default-packages-alist
3395               '(("AUTO" "inputenc" t)
3396                 ("T1"   "fontenc"   t)
3397                 (""     "fixltx2e"  nil)
3398                 (""     "wrapfig"   nil)
3399                 (""     "soul"      t)
3400                 (""     "textcomp"  t)
3401                 (""     "marvosym"  t)
3402                 (""     "wasysym"   t)
3403                 (""     "latexsym"  t)
3404                 (""     "amssymb"   t)
3405                 (""     "hyperref"  nil)))
3406     
3407         ;; Packages to include when xelatex is used
3408         (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3409             (setq org-export-latex-default-packages-alist
3410                   '(("" "fontspec" t)
3411                     ("" "xunicode" t)
3412                     ("" "url" t)
3413                     ("" "rotating" t)
3414                     ("american" "babel" t)
3415                     ("babel" "csquotes" t)
3416                     ("" "soul" t)
3417                     ("xetex" "hyperref" nil)
3418                     )))
3419         
3420         (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3421             (setq org-export-latex-classes
3422                   (cons '("article"
3423                           "\\documentclass[11pt,article,oneside]{memoir}"
3424                           ("\\section{%s}" . "\\section*{%s}")
3425                           ("\\subsection{%s}" . "\\subsection*{%s}")
3426                           ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
3427                           ("\\paragraph{%s}" . "\\paragraph*{%s}")
3428                           ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
3429                         org-export-latex-classes))))  
3430       
3431   (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-parameters)  
3432 #+end_src
3434 The =my-auto-tex-cmd= function looks at your =.org= file and checks
3435 whether you've specified which latex to use. If there are no
3436 instructions, it just runs regular old latex. If it finds the string
3437 =LATEX_CMD: pdflatex= in your file, it runs pdflatex. If it finds
3438 =LATEX_CMD: xelatex=, it runs xelatex. Because control is handed off
3439 to latexmk, nothing else is needed: it takes care of figuring things
3440 out so that the references and citations are correct.
3442 The second half of the code above specifies the latex packages that
3443 will be included in the =.tex= file. The variable
3444 =org-export-latex-packages-alist= specifies a list of packages that
3445 are always included in the header of latex documents, regardless of
3446 how they are compiled. The variable
3447 =org-export-latex-default-packages-alist= adds additional packages
3448 depending on whether latex/pdflatex or xelatex is being used. You can
3449 change the content of these as needed. 
3451 Finally, the =org-export-latex-classes= variable redefines elements of
3452 the =.tex= file's preamble for the xelatex case. These can also be
3453 customized as needed. 
3455 By way of example, an =.org= file you want compiled with xelatex might
3456 contain the following header:
3458 : #+TITLE: My Paper
3459 : #+AUTHOR: Jane Doe
3460 : #+DATE: 
3461 : #+OPTIONS: toc:nil num:nil
3462 : #+LATEX_CMD: xelatex
3463 : #+LATEX_HEADER: \setsansfont[Mapping=tex-text]{Unit-Bold} 
3464 : #+LATEX_HEADER: \setmonofont[Mapping=tex-text,Scale=MatchLowercase]{PragmataPro} 
3465 : #+LATEX_HEADER: \setromanfont[Mapping=tex-text,Numbers=OldStyle]{Minion Pro}
3467 If you always want to have the same font setup in your xelatex
3468 documents, the =fontspec= commands setting the font choices can be
3469 put in the =org-export-latex-classes= setting instead.
3471 The upshot is that when you want to export an =.org= file using
3472 XeLaTeX, you can now simply make sure the line =LATEX_CMD: xelatex= is
3473 in your =.org= file, then do =C-c C-e d= as usual, and org-mode, with
3474 latexmk in the background, does the rest for you.
3476 ** Why is my exported PDF file almost unreadable?
3477    :PROPERTIES:
3478    :CUSTOM_ID: unreadable-pdfs
3479    :END:
3481 Some PDF viewers (earlier versions (< v6) of Acrobat Reader, Evince,
3482 possibly others) do not get along with Adobe Type3 fonts, producing
3483 almost unreadable screen output (printed output is OK). If you see
3484 this, first verify the fonts that your document uses: open it with
3485 Acrobat Reader or Evince, select "Properties" from the "File" menu and
3486 click on the "Fonts" tab; alternatively, you can use the pdffonts
3487 program (part of the xpdf-reader package) from the command line.  If
3488 that is indeed the problem, then either use a different viewer or
3489 install Type1 versions of the problematic fonts. For more details, see
3490 the "PDF export" section of [[./org-dependencies.org][org-dependencies]].
3492 ** Can I add attributes to a link or an image in HTML export?
3493    :PROPERTIES:
3494    :CUSTOM_ID: html-image-and-link-attributes
3495    :END:
3497 Yes.  Excerpt from [[http://orgmode.org/manual/Images-in-HTML-export.html#Images-in-HTML-export][Org's manual]]:
3499 If you need to add attributes to an inlined image, use a `#+ATTR_HTML'.
3500 In the example below we specify the `alt' and `title' attributes to
3501 support text viewers and accessibility, and align it to the right.
3503 :  #+CAPTION: A black cat stalking a spider
3504 :  #+ATTR_HTML: alt="cat/spider image" title="Action!" align="right"
3505 :  [[./img/a.jpg]]
3507 and you could use `http' addresses just as well.
3509 ** How can I export an org file to rtf, odt (Open Office), or doc (Word)?
3510    :PROPERTIES:
3511    :CUSTOM_ID: convert-to-open-office
3512    :END:
3514 There are two approaches:
3515 - Use the development version of Org->Odt exporter
3517   A native Org to OpenDocumentText exporter is in the works. The
3518   exporter is currently not part of Orgmode repository.  See the
3519   following [[http://lists.gnu.org/archive/html/emacs-orgmode/2011-01/msg01210.html][Announcement]] on the mailing list for further details.
3520   
3521   At the moment, the exporter supports the following most commonly
3522   used features of Org
3523   - Various Character Styles
3524   - Various Paragraph Styles (including Source Blocks)
3525   - Embedded ODT
3526   - Embedded MathML
3527   - Numbered, Bulleted and Description lists
3528   - Embedding and Resizing of Images including embedding of LaTeX
3529     fragments
3530   - Fuzzy, Dedicated and Radio Targets and Links
3531   - Tables
3532   - Footnotes
3533   - Special markups for elements like TODOs, Timestamps and Tags
3536 - Use existing exporters 
3538   Export to one of org-mode's supported export formats and then use an
3539   external tool or method to convert the exported file to doc or odt.
3541   With simple documents, these methods work well. However for complex
3542   documents containing footnotes, embedded images, math formuale etc
3543   the results may be less than satisfactory. (Note, the lists below
3544   are by no means comprehensive).
3545   1. html -> odt/doc/rtf
3546      - open html in Open Office and save as odt/doc ([[http://permalink.gmane.org/gmane.emacs.orgmode/31482][see this post by
3547         Eric Fraga]])
3548      - [[http://www.artofsolving.com/opensource/pyodconverter][PyODConverter]]
3549      - [[http://johnmacfarlane.net/pandoc/][Pandoc]] (this works for LaTeX and docbook as well)
3550      - (Mac only) The [[http://developer.apple.com/library/mac/#DOCUMENTATION/Darwin/Reference/ManPages/man1/textutil.1.html][textutil]] utility bundled with OS X can convert
3551         from html to doc
3552   2. LaTeX -> odt/doc/rtf
3553       - [[http://latex2rtf.sourceforge.net/][LaTeX2rtf]] (works well with index, footnotes, and references)
3554       - [[http://www.tug.org/tex4ht/][TeX4ht]] (works with more complex latex elements, though can be
3555         difficult to install)
3556         - run =mk4ht oolatex file.tex=
3558 See [[http://permalink.gmane.org/gmane.emacs.orgmode/31168][this thread]] for further details.
3560 * Backup
3562 Since =org= files are so central to your life, you probably want to back
3563 them up in a safe place.
3565 If the =org= file you want to back up are in a single directory, the
3566 preferred method is to us a =RCS= (Revision Control System) -- pick up your
3567 favorite ([[http://git-scm.com/][git]], [[http://bazaar.canonical.com/en/][bazaar]], [[http://mercurial.selenic.com/][mercurial]], [[http://subversion.apache.org/][subversion]], [[http://www.nongnu.org/cvs/][cvs]], etc.).  Depending on the
3568 RCS you use and how you use it, you can have a /local/ backup or sync it on
3569 a remote place.
3571 If you want to store all your =org= files from your =$HOME= to a single
3572 =~/org/backup/= folder, you can use this shell script (as [[http://article.gmane.org/gmane.emacs.orgmode/37655][suggested by
3573 Suvayu Ali]]):
3575 #+begin_src shell
3576 mkdir -p ~/org/backup && \
3577 find $HOME -type f -name '*\.org' ! -path "$HOME/org/*" \
3578      -exec cp -t ~/org/backup/ \{\} \;
3579 #+end_src
3581 It will recursively search for =org= files in your =$HOME= directory
3582 (except those in =~/org/backup/=) and copy them to =~/org/backup/=.
3583 You can then use rsync to make sure =~/org/backup/= also lives on a 
3584 remote and safe place.
3586 * MobileOrg
3588 ** Which versions of MobileOrg do exist
3589    :PROPERTIES:
3590    :CUSTOM_ID: mobileorg_versions
3591    :END:
3593 - MobileOrg for the iPhone/iPod Touch/iPad series of devices, by
3594   Richard Moreland.  Check out
3595   [[http://mobileorg.ncogni.to/][Richard's page]]
3596 - Matt Jones is developing a feature-equivalent application for
3597   Android, see
3598   [[http://wiki.github.com/matburt/mobileorg-android/][his project page]].
3600 ** What can I do if I don't want to use Dropbox.com
3601    :PROPERTIES:
3602    :CUSTOM_ID: mobileorg_webdav
3603    :END:
3605 Dropbox.com is the easiest way to connect between Emacs and MobileOrg,
3606 you can get a free account there.  If for some reason you cannot or do
3607 not want to use this path, you can use any webdav server.  On this
3608 webdav server you need to create a dedicated directory for the
3609 communication between Emacs and MobileOrg.  If you can mount that
3610 directory locally so that Emacs can directly write to it, just point
3611 to that directory using the variable =org-mobile-directory=.  Using
3612 the /tramp/ method, =org-mobile-directory= may point to a remote
3613 directory accessible through, for example, /ssh/ and /scp/:
3615 #+begin_src emacs-lisp
3616 (setq org-mobile-directory "/scpc:user@@remote.host:org/webdav/")
3617 #+end_src
3619 If Emacs cannot access the WebDAV directory directly using a /tramp/
3620 method, you can use a local directory for staging.  Other means must
3621 then be used to keep this directory in sync with the WebDAV directory.
3622 In the following example, files are staged in =~/stage/=, and Org-mode
3623 hooks take care of moving files to and from the WebDAV directory using
3624 /scp/.
3626 #+begin_src emacs-lisp
3627 (setq org-mobile-directory "~/stage/")
3628 (add-hook 'org-mobile-post-push-hook
3629   (lambda () (shell-command "scp -r ~/stage/* user@@wdhost:mobile/")))
3630 (add-hook 'org-mobile-pre-pull-hook
3631   (lambda () (shell-command "scp user@@wdhost:mobile/mobileorg.org ~/stage/ ")))
3632 (add-hook 'org-mobile-post-pull-hook
3633   (lambda () (shell-command "scp ~/stage/mobileorg.org user@@wdhost:mobile/")))
3634 #+end_src
3636 * Mathjax
3638 ** How to install MathJax on my server?
3639    
3640 :PROPERTIES:
3641 :CUSTOM_ID: install_mathjax_on_server
3642 :END:
3644 Org uses MathJax as its default HTML display engine for equations.
3646 Org relies on the version of MathJax available from orgmode.org, but you
3647 might want to use another version and install MathJax on your own server.
3649 1. Download a [[http://sourceforge.net/projects/mathjax/files/][MathJax archive]].
3651 2. Upload it somewhere on your server (say http://me.org/mathjax/)
3653 3. Set the correct path in =org-export-html-mathjax-options= (i.e. replace
3654    http://orgmode.org/mathjax/MathJax.js by
3655    http://me.org/mathjax/MathJax.js)
3657 You can also get [[http://www.mathjax.org/resources/docs/?installation.html][MathJax from git or svn]] -- in this case, be careful not to
3658 forget to unzip the fonts.zip archive in the mathjax directory.
3660 * COMMENT Function to create =CUSTOM_ID=
3662 #+begin_src emacs-lisp
3663   (defun org-faq-make-target ()
3664     "Make hard target for current headline."
3665     (interactive)
3666     (if (not (org-on-heading-p))
3667         (error "Not on a headline"))
3668     (let ((h (org-trim (org-get-heading 'no-tags))))
3669       (if (string-match "[ \t]*\\?\\'" h)
3670           (setq h (replace-match "" t t h)))
3671       (while (string-match "[ \t]+" h)
3672         (setq h (replace-match "-" t t h)))
3673       (org-entry-put nil "CUSTOM_ID" h)))
3674 #+end_src