Moved problematic files to a FIXME dir at the root of the project.
[Worg.git] / org-faq.org
blob3183773ff5f67ec750763be3b3593394808de949
1 #+STARTUP:   overview
2 #+OPTIONS:   H:2 num:t toc:t \n:nil @:t ::t |:t ^:t *:t TeX:t
3 #+EMAIL:     carsten.dominik@gmail.com
4 #+AUTHOR:    Worg people
5 #+LANGUAGE:  en
6 #+TITLE:     Org-mode Frequently Asked Questions
7 #+INFOJS_OPT: view:content toc:1 path:http://orgmode.org/worg/code/org-info-js/org-info.js tdepth:1 ftoc:t buttons:0 mouse:underline
8 #+OPTIONS:   H:3 num:nil toc:t \n:nil @:t ::t |:t ^:{} -:t f:t *:t TeX:t LaTeX:t skip:nil d:(HIDE) tags:not-in-toc
10 #+begin_html
11 <a href="/"><img src="http://orgmode.org/img/org-mode-unicorn.png" class="logo-link" /></a>
12 #+end_html
14 [[file:index.org][{Back to Worg's index}]]
16 * Welcome
17   :PROPERTIES:
18   :CUSTOM_ID: Welcome
19   :END:
21 Welcome to the Org-mode FAQ.
23 You can navigate the FAQ by clicking on any of the topics in the Table
24 of Contents.
26 If your browser supports JavaScript, you can...
28 - move through the topics by typing "=n=" (next) and "=p=" (previous).
30 - see an outline view of the FAQ by typing "=m=" or clicking "=toggle
31   view=" (above).
33 - search the FAQ by typing "=s=" (basic search) or "=o=" (occur tree).
35 - see a full list of navigation commands by typing "=?=" or clicking
36   "=Help=" (above).
38 * What is org-mode?
39   :PROPERTIES:
40   :CUSTOM_ID: What-is-org-mode
41   :END:
42 ** Can I implement a GTD workflow with Org-mode?
43    :PROPERTIES:
44    :CUSTOM_ID: GTD-workflow-with-Org-mode
45    :END:
47    Yes, you can.  Check for discussions and pointers [[http://orgmode.org/worg/org-gtd-etc.php][here]].
49 ** What is the difference between Org and TaskPaper?
50    :PROPERTIES:
51    :CUSTOM_ID: Org-and-TaskPaper
52    :END:
54   There is really no difference.  Org is as /simple/ as [[http://hogbaysoftware.com/products/taskpaper][TaskPaper]].  It
55   is just that, when using Org within Emacs, it lets you do many things
56   that you wouldn't be able to do with TaskPaper.  Yes, TaskPaper is
57   fiddle-proof and people using Emacs tends to like fiddling (which is
58   orthogonal to the idea of using todo-list efficiently), but this is
59   just a matter of discipline and common sense, not one of Org's design.
61   Read [[http://article.gmane.org/gmane.emacs.orgmode/6224][Carsten's enlightening statement]] on this.
62 ** What is the meaning of the Unicorn on Org's website?
63    :PROPERTIES:
64    :CUSTOM_ID: unicorn
65    :END:
67 The Unicorn is the logo of Org-mode because:
69 - Org-mode is the UNICs of ORgaNizers.
71 - Org-mode is an Emacs mode, so it makes sense to use an animal
72   similar or related to the gnu used for GNU Emacs.
74 - Org-mode is meant to show you the way, and an animal with two horns
75   can not do this very well, can it?
77 - Unicorn tears are said to reverse petrification, and wasn't this how
78   we all felt before getting to some degree of time and task
79   management?
81 - It will take forever to learn everything there is to know about a
82   unicorn.
84 - A unicorn is a fabulous creature.  Org-mode wants to be a fabulous
85   creation.
87 Using a unicorn was originally /Bastien Guerry's/ idea, his friend
88 /Christophe Bataillon/ designed the logo for us, and /Greg Newman/
89 gave it a refresh some time later.  Bastien writes why he chose a
90 unicorn:
92 #+BEGIN_QUOTE
93 The first reason is not linked to the animal, but to the sounding of the
94 word "Unicorn" - because Org gives you a /uni/que way of producing files
95 in several format (HTML, LaTeX, etc.)
97 The second reason is that a Unicorn doesn't really exist, it is just
98 something you can dream about, and make others believe it does exist.
99 Just like the perfect organizer.
100 #+END_QUOTE
102 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
103 Suckling]] posted a link showing how to make a simple foldable unicorn
104 (very appropriate for an outlining program!).
106 [[http://article.gmane.org/gmane.emacs.orgmode/11735][Tim Burt]] made a very complicated one which is now a treasured
107 possession of the Org-mode author.
109 - Official logo: [[http://orgmode.org/img/org-mode-unicorn.png]]
110   This logo is available in a number of different formats including
111   Photoshop /.psd/ and scaleable vector graphics /.svg/ [[http://orgmode.org/img/][here]].
113 - An [[http://orgmode.org/img/nrocinu4.jpg][alternative version]] from Christophe Bataillon (c):
115 - [[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]]:
117 - [[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
118   threshold technique".
120 - [[http://article.gmane.org/gmane.emacs.orgmode/11735/match%3D][Tim Burt]] made a folded Unicorn to match the spirit of Org - see the
121   whole set of pictures [[http://www.flickr.com/photos/tcburt/sets/72157614543357071/][on his flickr page]].
123 - Are unicorns real?  Answer [[http://article.gmane.org/gmane.emacs.orgmode/11687/match%3Drosslaird%2Bunicorn][here]] by Ross Laird.
125 * Mailing list
126 ** Why hasn't my email to the mailing list shown up yet?
127    :PROPERTIES:
128    :CUSTOM_ID: ml-post-delay
129    :END:
131 The org-mode mailing list is moderated. Thus, if you are not
132 subscribed to the mailing list, your mail will only appear on the list
133 after it has been approved by a moderator. To ensure that your mail
134 appears quickly, please [[http://lists.gnu.org/mailman/listinfo/emacs-orgmode][subscribe to the list]].
136 ** I read the mailing list through gmane. Should I subscribe?
137    :PROPERTIES:
138    :CUSTOM_ID: ml-subscription-and-gmane
139    :END:
141 The org-mode mailing list is available via nntp at [[http://dir.gmane.org/gmane.emacs.orgmode][Gmane]]. Many
142 participants in the list prefer read the list in a newsreader, such as
143 Gnus, instead of receiving emails. If you choose to read the list via
144 nntp, you can still [[http://lists.gnu.org/mailman/listinfo/emacs-orgmode][subscribe]] to the list and then opt not to receive
145 any emails on the mailman settings page (see the "Mail Delivery"
146 setting).
148 This will ensure that your messages to the list get through quickly,
149 reduce the work load of the mailing list moderators (who need to clear
150 every mail from non-members), and provide more accurate information
151 about the number of list readers.
153 * Keeping current
154   :PROPERTIES:
155   :CUSTOM_ID: Keeping-current
156   :END:
157 ** How do I keep current with Org mode development?
158    :PROPERTIES:
159    :CUSTOM_ID: keeping-current-with-Org-mode-development
160    :END:
162    Org mode is developed in [[http://en.wikipedia.org/wiki/Git_(software)][Git]].  You can keep up-to-date with Org
163    mode developement by cloning Org mode repository and refreshing
164    your copy with latest changes whenever you wish.  You only need to
165    use two Git commands (clone and pull.)  Here are the steps in
166    brief (please customize locations to suit your setup):
168    1. Select a location to house the Org mode repository (approx. 40
169       MB; includes documentation, compiled elisp files and history
170       going all the way back to v4.12a)
172       : $ mkdir $HOME/elisp && cd $HOME/elisp
174    2. Clone the Org mode Git repository.
176       Recommended approach:
178       : $ git clone git://repo.or.cz/org-mode.git
180       Alternate approach if you are behind a firewall that allows only
181       HTTP (can be quite slow):
183       : $ git clone http://repo.or.cz/r/org-mode.git
185    3. Compile and install Org mode and build documentation.
187       : $ cd org-mode && make && make doc && make install
189       Please note that you can choose to /not/ compile at all and run
190       using source =.el= files only.  Compiled files speed things up.
192    4. This is where you configure Org mode with Emacs.  Please refer
193       to [[./org-tutorials/index.org][Org tutorials]].
195    5. Keeping up-to-date.
197       Cloning the repository is a one time activity.  From this point
198       onwards you only need to /pull/ the latest changes.
200       : $ cd $HOME/elisp/org-mode
202       and then
204       : $ git pull && make clean && make && make doc && make install
206    6. You should restart org mode to have the changes take effect (if
207       you are not rebooting Emacs.)  Also since the intention is to
208       "keep up" with Org mode, you should visit updated sections of
209       documentation for latest updates (use =git log=.)
211    7. As you use your repository over time it will accumulate loose objects.
212       You can reduce the total size of your git repository with
214       : $ git gc
216       which will consolidate loose git objects into pack files.  This
217       reduces the size of the repository and speeds up data access to
218       the objects.
220 ** How can I keep local changes and still track Org mode development?
221    :PROPERTIES:
222    :CUSTOM_ID: keeping-local-changes-current-with-Org-mode-development
223    :END:
225   Say you want to make minor changes to the Makefile to reflect your
226   location for =emacs=.
228   Create a local branch for your changes on top of origin/master as
229   follows:
231   : $ git checkout -b local origin/master
232   : $ git config branch.local.rebase true
233   : # Make your changes to the Makefile and create a new commit
234   : $ git add Makefile
235   : $ git commit -m 'My local Makefile configurations'
236   : # Update git to a newer version
237   : $ git pull
239   Now each time you pull new commits from the distribution repository
240   your local commits will be rewound and replayed on top of the new
241   origin/master.
243 -----------
245   You would normally work on your =local= branch which includes your
246   custom commits; there's no need to switch back to the =master=
247   branch.
249 -----------
251 Here is an example of dealing with conflict resolution during git pull.
253 If you get a conflict during a =git pull= you will need to edit the
254 file with the conflict to fix up the conflicting lines and then tell
255 git that you have resolved the conflict.
257 Conflict resolution goes something like this:
259 1. =git pull= fails with a conflict
260 2. edit the file
261 3. =git add= the file to mark the conflict resolved
262 4. =git rebase --continue=
263 5. lather, rinse, and repeat 2-4 as needed
265 For this example we have the following Makefile:
267 : #
268 : # Example Makefile
269 : #
271 : EMACS=emacs
273 : VERSION=V1.0
275 and we need to change the =EMACS=emacs= line to =EMACS=myemacs= to
276 make it work well on our system.
278 To do this we
280   - create a local branch for our work
282     : $ git checkout -b local origin/master
283     : $ git config branch.local.rebase true
285     This marks the branch so that all local commits on it are rebased
286     on top of any new commits we get in origin/master during a =git
287     pull= operation.
289   - Make our custom changes
291     Edit the makefile so it looks like this:
293     : #
294     : # Example Makefile
295     : #
296     :
297     : EMACS=myemacs
298     :
299     : VERSION=V1.0
301   - Create a commit with our custom changes
302     : $ git add Makefile
303     : $ git commit -m 'My local Makefile configurations'
305   - Later we do a =git pull= but that fails with conflicts.
307     : $ git pull
308     : remote: Counting objects: 5, done.
309     : ...
310     : Patch failed at 0001.
311     :
312     : When you have resolved this problem run "git rebase --continue".
313     : If you would prefer to skip this patch, instead run "git rebase --skip".
314     : To restore the original branch and stop rebasing run "git rebase --abort".
316   - Fix the conflict in your favourite editor
318     Conflict markers look like this:
320     : <<<<<<< HEAD:Makefile
321     : EMACS=emacs22
322     : =======
323     : EMACS=myemacs
324     : >>>>>>> Change emacs location:Makefile
326     This attempted =git pull= caused a conflict.  Fire up your
327     favourite editor and fix the conflict in the Makefile.  The
328     conflict markers are <<<<<<<<<< , ======= , and >>>>>>>>>>.  Fix
329     the Makefile appropriately and delete the conflict markers.  You
330     already edited these lines earlier so fixing it should be trivial.
332     In this case we changed =EMACS=emacs= to =EMACS=myemacs= and
333     upstream changed =EMACS=emacs= to =EMACS=emacs22=.  Just fix the
334     file and save it by deleting the conflict markers and keeping the
335     code you need (in this case the =EMACS=myemacs= line which we
336     originally modified.)
338   - Mark the file's conflict resolved
340     : $ git add Makefile
342     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.
344   - Continue the rebase operation
346     : $ git rebase --continue
348     If any other conflicts arise you fix them the same way - edit the file, mark the conflict resolved, and continue.
350 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"
351 using
352 : $ git rebase --abort
355 ** How can I use a stable release version instead of the bleeding edge master?
356    :PROPERTIES:
357    :CUSTOM_ID: using-stable-releases-only
358    :END:
360 The master branch of the git repository always contains the bleeding
361 edge development code.  This is important for Org's fast development,
362 because code on master gets checked out by many people daily and we
363 quickly receive bug reports if something is wrong.  On rare occasions,
364 this code may not function perfectly for a limited time while we are
365 trying to fix things.
367 Not everyone like to use this bleeding-edge code and face the danger
368 to hit a surprising bug.
370 Therefore, from time to time, we make a release.  This typically
371 happens when the maintainers feel that
373 1. they have reached a good point in the development
374 2. the code has a feature set that should stay and be supported in the
375    future
377 Stable releases are used as the basis for [[http://orgmode.org/index.html#sec-3_3][alternative distributions]] of
378 Org, and they are also the code that gets merged into the Emacs
379 distribution.  If you want to work only with stable releases, you can
380 still use the git repository to do so.
382 *** Run a specific stable release
384 In the repository, do
386 : $ git fetch --tags
387 : $ git tag
389 To see which release tags are available.  Let's say you decide to use
390 =release_7.01f=.
392 : $ git checkout release_7.01f
394 This set the working tree of the repository to the state of Org at the
395 moment of release 7.01f.  You can then run Org from the repository be
396 sure to use the stable release while development continues on the
397 master branch.
399 Later, when we release 7.02, you can switch to that using
401 : $ git fetch --tags                   # to get all the new stuff
402 : $ git tag
403 : $ git checkout release_7.02
405 *** Always run the most recent stable release
407 Alternatively, if you just want to always run whatever the latest
408 stable release is, you can do
410 : $ git checkout -b stable origin/maint
412 and then regularly update this branch by doing
414 : $ git pull
416 ** How can I install an up-to-date version of org-mode without "make" tools?
417    :PROPERTIES:
418    :CUSTOM_ID: installing-org-without-make-tools
419    :END:
421 If you are using org-mode on a computer that lacks developer tools for
422 compiling software, such as [[http://www.gnu.org/software/make/][GNU Make]], you will have to use a
423 *different* installation method than [[http://orgmode.org/manual/Installation.html#Installation][the one outlined in the manual]].
425 Please see [[http://article.gmane.org/gmane.emacs.orgmode/15264][this thread]] on the mailing list for several different ways
426 you can install a recent version of org-mode without using the
427 customary =make clean && make && make install=.
429 The result of that discussion is the file/function found in
430 [[http://orgmode.org/worg/org-hacks.php#compiling-org-without-make]].
432 ** How do I download fresh .zip and .tar.gz archives of Org?
434    You can download [[http://orgmode.org][org-latest.zip]] or [[http://orgmode.org/org-latest.tar.gz][org-latest.tar.gz]] -- these
435    archives are udpated every day at midnight.
437 * Setup
438   :PROPERTIES:
439   :CUSTOM_ID: Setup
440   :END:
441 ** How can I quickly browse all Org options?
443 =M-x org-customize RET=
445 See also [[file:org-tutorials/org-customize.org][Carsten's Org customize tutorial]] and [[file:org-configs/org-customization-guide.org][this customization guide]]
446 for details.
448 ** Can I use the editing features of org-mode in other modes?
449    :PROPERTIES:
450    :CUSTOM_ID: use-editing-features-in-other-modes
451    :END:
453    Not really---but there are a few editing features you can use in
454    other modes.
456    - For tables there is =orgtbl-mode= which implements the table
457      editor as a minor mode. (To enable, type =M-x orgtbl-mode=)
458    - For ordered lists there is =orgstuct-mode= which allows for easy
459      list editing as a minor mode. (To enable, type =M-x
460      orgstruct-mode=)
462    You can activate these modes automatically by using hooks:
464    : (add-hook 'mail-mode-hook 'turn-on-orgtbl)
465    : (add-hook 'mail-mode-hook 'turn-on-orgstruct)
467    For footnotes, there is the function =org-footnote-action=, which
468    works in non-org buffers. This function is a powerful tool for
469    creating and sorting footnotes. To use it globally, you can add the
470    following keybinding to your =.emacs= file (requires Org 6.17 or
471    greater):
473    : (global-set-key (kbd "C-c f") 'org-footnote-action)
475    For other features you need to switch to Org-mode temporarily, or
476    prepare text in a different buffer.
478 ** Why isn't feature "X" working the way it is described in the manual?
479    :PROPERTIES:
480    :CUSTOM_ID: making-sure-org-mode-is-up-to-date
481    :END:
483 Org-mode develops very quickly. If you are using a version of org-mode
484 that shipped with emacs, there is a good chance that it is somewhat
485 out of date.
487 Many of the users on the org-mode mailing list are using either a
488 recent release of org-mode or the
489 [[http://orgmode.org/index.html#sec-3.2][development version of
490 org-mode from the git repository]].
492 If some settings and features aren't working the way you expect, make
493 sure that the version of the manual you are consulting matches the
494 version of org-mode you are using.
496    - You can check which version of org-mode you are using by
497      selection =Org --> Documentation --> Show Version= in the Emacs
498      menu.
500    - The [[http://orgmode.org/manual/index.html][online manual]] at [[http://orgmode.org][orgmode.org]] corresponds to the most recent
501      release.
503    - 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
504      released with the latest official Gnu Emacs release. Compared
505      with the manual at the orgmode.org, the manual at www.gnu.org is
506      somewhat out of date.
508 For instructions on how to stay current with org-mode, consult
509 [[keeping-current-with-Org-mode-development][this FAQ]] or follow the
510 instructions on [[http://orgmode.org][the official org-mode site]].
512 ** Can I get the visibility-cycling features in outline-mode and outline-minor-mode?
513    :PROPERTIES:
514    :CUSTOM_ID: use-visibility-cycling-in-outline-mode
515    :END:
517    Yes, these functions are written in a way that they are independent of
518    the outline setup.  The following setup provides standard Org-mode
519    functionality in outline-mode on =TAB= and =S-TAB=.  For
520    outline-minor-mode, we use =C-TAB= instead of =TAB=,
521    because =TAB= usually has mode-specific tasks.
523 #+BEGIN_SRC emacs-lisp
524 (add-hook 'outline-minor-mode-hook
525   (lambda ()
526     (define-key outline-minor-mode-map [(control tab)] 'org-cycle)
527     (define-key outline-minor-mode-map [(shift tab)] 'org-global-cycle)))
528 (add-hook 'outline-mode-hook
529   (lambda ()
530     (define-key outline-mode-map [(tab)] 'org-cycle)
531     (define-key outline-mode-map [(shift tab)] 'org-global-cycle)))
532 #+END_SRC
534 Or check out /outline-magic.el/, which does this and also provides
535 promotion and demotion functionality.  /outline-magic.el/ is
536 available at [[http://www.astro.uva.nl/~dominik/Tools/outline-magic.el][Outline Magic]].
538 ** Can I save/restore the visibility state of an org-mode buffer?
540 Well, no.
542 ** How can I keep track of changes in my Org files?
543    :PROPERTIES:
544    :CUSTOM_ID: track-of-changes-in-Org-files
545    :END:
547   Use git to track the history of the files, use a cronjob to check in
548   changes regularly.  Such a setup is described by Bernt Hansen
549   in [[http://article.gmane.org/gmane.emacs.orgmode/6233][this message]] on [[http://dir.gmane.org/gmane.emacs.orgmode][emacs-orgmode]].
551 ** Can I use Org-mode as the default mode for all README files?
552    :PROPERTIES:
553    :CUSTOM_ID: Org-mode-as-default-mode
554    :END:
556 Add the following to your .emacs file:
558 : (add-to-list 'auto-mode-alist '("README$" . org-mode))
560 You can even make it the default mode for any files with unspecified
561 mode using
563 : (setq default-major-mode 'org-mode)
565 ** Can I use ido.el for completing stuff in Org?
566    :PROPERTIES:
567    :CUSTOM_ID: ido-complete
568    :END:
570    Yes, you can.  If you are an ido user and ido-mode is active, the
571    following setting will make Org use =ido-completing-read= for most
572    of its completing prompts.
574 : (setq org-completion-use-ido t)
576 ** Should I use one big org file or multiple files?
577    :PROPERTIES:
578    :CUSTOM_ID: how-to-organize-org-mode-files
579    :END:
581 Org-mode is flexible enough to accomodate a variety of organizational
582 and time management schemes. Org's
583 [[http://orgmode.org/manual/Document-Structure.html#Document-Structure][outline
584 cycling and convenient editing and navigation commands]] make it
585 possible to maintain all of your projects and notes in a single file.
586 But org-mode's [[http://orgmode.org/manual/Hyperlinks.html#Hyperlinks][quick and easy hyperlinks]], along with [[http://orgmode.org/manual/Refiling-notes.html#Refiling-notes][easy refiling of
587 notes and todos]], also make it a delight to maintain a private "wiki"
588 consisting of multiple files.
590 No matter how you organize your org files, org-mode's agenda commands
591 make it easy to search all your notes and gather together crucial data
592 in a single view.
594 Moreover, several org-mode settings can be configured either globally
595 in your =.emacs= file or locally (per file or per outline tree). See
596 the [[http://orgmode.org/manual/index.html#Top][manual]] for more details. For an example of local customizations
597 see [[limit-agenda-with-category-match][this FAQ]].
599 Here are a few ideas for organizing org-mode files:
601 - A single file for all your projects and notes.
602 - One file per project.
603 - One file per client.
604 - One file per area of responsibility or type of work (e.g.,
605   household, health, work, etc.).
606 - One file for projects, one for appointments, one for reference
607   material, one for someday/maybe items, etc.
608 - A wiki of hyperlinked files that grows and adapts to meet your
609   needs.
611 For more ideas, see some of the links on the [[file:org-tutorials/index.org][org-tutorial index]] or
612 [[file:org-gtd-etc.org][this page on org-mode and GTD]].
614 ** Why doesn't C-c a call the agenda? Why don't some org keybindings work?
615    :PROPERTIES:
616    :CUSTOM_ID: setting-global-keybindings
617    :END:
619 Org-mode has a few global keybindings that the user must set
620 explicitly in an =.emacs= file. These keybindings include the
621 customary shortcut for calling the agenda (=C-c a=). If nothing
622 happens when you type =C-c a=, then make sure that the following lines
623 are in your =.emacs= file:
625 #+BEGIN_SRC emacs-lisp
626 ;; The following lines are always needed.  Choose your own keys.
627 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
628 (global-set-key "\C-cl" 'org-store-link)
629 (global-set-key "\C-ca" 'org-agenda)
630 (global-set-key "\C-cb" 'org-iswitchb)
631 #+END_SRC emacs-lisp
633 You may, of course, choose whatever keybindings work best for you
634 and do not conflict with other modes.
636 Please see [[http://orgmode.org/manual/Activation.html][this section of the manual]] if you have additional
637 questions.
639 ** Why aren't some of the variables I've customized having an effect?
640    :PROPERTIES:
641    :CUSTOM_ID: load-org-after-setting-variables
642    :END:
644 Some org variables have to be set before org.el is loaded or else they
645 will not work. (An example is the new variable
646 =org-enforce-todo-dependencies=.)
648 To make sure all your variables work you should not use =(require
649 'org)=. Instead use the following setting:
651 : (require 'org-install)
653 You should also make sure that you do not require any other =org-...=
654 files in your =.emacs= file before you have set your org variables,
655 since these will also cause org.el to be loaded. To be safe, load org
656 files *after* you have set your variables.
658 ** How can I make sure that timestamps appear in English?
659    :PROPERTIES:
660    :CUSTOM_ID: timestamps-and-system-time-locale
661    :END:
663 If your system's locale is not set to English, but you would like the
664 timestamps in your org-mode files to appear in English, you can set
665 the following variable:
667 #+begin_src emacs-lisp
668   (setq system-time-locale "C")
669 #+end_src
671 ** What does a minimal .emacs look like?
672 Using a stripped down minimal .emacs files removes broken custom
673 settings as the cause of an issue and makes it easy to reproduce for
674 other people.  The example below has system-specific paths that you'll
675 need to change for your own use.
676 #+begin_src emacs-lisp
677   (add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp"))
678   (add-to-list 'auto-mode-alist '("\\.\\(org\\  |org_archive\\|txt\\)$" . org-mode))
679   (setq org-agenda-files '("/tmp/test.org"))
680   (require 'org-install)
681   (require 'org-habit)
683   (global-set-key "\C-cl" 'org-store-link)
684   (global-set-key "\C-ca" 'org-agenda)
685   (global-set-key "\C-cb" 'org-iswitchb)
686 #+end_src
688 You can save the minimal .emacs file to ~/minimal.emacs, add suspect
689 configuration code to it, then start emacs something like this:
690 #+begin_src sh
691   emacs -Q -l ~/minimal.emacs
692 #+end_src
694 On OS X, starting emacs with minimal configuration might look
695 something like this:
696 #+begin_src sh
697   /Applications/emacs.app/Contents/MacOS/Emacs -Q -l ~/minimal.emacs
698 #+end_src sh
699 * Errors and general problems
700   :PROPERTIES:
701   :CUSTOM_ID: Errors
702   :END:
703 ** Opening Org files in Emacs leads to a crash
704    :PROPERTIES:
705    :CUSTOM_ID: Emacs-crashes-with-org-indent-mode
706    :END:
707    The only known case where Org-mode can crash Emacs is when you are
708    using =org-indent-mode= with Emacs 23.1 (in fact, any version of
709    Emacs before version 23.1.50.3).  Upgrade to Emacs 23.2 and the
710    problem should go away.
712 ** When I try to use Org-mode, I always get the error message =(wrong-type-argument keymapp nil)=
713    :PROPERTIES:
714    :CUSTOM_ID: wrong-type-argument-keymapp
715    :END:
717    This is a conflict with an outdated version of the /allout.el/, see
718    the [[http://orgmode.org/manual/Conflicts.html#Conflicts][Conflicts]] section in the manual
720 ** How can I control the application launched by Org-mode to open a certain file type like pdf, html....
721    :PROPERTIES:
722    :CUSTOM_ID: external-application-launched-to-open-file-link
723    :END:
725 If you want special control about how Org-mode opens files, see the
726 variables =org-file-apps=, =org-file-apps-defaults-gnu=,
727 =org-file-apps-defaults-macosx=, =org-file-apps-defaults-windowsnt=.
729 *However*, normally it is best to just use the mechanism the
730 operating-system provides:
732 *** GNU/Linux systems
733     You you have to check your mailcap settings, find the files:
735     : /etc/mailcap
736     :
737     : or
738     :
739     : $HOME/.mailcap
741 and modify them accordingly. Please read their manual entry.
743 *** Windows systems
744     + for html pages you may configure the =browse-url-= variables through
745       the Customize interface,
746     + the pdf files are automatically opened with Acrobat Reader (if it is
747       installed)
749 *** Mac OSX
750     Change the application responsible for this file type by selecting
751     such a file in the Finder, select =File->Get Info= from the menu
752     and select the application to open this file with.  Then, to
753     propagate the change to all files with the same extension, select
754     the =Change all= button.
756 ** Org-mode takes over the TAB key.  I also want to use YASnippet, is there a way to fix this conflict?
757    :PROPERTIES:
758    :CUSTOM_ID: YASnippet
759    :END:
761 [[http://code.google.com/p/yasnippet/][yasnippet]] is yet another snippet expansion system for Emacs.  It is
762 inspired by TextMate's templating syntax.
763 - watch the [[http://www.youtube.com/watch?v=vOj7btx3ATg][video on YouTube]]
764 - see the [[http://yasnippet.googlecode.com/svn/trunk/doc/index.html][intro and tutorial]]
766 *Note*: yasnippet is not compatible with =org-indent-mode= currently
767 there is no known way to use both successfully with =yas/trigger-key=
768 set to =TAB= (or =[tab]= etc...)
770 The way Org-mode binds the =TAB= key (binding to =[tab]= instead of
771 =\t=) overrules yasnippets' access to this key.  The following code
772 fixes this problem:
774 #+begin_src emacs-lisp
775 (add-hook 'org-mode-hook
776           (lambda ()
777             (org-set-local 'yas/trigger-key [tab])
778             (define-key yas/keymap [tab] 'yas/next-field-group)))
779 #+end_src
781 If the above code doesn't work (which it may not with later versions
782 of yasnippet).  Then try the following
784 #+begin_src emacs-lisp
785   (defun yas/org-very-safe-expand ()
786     (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
788   (add-hook 'org-mode-hook
789             (lambda ()
790               ;; yasnippet (using the new org-cycle hooks)
791               (make-variable-buffer-local 'yas/trigger-key)
792               (setq yas/trigger-key [tab])
793               (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
794               (define-key yas/keymap [tab] 'yas/next-field)))
795 #+end_src
797 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]])
798 with YASnippets for Org-mode.
800 ** Org-mode takes over the S-cursor keys.  I also want to use CUA-mode, is there a way to fix this conflict?
801    :PROPERTIES:
802    :CUSTOM_ID: CUA-mode
803    :END:
805 Yes, see the  [[http://orgmode.org/manual/Conflicts.html#Conflicts][Conflicts]] section of the manual.
807 ** Org-mode takes over the S-cursor keys.  I also want to use windmove.el, is there a way to fix this conflict?
808    :PROPERTIES:
809    :CUSTOM_ID: windmove.el
810    :END:
812 Yes, see the [[http://orgmode.org/manual/Conflicts.html#Conflicts][Conflicts]] section of the manual.
814 ** Org behaves strangely: some keys don't work, some features are missing, my settings have no effect, ...
815    :PROPERTIES:
816    :CUSTOM_ID: loaded-old-org
817    :END:
819 When this sort of things happen, it probably is because Emacs is loading an old version of Org-mode instead of the one you expected. Check it with =M-x org-version=.
821 This happens because Emacs loads first the system org-mode (the one included with Emacs) before the one in your directory. Check the =load-path= variable; you might see that your org-mode appears /after/ the system-wide path; this is bad.
823 You should add your directories to the =load-path= at the beginning:
825 :  (add-to-list 'load-path "~/.emacs.d/org-mode/lisp") (require 'org-install)
827 Function =add-to-list= adds at the beginning. Don't use =append= because it appends at the end. Also be sure to use =(require 'org-install)= and not =(require 'org)=.
829 This wrong version loading may also happen if you have a byte-compiled =org.elc= from an old version together with a new =org.el=. Since Emacs prefers loading byte-compiled files (even if the =.el= is newer), it will load the old Org-mode.
831 ** Why doesn't org-batch-agenda work under Win32?
832    :PROPERTIES:
833    :CUSTOM_ID: org-batch-agenda-under-win32
834    :END:
836 When I run the example batch files to print my agenda to the console
837 under Win32 I get the failure:
839 : End of file during parsing
841 and no agenda is printed.
843 The problem is the use of single quotes surrounding the eval in the
844 emacs command-line. This gets confused under Win32. All string
845 parameters with spaces must be surrounded in double quotes. This means
846 that double quotes being passed to the eval must be escaped.
848 Therefore, instead of the following:
850 : <path to emacs>\emacs.exe -batch -l ~/_emacs_org \
851 :     -eval '(org-batch-agenda "a")'
853 you need to use the following:
855 :  <path to emacs>\emacs.exe -batch -l ~/_emacs_org \
856 :     -eval "(org-batch-agenda \"a\")"
858 (all on one line, of course).
860 ** Org agenda seems very slow
861    :PROPERTIES:
862    :CUSTOM_ID: slow-agenda
863    :END:
865 If it takes a long time to generate or refresh the agenda, you might
866 want first check which version of org-mode you are using. There have
867 been major optimizations of org-agenda since 6.21b, which was the
868 version of org-mode released with Emacs 23. If you are using 6.21b or
869 earlier (you can check with =M-x org-version=), then you might want to
870 consider upgrading to a more recent version of org-mode.
872 Here are some other ideas for speeding up the agenda:
874 1. Use a one day agenda view (rather than a seven day view).
876    =(setq org-agenda-ndays 1)=
878 2. Archive inactive items to separate files.
880    =C-c C-x C-s= (org-archive-subtree)
882 3. Do not include the global todo list in your agenda view.
884    (setq org-agenda-include-all-todo nil)
886 4. Make sure that your org files are byte-compiled.
888    I.e., make sure there are files ending in .elc in your org
889    installation directory.
891 ** Visual-line-mode doesn't work well with org-mode
892    :PROPERTIES:
893    :CUSTOM_ID: visual-line-mode
894    :END:
896 Visual-line-mode "soft wraps" lines so that the visual edge of the
897 buffer is considered a line break for purposes of navigation, even
898 though there is no line break in reality.
900 In older versions of org-mode, org-beginning-of-line and
901 org-end-of-line do not work well with visual line mode. (The two
902 commands disregard soft line breaks and move to the beginning and end
903 of the hard line break.) A patch was introduces to fix this behavior
904 in July of 2009. n
906 If you are using an older version of org mode, you can:
908 1. Add a hook to turn off visual line mode.
910 2. Add the following to your =.emacs=:
912 #+begin_src emacs-lisp
914 (add-hook 'org-mode-hook
915   (lambda ()
916     (define-key org-mode-map "\C-a" 'move-beginning-of-line)
917     (define-key org-mode-map "\C-e" 'move-end-of-line)))
919 #+end_src
920 * Faces and highlighting
921   :PROPERTIES:
922   :CUSTOM_ID: Faces
923   :END:
924 ** Org-mode has a lot of colors?  How can I change them?
925    :PROPERTIES:
926    :CUSTOM_ID: customizing-org-faces
927    :END:
929 This is a question that applies to Emacs as a whole, but it comes up
930 quite frequently on the org-mode mailing list, so it is appropriate to
931 discuss it here.
933 If you would like to change the style of a face in org-mode (or any
934 other Emacs mode), simply type =M-x customize-face [RET]= while the
935 cursor is on the color/style you are interested in modifying. You will
936 be given the opportunity to customize all the faces located at that
937 point.
939 If you would like an overview of all the faces in org-mode, you can
940 type =C-u M-x list-faces-display [RET] org= and you will be shown all
941 the faces defined by org-mode along with an illustration of their
942 current settings.
944 If you would like to customize org-faces and other aspects of
945 org-appearance, type =M-x customize-group org-font-lock [RET]=.
947 Finally, if you would like verbose information about the properties of
948 the text under the cursor, you can type =C-u C-x ==.
950 See the Worg page on [[file:org-tutorials/org-appearance.org][customizing Org appearance]] for further information.
951 ** Why do I get a tiny font in column view when using emacs daemon?
952    :PROPERTIES:
953    :CUSTOM_ID: column-view-tiny-font
954    :END:
956 When using emacs in daemon mode (=emacs --daemon=), client frames
957 sometimes override the column view face settings, resulting in very
958 small fonts. Here is a fix:
960 #+begin_src emacs-lisp
961   (defun org-column-view-uses-fixed-width-face ()
962   ;; copy from org-faces.el
963   (when (fboundp 'set-face-attribute)
964       ;; Make sure that a fixed-width face is used when we have a column
965       ;; table.
966       (set-face-attribute 'org-column nil
967                           :height (face-attribute 'default :height)
968                           :family (face-attribute 'default :family))))
970    (when (and (fboundp 'daemonp) (daemonp))
971     (add-hook 'org-mode-hook 'org-column-view-uses-fixed-width-face))
972 #+end_src
974 This fix was provided in the following mailing list post:
976 http://article.gmane.org/gmane.emacs.orgmode/27560
977 ** How can I stop the mouse cursor from highlighting lines in the agenda?
978    :PROPERTIES:
979    :CUSTOM_ID: ratpoison-for-agenda-highlighting
980    :END:
982 You can add the following to your =.emacs=:
984 #+begin_src emacs-lisp
985 (add-hook 'org-finalize-agenda-hook
986     (lambda () (remove-text-properties
987                (point-min) (point-max) '(mouse-face t))))
988 #+end_src
990 * Outline
991   :PROPERTIES:
992   :CUSTOM_ID: Outline
993   :END:
994 ** Can I have two windows on the same Org-mode file, with different outline visibilities?
995    :PROPERTIES:
996    :CUSTOM_ID: indirect-buffers
997    :END:
999    You may use /indirect buffers/ which do exactly this.  See the
1000    documentation on the command =make-indirect-buffer=.
1002    Org-mode has built-in commands that allow you create an indirect
1003    buffer from a subtree of an outline. To open a subtree in new
1004    window, type =C-c C-x b=. Any changes you make in the new window
1005    will be saved to the original file, but the visibility of both
1006    buffers will remain independent of one another.
1008    For multiple indirect buffers from the same file, you must use the
1009    prefix =C-u= when creating the second (or third) buffer. Otherwise
1010    the new indirect buffer will replace the old.
1012    You can also create an independent view of an outline subtree by
1013    typing =b= on an item in the agenda.
1015 ** Emacs outlines are unreadable.  Can I get rid of all those stars?
1016    :PROPERTIES:
1017    :CUSTOM_ID: Emacs-outlines-are-unreadable
1018    :END:
1020    See the section [[http://orgmode.org/manual/Clean-view.html#Clean-view][Clean outline view]] in the manual.
1021 ** C-k is killing whole subtrees!  I lost my work!
1022    :PROPERTIES:
1023    :CUSTOM_ID: C-k-is-killing-subtrees
1024    :END:
1026   =(setq org-special-ctrl-k t)= before losing your work.
1028 ** Why aren't commands working on regions?
1029    :PROPERTIES:
1030    :CUSTOM_ID: transient-mark-mode
1031    :END:
1033 Some org-mode commands, such as M-right and M-left for demoting or
1034 promoting headlines (see [[demote-multiple-headlines][this FAQ]]), can be applied to entire regions.
1035 These commands, however, will only work on active regions set with
1036 [[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
1037 Emacs 23. To enable it in earlier versions of emacs, put the following
1038 in your =.emacs= file:
1040 : (transient-mark-mode 1)
1042 Alternatively, you may turn off transient mark mode and use [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Momentary-Mark.html][a
1043 momentary mark]] (=C-<SPC> C-<SPC>=).
1045 ** Why is a blank line inserted after headlines and list items?
1046    :PROPERTIES:
1047    :ID:       2463F4D8-F686-4CF3-AA07-08976F8A4972
1048    :END:
1049    :PROPERTIES:
1050    :CUSTOM_ID: blank-line-after-headlines-and-list-items
1051    :END:
1053 In org-mode, typing =M-RET= at the end of a headline will create a new
1054 headline of the same level on a new line. The same is true for plain
1055 lists. By default org-mode uses context to determine if a blank line
1056 should be inserted after each headline or plain list item when =M-RET=
1057 is pressed. For instance, if a there is a blank line before a
1058 headline, then typing =M-RET= at the end of the line will insert a
1059 blank line before the new headline. For instance, hitting =M-RET=
1060 at the end of "Headline Two" below inserts a new headline without a
1061 blank line:
1063 : ** Headline One
1064 : ** Headline Two
1065 : **
1067 If there is a blank line between Headline One and Headline Two,
1068 however, the results will be as follows:
1070 : ** Headline One
1072 : ** Headline Two
1074 : **
1076 If you do not like the default behavior you can change it with the
1077 variable =org-blank-before-new-entry=. You can set headings and/or
1078 plain lists to auto (the default setting), t (always), or nil (never).
1080 ** How can I promote or demote multiple headlines at once?
1081    :PROPERTIES:
1082    :CUSTOM_ID: demote-multiple-headlines
1083    :END:
1085 If you have a long list of first level headlines that you'd like to
1086 demote to second level headlines, you can select the headlines as a
1087 region and then hit =M-<right>= to demote all the headlines at once.
1089 Note: =M-S-<right>= will not work on a selected region. Its use is to
1090 demote a single subtree (i.e., a headline and all sub-headlines).
1092 If M-<right> doesn't seem to work, make sure transient mark mode is
1093 enabled. See [[transient-mark-mode][this FAQ]].
1095 ** What's the deal with all the ellipses in my org outlines?
1096    :PROPERTIES:
1097    :CUSTOM_ID: org-ellipses
1098    :END:
1100 Org-mode uses ellipses to indicate folded (and thus hidden) text. Most
1101 commonly, ellispes occur at the end of headings with folded content:
1103 : * Heading ...
1105 Or, for instance, they may indicate closed drawers:
1107 : :PROPERTIES: ...
1109 Sometimes, as a result of editing and cycling an outline, ellipses may
1110 appear in unexpected places. You should *never* delete these ellipses,
1111 as you may accidentally delete hidden text. Instead, you can type =C-c
1112 C-r= (org-reveal) to display all hidden text in the vicinity. Or you
1113 may type =M-x RET show-all= to reveal all text in the org file.
1115 If you would prefer a symbol or face for indicating hidden text, you
1116 can customize the variable org-ellipses.
1118 ** How do I yank a subtree so it's indented according to points' location?
1119    :PROPERTIES:
1120    :CUSTOM_ID: yank-indent-subtree
1121    :END:
1123 You can either use =C-c C-w= with a working [[http://orgmode.org/manual/Refiling-notes.html#Refiling-notes][refile-targets]] setup.
1125 Or set =org-yank-adjusted-subtrees= to =t= which will adjust the
1126 yanked headline's level correctly.
1128 Just use =C-k= and =C-y= as you would everywhere else in Emacs.
1130 ** Can I read org-mode outlines in vim?
1131    :PROPERTIES:
1132    :CUSTOM_ID: org-outlines-in-vim
1133    :END:
1135 Yes, there is a script that enables one to view and navigate folded
1136 outline/org files in vim (though without most of org-mode's
1137 functionality, of course).
1139   - [[http://www.vim.org/scripts/script.php?script_id%3D1266][Emacs outline mode - Imitates Emacsen : vim online]]
1141 For instructions on how to set it up, please see [[http://mid.gmane.org/EA275862-B97A-4BAC-B879-177FD07A2D56@gaillourdet.net][this mailing list
1142 post]].
1144 * Todos and Tags
1145   :PROPERTIES:
1146   :CUSTOM_ID: Todos-and-Tags
1147   :END:
1148 ** How can I cycle through the TODO keyword of an entry?
1149    :PROPERTIES:
1150    :CUSTOM_ID: cycle-TODO-keywords
1151    :END:
1153   =C-c C-t= or =S-<left/right>= is what you need.
1155 ** How do I track state changes for tasks in Org?
1156    :PROPERTIES:
1157    :CUSTOM_ID: track-state-changes-for-tasks
1158    :END:
1160   Take a look at the [[http://thread.gmane.org/gmane.emacs.orgmode/6082][post by Bernt Hansen]] for setting up TODO keyword
1161   states and logging timestamps for task state changes.
1163 ** Can I select the TODO keywords with a tag-like interface?
1164    :PROPERTIES:
1165    :CUSTOM_ID: select-TODO-keywords-with-tag-like-interface
1166    :END:
1168   Yes.  Use =(setq org-use-fast-todo-selection t)=
1170   If you want to set both your todos and your tags using a single
1171   interface, then check out the variable
1172   =org-fast-tag-selection-include-todo=.
1174   See [[http://orgmode.org/manual/Fast-access-to-TODO-states.html][this section of the manual]] for more details.
1176 ** How can I quickly set the tag of an entry?
1177    :PROPERTIES:
1178    :CUSTOM_ID: quickly-set-tag-of-entry
1179    :END:
1181    Use =C-c C-c= or =C-c C-q= on the headline. =C-c C-q= is useful for
1182    setting tabs in a [[http://orgmode.org/manual/Remember.html#Remember][remember]] buffer, since =C-c C-c= is the default
1183    keybinding for filing a note from the remember buffer.
1185    You can set tags even more quickly by setting one of the character
1186    shortcuts for [[http://orgmode.org/manual/Setting-tags.html#Setting-tags][fast tag selection]].
1188    To set tag shortcuts for all org buffers, put something like the
1189    following in your =.emacs= file (or create the same settings by
1190    typing =M-x customize-variable RET org-tag-alist=):
1192 : (setq org-tag-alist '(("computer" . ?c) ("office" . ?o) ("home" . ?h)))
1194    To set tag shortcuts for a single buffer, put something like the
1195    following at the top of your org file:
1197 : #+TAGS: computer(c) office(o) home(h)
1199 ** How can I change the colors of TODO keywords?
1201 You can use the variable org-todo-keyword-faces. Here are some sample
1202 settings:
1204 #+begin_src emacs-lisp
1205 (setq org-todo-keyword-faces
1206       '(
1207         ("TODO"  . (:foreground "firebrick2" :weight bold))
1208         ("WAITING"  . (:foreground "olivedrab" :weight bold))
1209         ("LATER"  . (:foreground "sienna" :weight bold))
1210         ("PROJECT"  . (:foreground "steelblue" :weight bold))
1211         ("DONE"  . (:foreground "forestgreen" :weight bold))
1212         ("MAYBE"  . (:foreground "dimgrey" :weight bold))
1213         ("CANCELED"  . shadow)
1214         ))
1215 #+end_src
1217 If you want to change the color of all active todos or all inactive
1218 todos, type:
1220 : M-x customize-face RET org-todo
1221 : M-x customize-face RET org-done
1223 You can also set values for each of these in your =.emacs= file:
1225 : (set-face-foreground 'org-todo "firebrick2")
1226 : (set-face-foreground 'org-done "forestgreen")
1228 * Hyperlinks
1229   :PROPERTIES:
1230   :CUSTOM_ID: Hyperlinks
1231   :END:
1232 ** Why do I have to confirm the execution of each shell/elisp link?
1233    :PROPERTIES:
1234    :CUSTOM_ID: confirm-shell/elisp-link
1235    :END:
1237    The confirmation is there to protect you from unwantingly execute
1238    potentially dangerous commands.  For example, imagine a link
1240    : [[shell:rm -rf ~/*][Google Search]]
1242    In an Org-mode buffer, this command would look like /Google Search/,
1243    but really it would remove your home directory.  If you wish, you can
1244    make it easier to respond to the query by setting
1246    : (setq org-confirm-shell-link-function 'y-or-n-p
1247    :       org-confirm-elisp-link-function 'y-or-n-p).
1249    Then a single keypress will be enough to confirm those links.  It is
1250    also possible to turn off this check entirely, but I strongly
1251    recommend against this.  Be warned.
1253 ** Can I use RET or TAB to follow a link?
1254    :PROPERTIES:
1255    :CUSTOM_ID: RET-or-TAB-to-follow-link
1256    :END:
1258    Yes, this is how:
1260    : (setq org-return-follows-link t)
1261    : (setq org-tab-follows-link t)
1263 ** Can I keep mouse-1 clicks from following a link?
1264    :PROPERTIES:
1265    :CUSTOM_ID: mouse-1-following-link
1266    :END:
1268    Activating links with =mouse-1= is a new feature in Emacs 22, to make
1269    link behavior similar to other applications like web browsers.  If
1270    you hold the mouse button down a bit longer, the cursor will be set
1271    without following the link.  If you cannot get used to this behavior,
1272    you can (as in Emacs 21) use =mouse-2= to follow links and turn off
1273    link activation for =mouse-1= with
1275    : (setq org-mouse-1-follows-link nil)
1277 ** How can I get completion of file names when creating a link?
1278    :PROPERTIES:
1279    :CUSTOM_ID: completion-of-file-links
1280    :END:
1282 You can use org-insert-link with a prefix argument:
1284 : C-u C-c C-l
1286 You will be greeted with prompt in the minibuffer that allows for file
1287 completion using your preferred Emacs method for finding files.
1289 * Plain Lists
1290   :PROPERTIES:
1291   :CUSTOM_ID: Plain-Lists
1292   :END:
1293 ** How can I insert an empty line before each newly inserted headline, but not before each newly inserted plain-list item?
1294    :PROPERTIES:
1295    :CUSTOM_ID: empty-line-before-each-new-headline-but-not-item
1296    :END:
1298 : (setq org-blank-before-new-entry
1299 :       '((heading . t) (plain-list-item . nil))
1301 See also [[id:2463F4D8-F686-4CF3-AA07-08976F8A4972][Why is a blank line inserted after headlines and list items?]].
1303 ** How can I convert itemized lists to enumerated lists?
1304    :PROPERTIES:
1305    :CUSTOM_ID: convert-itemized-to-enumerated-lists
1306    :END:
1308    You can use =C-c -= or =S-<left>/<right>= to cycle through the various
1309    bullet headlines available for lists: =-, +, *, 1., 1)=.
1311    See [[http://orgmode.org/manual/Plain-lists.html#Plain-lists][this section of the manual]] for more information.
1313 ** How can I convert plain lists to headlines and vice versa?
1314    :PROPERTIES:
1315    :CUSTOM_ID: convert-plain-lists-to-headlines
1316    :END:
1318    To convert a plain list item or line to a headline, type =C-c *= on
1319    the headline. This will make the line a subheading of the current
1320    headline.
1322    To convert a headline to a plain list item, type =C-c -= while the
1323    cursor is on the headline.
1325    To convert a headline to an unadorned line of text, type =C-c *= on
1326    the headline.
1328    You can use query replace to accomplish the same things, as Bernt
1329    Hansen explains in [[http://article.gmane.org/gmane.emacs.orgmode/10148][this mailing list post]].
1331 ** Is there a good way to create a description list?
1332    :PROPERTIES:
1333    :CUSTOM_ID: description-lists
1334    :END:
1336   Yes, these are now built-in:
1338 #+BEGIN_EXAMPLE
1339 - item1 :: Description of this item 1
1340 - item2 :: Description of this item 2
1341 - item1 :: Description of this item 3
1342       also in multiple lines
1343 #+END_EXAMPLE
1345 * Tables
1346   :PROPERTIES:
1347   :CUSTOM_ID: Tables
1348   :END:
1349 ** How can I make table alignment work with Asian character sets
1350    :PROPERTIES:
1351    :CUSTOM_ID: table-alignment-asian-characters
1352    :END:
1354 When table alignment fails, it usually has to do with character sets
1355 where some characters have non-integer width.  Org will deal correctly
1356 with characters that are one or two or three ASCII characters wide,
1357 but not with characters that are, for example, 1.5 ASCII characters
1358 wide.  To make table alignment work you need to switch to a different
1359 character set.
1361 ** Can I plot data from a table?
1362    :PROPERTIES:
1363    :CUSTOM_ID: plotting-table-data
1364    :END:
1366    Yes, you can, using org-plot.el written by Eric Schulte and now
1367    bundled with Org.  See [[http://orgmode.org/manual/Org_002dPlot.html#Org-Plot][the manual section about this]].
1369    See also [[file:org-tutorials/org-plot.org][this excellent tutorial]] by Eric Schulte.
1371 ** How can I fill a table column with incremental numbers?
1372    :PROPERTIES:
1373    :CUSTOM_ID: fill-table-column-with-incremental-numbers
1374    :END:
1376 Here is how: Use a field formula to set the first value in the column:
1378 #+begin_src org
1379 ,| N   |   |
1380 ,|-----+---|
1381 ,| :=1 |   |
1382 ,|     |   |
1383 ,|     |   |
1384 ,|     |   |
1385 ,#+TBLFM: @2$1=1
1386 #+end_src
1388 Then define a column formula in the second field:
1390 #+begin_src org
1391 ,| N        |   |
1392 ,|----------+---|
1393 ,| 1        |   |
1394 ,| =@-1 + 1 |   |
1395 ,|          |   |
1396 ,|          |   |
1397 ,#+TBLFM: @2$1=1
1398 #+end_src
1400 After recomputing the table, the column will be filled with
1401 incremental numbers:
1403 #+begin_src org
1404 ,| N |   |
1405 ,|---+---|
1406 ,| 1 |   |
1407 ,| 2 |   |
1408 ,| 3 |   |
1409 ,| 4 |   |
1410 ,#+TBLFM: $1=@-1 + 1::@2$1=1
1411 #+end_src
1413 Note that you could use arbitrary starting values and column formulas.
1415 ** Why does my table column get filled with #ERROR?
1416    :PROPERTIES:
1417    :CUSTOM_ID: table-column-filled-with-ERROR
1418    :END:
1420    Org-mode tried to compute the column from other fields using a
1421    formula stored in the =#+TBLFM:= line just below the table, and
1422    the evaluation of the formula fails.  Fix the fields used in the
1423    formula, or fix the formula, or remove it!
1425 ** How can I stop the table editor from creating new lines?
1426    :PROPERTIES:
1427    :CUSTOM_ID: table-editor-creates-new-lines
1428    :END:
1430    When I am in the last column of a table and just above a horizontal
1431    line in the table, pressing TAB creates a new table line before the
1432    horizontal line.  To move to the line below the
1433    horizontal line instead, do this:
1435    Press =down= (to get on the separator line) and then =TAB=.
1436    Or configure the variable
1438    : (setq org-table-tab-jumps-over-hlines t)
1440 ** How can I get table fields starting with "="?
1441    :PROPERTIES:
1442    :CUSTOM_ID: table-fields-starting-with-=
1443    :END:
1445    With the setting
1447    : (setq org-table-formula-evaluate-inline nil)
1449    this will no longer happen.  You can still use formulas using the
1450    commands @<tt>C-c =@</tt> and @<tt>C-u C-c =@</tt>
1452 ** How can I change the indentation of an entire table without fixing every line by hand?
1453    :PROPERTIES:
1454    :CUSTOM_ID: change-indentation-entire-table
1455    :END:
1457    The indentation of a table is set by the first line.  So just fix the
1458    indentation of the first line and realign with =TAB=.
1460 ** In my huge table the realigning after each TAB takes too long.  What can I do?
1461    :PROPERTIES:
1462    :CUSTOM_ID: table-realigning-after-TAB-takes-long
1463    :END:
1465    Either split the table into several by inserting an empty line every
1466    100 lines or so.  Or turn off the automatic re-align with
1468    : (setq org-table-automatic-realign nil)
1470    After this the only way to realign a table is to press =C-c C-c=.  It
1471    will no longer happen automatically, removing the corresponding delays
1472    during editing.
1474 ** Recalculation of my table takes too long.  What can I do?
1475    :PROPERTIES:
1476    :CUSTOM_ID: Recalculation-of-my-table-takes-too-long
1477    :END:
1479    Nothing, really.  The spreadsheet in org is mostly done to make
1480    calculations possible, not so much to make them fast.  Since Org-mode
1481    is firmly committed to the ASCII format, nothing is stopping you from
1482    editing the table by hand.  Therefore, there is no internal
1483    representation of the data.  Each time Org-mode starts a computation,
1484    it must scan the table for special lines, find the fields etc.  This
1485    is slow.  Furthermore, Calc is slow compared to hardware
1486    computations.  To make this work with normal editing, recalculation
1487    is not happening automatically, or only for the current line, so that
1488    the long wait for a full table iteration only happens when you ask
1489    for it.
1491    So for really complex tables, moving to a "real" spreadsheet may
1492    still be the best option.
1494    That said, there are some ways to optimize things in Org-mode, and I
1495    have been thinking about moving a bit further down this line.
1496    However, for my applications this has so far not been an issue at
1497    all.  If you have a good case, you could try to convince me.
1499 ** =S-RET= in a table keeps increasing the copied numbers.  How can I stop this?
1500    :PROPERTIES:
1501    :CUSTOM_ID: S-RET-in-a-table-increases-copied-numbers
1502    :END:
1504    Well, it is /supposed/ to be a feature, to make it easy to create a
1505    column with increasing numbers.  If this gets into your way, turn it
1506    off with
1508    : (setq org-org-table-copy-increment nil)
1510 ** When I export tables to html, they don't have borders.
1511    :PROPERTIES:
1512    :CUSTOM_ID: table-borders-in-html-export
1513    :END:
1515 By default, org mode exports tables without borders.
1517 You can changed this by placing an =#+ATTR_HTML= line before the
1518 table:
1520 :  #+ATTR_HTML: border="2" rules="all" frame="all"
1522 See [[http://orgmode.org/manual/Tables-in-HTML-export.html#Tables-in-HTML-export][the manual]] for more details.
1524 ** Why does the Calc high precision (e. g. =p20=) not work like expected?
1525    :PROPERTIES:
1526    :CUSTOM_ID: table-high-precision
1527    :END:
1529 - *Short answer*
1531   Avoid
1532   : | 0.16666667000000 |
1533   : #+TBLFM: $1 = 1 / 2 * 3; p20 %.14f
1534   and use
1535   : | 0.16666666666667 |
1536   : #+TBLFM: $1 = 1 / 2 * 3; p20 f14
1538 - *Longer answer*
1540   It is important to distinguish between the precision of
1541   1) =p20=: Calc internal calculation (=calc-internal-prec=)
1542   2) =f14=: Calc float formatting, unlimited in precision (=calc-float-format=)
1543   3) =%.14f=: the =printf= reformatting, limited in precision
1545   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.
1547   Use =C-h v org-calc-default-modes RET= to check the Org default settings
1548   which are used if no format specifiers are added to a table formula.
1549   The examples below have been made with the out_of_the_box Org defaults
1550   =calc-internal-prec = 12= and =calc-float-format = 8=.
1552   Remember the formula debugger, toggled with =C-c {=,
1553   to view the processing stages like:
1554   |   | formula debugger label | processing stage           |
1555   | / | <                      | <>                         |
1556   |---+------------------------+----------------------------|
1557   |   | Result:                | output of Calc             |
1558   |   | Format:                | reformatting with =printf= |
1560   Following are some examples to demonstrate
1561   the interaction of the three precisions.
1563   - *display precision limitations for Calc formulas*
1564     - limited by Calc internal calculation precision from Org default
1565       (here =p12=)
1566       : | 0.16666666666700 |
1567       : #+TBLFM: $1 = 1 / 2 * 3;     f14
1569       : | 0.1666666666670000000 |
1570       : #+TBLFM: $1 = 1 / 2 * 3;     f19
1572     - limited by Calc float format from Org default (here =f8=)
1573       : | 0.16666667 |
1574       : #+TBLFM: $1 = 1 / 2 * 3
1576       : | 0.16666667 |
1577       : #+TBLFM: $1 = 1 / 2 * 3; p20
1579       : | 0.16666667000000 |
1580       : #+TBLFM: $1 = 1 / 2 * 3;         %.14f
1582       : | 0.16666667000000 |
1583       : #+TBLFM: $1 = 1 / 2 * 3; p20     %.14f
1585     - limited by Calc float format specified
1586       : | 0.166667 |
1587       : #+TBLFM: $1 = 1 / 2 * 3;     f6
1589       : | 0.16666666666667 |
1590       : #+TBLFM: $1 = 1 / 2 * 3; p20 f14
1592       : | 0.1666666666666666667 |
1593       : #+TBLFM: $1 = 1 / 2 * 3; p20 f19
1595     - limited by =printf= conversion to Emacs Lisp float
1596       : | 0.1666666699999999900 | the inaccuracy is platform dependent |
1597       : #+TBLFM: $1 = 1 / 2 * 3;         %.19f
1599       : | 0.1666666699999999900 | the inaccuracy is platform dependent |
1600       : #+TBLFM: $1 = 1 / 2 * 3; p20     %.19f
1602       : | 0.1666666666666666600 | the inaccuracy is platform dependent |
1603       : #+TBLFM: $1 = 1 / 2 * 3; p20 f20 %.19f
1605     - limited by =printf= format specified
1606       : | 0.166667 |
1607       : #+TBLFM: $1 = 1 / 2 * 3;         %.6f
1609   - *display precision limitations for Emacs Lisp formulas*
1610     - limited by Emacs Lisp float
1611       : | 0.16666666666666666 |
1612       : #+TBLFM: $1 = '(/ 1.0 (* 2 3))
1614       : | 0.1666666666666666574 | the inaccuracy is platform dependent |
1615       : #+TBLFM: $1 = '(/ 1.0 (* 2 3)); %.19f
1617     - limited by =printf= format specified
1618       : | 0.16666666666667 |
1619       : #+TBLFM: $1 = '(/ 1.0 (* 2 3)); %.14f
1621 This FAQ entry is based on this [[http://thread.gmane.org/gmane.emacs.orgmode/22642][mailing list thread]]
1622 and is continued in the [[#table-float-fraction][next FAQ entry]].
1624 ** Which float format shows the fraction part also when the latter is zero?
1625    :PROPERTIES:
1626    :CUSTOM_ID: table-float-fraction
1627    :END:
1629 - *Short answer*
1631   Avoid
1632   : | 1 |
1633   : #+TBLFM: $1 = 1 + 0; f3
1634   and use
1635   : | 1.000 |
1636   : #+TBLFM: $1 = 1 + 0; %.3f
1638 - *Longer answer*
1640   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]]
1641   in the section Mode Settings -> Display Modes -> Float Formats
1642   [[http://www.delorie.com/gnu/docs/calc/calc_163.html][found here as long as the section numbering is kept]].
1644   Remember the formula debugger, toggled with =C-c {=,
1645   to view the processing stages like:
1646   |   | formula debugger label | processing stage           |
1647   | / | <                      | <>                         |
1648   |---+------------------------+----------------------------|
1649   |   | Result:                | output of Calc             |
1650   |   | Format:                | reformatting with =printf= |
1652   Following are some examples to demonstrate different float formats.
1654   - normal precision
1655     : |----------------------+---------+-------+-------|
1656     : | number               |      f3 |   f-3 |  %.3f |
1657     : |----------------------+---------+-------+-------|
1658     : | 1 + 0                |       1 |     1 | 1.000 |
1659     : | 0 + 0                |       0 |     0 | 0.000 |
1660     : |----------------------+---------+-------+-------|
1661     : | 1 + 1 / 2 * 3 * 1000 |   1.000 | 1.000 | 1.000 |
1662     : | 0 + 1 / 2 * 3 * 1000 | 1.67e-4 | 0.000 | 0.000 |
1663     : |----------------------+---------+-------+-------|
1664     : | 1 + 1 / 2 * 3 *  100 |   1.002 | 1.002 | 1.002 |
1665     : | 0 + 1 / 2 * 3 *  100 |   0.002 | 0.002 | 0.002 |
1666     : |----------------------+---------+-------+-------|
1667     : #+TBLFM: $2 = $1; f3 :: $3 = $1; f-3 :: $4 = $1; %.3f
1669   - high precision
1670     : |----------------------+--------------------------+-----------------------|
1671     : | number               |                      f19 |                  f-19 |
1672     : |----------------------+--------------------------+-----------------------|
1673     : | 1 + 0                |                        1 |                     1 |
1674     : | 0 + 0                |                        0 |                     0 |
1675     : |----------------------+--------------------------+-----------------------|
1676     : | 1 + 1 / 2 * 3 * 1e19 |    1.0000000000000000000 | 1.0000000000000000000 |
1677     : | 0 + 1 / 2 * 3 * 1e19 | 1.666666666666666667e-20 | 0.0000000000000000000 |
1678     : |----------------------+--------------------------+-----------------------|
1679     : | 1 + 1 / 2 * 3 * 1e18 |    1.0000000000000000002 | 1.0000000000000000002 |
1680     : | 0 + 1 / 2 * 3 * 1e18 |    0.0000000000000000002 | 0.0000000000000000002 |
1681     : |----------------------+--------------------------+-----------------------|
1682     : #+TBLFM: $2 = $1; p20 f19 :: $3 = $1; p20 f-19
1684     The =printf= reformatting (=%.19f=) cannot be used with high precision,
1685     see the [[#table-high-precision][previous FAQ entry]].
1687 ** How can I center tables in LaTeX output?
1689 Set the `org-export-latex-tables-centered' to `t':
1691 : (defcustom org-export-latex-tables-centered t
1692 :   "When non-nil, tables are exported in a center environment."
1693 :   :group 'org-export-latex
1694 :   :type 'boolean)
1696 * Markup
1697   :PROPERTIES:
1698   :CUSTOM_ID: Footnotes
1699   :END:
1700 ** How can I get automatic renumbering of footnotes in org-mode?
1701    :PROPERTIES:
1702    :CUSTOM_ID:       footnote-auto-adjust
1703    :END:
1705 You can add the following line to your .emacs file:
1707 : (setq org-footnote-auto-adjust t)
1709 Or, if you prefer, you can turn this option on locally by placing the
1710 following line at the top of your org file:
1712 : #+STARTUP: fnadjust
1714 When auto-adjust is turned on, footnotes in the file with numerical
1715 labels will be renumbered whenever a new footnote is added. Meanwhile,
1716 all footnotes, including those with custom labels such
1717 =[fn:custom-label ]=, will be sorted in the order of their appearance
1718 in the text.
1720 This emulates the footnote behavior that many users may be familiar
1721 with from word-processing programs or from the footnote-mode included
1722 with emacs.
1724 If you do not turn on org-footnote-auto-adjust, you sort and/or
1725 renumber footnotes at any time by calling org-footnote-action with a
1726 prefix argument.
1728 ** Why isn't auto renumbering of footnotes turned on by default?
1729    :PROPERTIES:
1730    :CUSTOM_ID:       why-no-default-auto-adjust
1731    :END:
1733 Org mode has a very robust footnote mechanism allowing for a variety
1734 of types of footnotes. With some of the following footnote notations,
1735 auto-adjust may be either irrelevant or undesired:
1737  - Automatically numbered
1738  - Footnotes with custom labels
1739  - Inline footnotes
1741 In addition, org mode can be customized to place footnotes either at
1742 the end of a document or at the end of the outline heading in which
1743 they appear. Users who change this setting while editing a document
1744 may be disconcerted to find all of their footnotes rearranged
1745 automatically.
1747 ** I have auto-fill-mode set and org-mode is inserting unwanted comment markers!
1748    :PROPERTIES:
1749    :CUSTOM_ID: auto-fill-and-unwanted-comments
1750    :END:
1752 If the following occurs:
1754 #+begin_src org
1756 #+OPTIONS: toc:nil
1757 Some entered text.
1758 # More entered tex.
1760 #+end_src
1762 Make sure that the variable comment-start is nil.
1764 ** Are there any shortcuts for entering source blocks and comment lines?
1765    :PROPERTIES:
1766    :CUSTOM_ID: shortcuts-for-entering-source-blocks
1767    :END:
1769 Org mode has some [[http://orgmode.org/manual/Literal-examples.html#Literal-examples][very convenient markup]] for including literal blocks
1770 and lines of code in a file. (This is especially useful when exporting
1771 documents or using the contributed package [[file:org-contrib/babel/index.org][org-babel]] for executing
1772 blocks of code.)
1774 #+begin_src org
1775   ,#+begin_src perl
1776   ,  print "Hello, world!\n";
1777   ,#+end_src
1778 #+end_src
1780 It can be tiresome to enter the block comment lines manually. There
1781 are several possible shortcuts you can use to enter them:
1783 1) Built-in expansion
1785    - Org mode has a "secret" method of expanding source code blocks
1786      and comment lines.
1788    - If you type "<s" followed by =TAB= or =M-TAB=, a source block will
1789      magically appear.
1791    - For a full list of expansions, type =M-x describe-variable
1792      [RET] org-structure-template-alist=.
1794 2) [[http://orgmode.org/manual/Literal-examples.html#Literal-examples][Registers]]
1796    - Add the following line to your emacs file:
1798      =(set-register ?p "#+begin_src\n\n#+end_src perl")=
1800    - Then type =C-x r i p= to insert the source block. Please note: if
1801      you save another value to the register "p" with =C-x r s p=, it
1802      will overwrite the setting above for the current emacs session.
1804 3) [[http://orgmode.org/manual/Literal-examples.html#Literal-examples][Abbrevs]]
1806  - Activate the abbrev minor-mode in org-mode:
1808    + M-x abbrev-mode
1810    + /Permanently/:
1812        + =(add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))=
1814  - In org-mode, type "sbp" (a sample abbreviation for a perl source
1815    block).
1817  - Immediately after "sbp" type =C-x a i l=.
1819  - Enter the expansion:
1821    - =#+begin_src perl[C-q C-j][C-q C-j]#+end_src=
1823    - Note: =C-q C-j= creates a new line in the minibuffer
1825  - Now, whenever, you type sbp followed by =SPACE= or =RET= in an
1826    org-mode buffer, the src block will magically appear.
1828  - To review your list of abbrevs, type =M-x edit-abbrevs=.
1830  - If you want more complex completion (like yasnippet) you can combine
1831    abbrev mode with [[http://www.emacswiki.org/emacs/SkeletonMode][skeletons]].
1833 4) [[http://code.google.com/p/yasnippet/][Yasnippet]]
1835  - Several org-mode users install yasnippet for convenient, complex
1836    expansion.
1838  - See Bernt Hansen's [[http://doc.norang.ca/org-mode.html#Yasnippets][org-mode setup]] for a good introduction to
1839    yasnippet.
1841 * Capture and remember
1842   :PROPERTIES:
1843   :CUSTOM_ID: Remember
1844   :END:
1846 ** Can I use a variable or a function inside the `org-capture-templates' variable?
1848 Yes.  Use [[http://www.gnu.org/s/emacs/manual/html_node/elisp/Backquote.html][backquotes]].
1850 E.g. if you have a variable called =org-test-file= and you want the
1851 variable =org-capture-templates= to "understand" (i.e. evaluate)
1852 =org-test-file= when Emacs evaluates the =(setq org-capture-templates
1853 [...])= expression, use backquotes like this:
1855 #+begin_src emacs-lisp
1856 (setq org-capture-templates
1857       `(("t" "Todo" entry (file+headline ,org-test-file "Tasks")
1858        "* TODO %?\n  %i\n  %a")
1859       ("b" "Buy" item (file+olp ,org-test-file "Stuff to Buy" "House")
1860        "")))
1861 #+end_src
1863 ** Can I use the remember buffer to clock a customer phone call?
1864    :PROPERTIES:
1865    :CUSTOM_ID: use-remember-buffer-to-clock-phone-call
1866    :END:
1868   Yes, you can.  Take a look at the [[http://thread.gmane.org/gmane.emacs.orgmode/5482][setup described by Bernt Hansen]]
1869   and check out (in the same thread) what Nick Docos had to fix to
1870   make Bernt's set-up work for him.
1871 ** Can I automatically start the clock when opening a remember template?
1872    :PROPERTIES:
1873    :CUSTOM_ID: start-clock-when-opening-remember-template
1874    :END:
1876    Yes, this is possible.  Use the following code and make sure that
1877    after executing it, `my-start-clock-if-needed' is in
1878    `remember-mode-hook' /after/ `org-remember-apply-template'.
1880    : (add-hook 'remember-mode-hook 'my-start-clock-if-needed 'append)
1881    : (defun my-start-clock-if-needed ()
1882    :   (save-excursion
1883    :     (goto-char (point-min))
1884    :     (when (re-search-forward " *CLOCK-IN *" nil t)
1885    :       (replace-match "")
1886    :       (org-clock-in))))
1888    Then, when a template contains the key string CLOCK-IN, the clock
1889    will be started.  Starting with Org-mode version 5.20, the clock will
1890    automatically be stopped when storing the remember buffer.
1892 * Searches
1893   :PROPERTIES:
1894   :CUSTOM_ID: Searches
1895   :END:
1896 ** Isearch does not find string hidden in links.  What can I do?
1897    :PROPERTIES:
1898    :CUSTOM_ID: isearch-in-links
1899    :END:
1901   M-x =visible-mode= will display the full link, making them searchable.
1903 ** How can I reduce the amount of context shown in sparse trees?
1904    :PROPERTIES:
1905    :CUSTOM_ID: context-in-sparse-trees
1906    :END:
1908    Take a look at the following variables:
1910    - =org-show-hierarchy-above=
1911    - =org-show-following-headline=
1912    - =org-show-siblings=
1913    - =org-show-entry-blow=
1915    which give command-dependent control over how much context is shown
1916    by a particular operation.
1918 ** How can I combine the results of two calls to =org-occur=?
1919    :PROPERTIES:
1920    :CUSTOM_ID: two-calls-to-org-occur
1921    :END:
1923    You can construct a regular expression that matches all targets you
1924    want.  Alternatively, use a =C-u= prefix with the second and any
1925    further calls to =org-occur= to keep the current visibility and
1926    highlighting in addition to the new ones.
1928 * Agenda
1929   :PROPERTIES:
1930   :CUSTOM_ID: Agenda
1931   :END:
1932 ** How can I change the advanced warning time for deadlines?
1933 ##<<warning-period-for-deadlines>>
1935 Deadline warnings appear in the daily agenda view a specified number
1936 of days before the deadline is due. The default setting is 14 days.
1937 You can change this with the variable =org-deadline-warning-days=.
1938 (See [[http://orgmode.org/manual/Deadlines-and-scheduling.html#Deadlines-and-scheduling][this section]] of the manual.)
1940 For instance,
1942 : (setq org-deadline-warning-days 30)
1944 would cause warnings for each deadline to appear 30 days in advance.
1946 Naturally, you might not want warnings for all of your deadlines to
1947 appear so far in advance. Thus, you can change the lead time for
1948 individual items as follows:
1950 : * TODO Get a gift for the party
1951 :   DEADLINE: <2009-01-16 Fri -2d>
1953 The "-2d" above changes the lead time for this deadline warning to two
1954 days in advance. You can also use "w" for weeks and "m" for months.
1955 ** How can I postpone a task until a certain date?
1956    :PROPERTIES:
1957    :CUSTOM_ID: deferring-tasks
1958    :END:
1960 The easiest way to postpone a task is to schedule it in the future.
1961 For instance, typing =C-c C-s +2w= on a headline will push a task two
1962 weeks into the future, so that it won't show up on the daily agenda
1963 until two weeks from now.
1965 If you'd like to prevent the task from showing up on your global todo
1966 list, you have a couple of options.
1968 1. You can set the variable =org-agenda-todo-ignore-scheduled= to =t=.
1969    This will exclude any scheduled items from your global list of
1970    active todos (=C-c a t=). (The variable
1971    =org-agenda-todo-ignore-with-date= will exclude both scheduled and
1972    deadline items from your todo list).
1973 2. You can remove the todo keyword from the item (C-c C-t <SPC>). The
1974    item will still appear on your agenda two weeks from today, but it
1975    won't show up on your todo lists.
1976 ** Can I send myself an email containing tasks or other agenda info?
1977    :PROPERTIES:
1978    :CUSTOM_ID: email-containing-tasks-or-other-agenda-info
1979    :END:
1981    Yes.  See [[http://article.gmane.org/gmane.emacs.orgmode/6112][this thread]] on the list.
1983 ** How can I limit the agenda view to my "work" tasks?
1984    :PROPERTIES:
1985    :CUSTOM_ID: limit-agenda-with-tag-filtering
1986    :END:
1988    It is often convenient to group org files into separate categories,
1989    such as "home" and "work" (or "personal" and "professional"). One
1990    of the main reasons for such classification is to create agenda
1991    views that are limited by type of work or area of responsibility.
1992    For instance, while at work, one may want to see only professional
1993    tasks; while away from work, one may want to see only personal
1994    tasks.
1996    One way to categorize files and tasks is to use a "#+FILETAGS"
1997    declaration at the top of each file, such as:
1999    : #+FILETAGS: work
2001    As long as org-use-tag-inheritance is turned on, the filetags will
2002    be inherited by all tasks in the file. A file can have multiple
2003    filetags. And, of course, tags can be added to individual headings.
2005    Tasks can be quickly filtered by tag from within the agenda by
2006    typing "/" and the name of the tag. The full key sequence to filter
2007    for work items in an agenda view would be:
2009    : C-c a a / work [or a tag shortcut]
2011 ** How can I limit the agenda view to a particular category?
2012    :PROPERTIES:
2013    :CUSTOM_ID: limit-agenda-with-category-match
2014    :END:
2016    Another way to filter agenda views by type of work is to use a
2017    "#+CATEGORY" declaration at the top of each file, such as:
2019    : #+CATEGORY: work
2021    Categories can also be added to individual headings within a file:
2023    : * Big project
2024    :   :PROPERTIES:
2025    :   :CATEGORY: work
2026    :   :END:
2028    All todos belonging to the category "work" can be found a with a
2029    simple tags-todo search:
2031    : C-c a M
2033    At the prompt, type:
2035    : CATEGORY="work"
2037    The same results can be achieved with custom agenda commands, such as:
2039 #+BEGIN_SRC emacs-lisp
2040 (setq org-agenda-custom-commands
2041       '(("h" tags-todo "CATEGORY=\"home\"")
2042         ("w" tags-todo "CATEGORY=\"work\"")
2043         ;; other custom agenda commands here
2044         ))
2045 #+END_SRC
2047 ** How can include all org files in a directory in my agenda?
2048    :PROPERTIES:
2049    :CUSTOM_ID: set-agenda-files-using-wildcards
2050    :END:
2052 You can simply include the directory (as one of the items) in the
2053 value of the variable org-agenda-files:
2055 : (setq org-agenda-files '("/my/special/path/org/"))
2057 There is another way of accomplishing the same end:
2059 : (setq org-agenda-files (file-expand-wildcards "/my/special/path/org/*.org"))
2061 ** Why aren't items disappearing from my agenda once they are marked done?
2062    :PROPERTIES:
2063    :CUSTOM_ID: removing-done-items-from-agenda
2064    :END:
2066 If items remain on your daily/weekly agenda after they are marked
2067 done, check the configuration of the following variables:
2069 : org-agenda-skip-scheduled-if-done
2070 : org-agenda-skip-deadline-if-done
2071 : org-agenda-skip-timestamp-if-done
2073 For instance, type:
2075 : M-x customize-variable RET org-agenda-skip-scheduled-if-done
2077 If this variable is turned off (=nil=), then scheduled items will
2078 remain on the agenda even after they are marked done.
2080 If the variable is turned on (=t=), then scheduled items will
2081 disappear from the agenda after they are marked done.
2083 If these settings seem not to behave the way you expect, then make
2084 sure you understand [[scheduled-vs-deadline-vs-timestamp][the
2085 difference between SCHEDULED, DEADLINE, and timestamps]].
2087 ** What is the difference between SCHEDULED, DEADLINE, and plain timestamps?
2088    :PROPERTIES:
2089    :CUSTOM_ID: scheduled-vs-deadline-vs-timestamp
2090    :END:
2092 1. SCHEDULED items (set with =C-c C-s=) will appear on your agenda on
2093    the day they are scheduled and on every day thereafter until they
2094    are done. Schedule a task if you want to be reminded to do
2095    something beginning on a certain day and until it is done.
2097 : ** TODO Scheduled item
2098 :    SCHEDULED: <2009-03-01 Sun>
2100 2. Items with a DEADLINE timestamp (set with =C-c C-d=) appear on your
2101    agenda in advance of the when they are due and remain on your
2102    agenda until they are done. Add a DEADLINE to an item if you want
2103    to make sure to complete it by a certain date. (The variable
2104    org-deadline-warning-days determines how far in advance items with
2105    deadlines will show up in the agenda. See [[warning-period-for-deadlines][this FAQ]] for more
2106    information.)
2108 : ** TODO Item with a deadline
2109 :    DEADLINE: <2009-01-20 Tue>
2111 3. An active timestamp (set with =C-c .=) will appear on your agenda
2112    only on the day it is scheduled. Use a timestamp for appointments
2113    or any reminders you want to show up only on a particular day.
2115 : ** TODO Item with an active timestamp
2116 : <2009-04-18 Sat>
2118 Note: items with inactive timestamps (set with C-c ! and marked by
2119 square brackets) will not show up in the agenda at all.
2121 ** Can I add files recursively to my list of agenda files?
2122    :PROPERTIES:
2123    :CUSTOM_ID: set-agenda-files-recursively
2124    :END:
2126 Yes, you can use the library "find-lisp."
2128 : (load-library "find-lisp")
2129 : (setq org-agenda-files (find-lisp-find-files "~/org" "\.org$"))
2131 This will add all files ending in =org= in the directory "~/org"
2132 and all of its subdirectories to your list of agenda files.
2134 See [[http://thread.gmane.org/gmane.emacs.orgmode/8992][this thread]] on the mailing list for more information.
2136 ** Why does an item appearing at the wrong time of day in my agenda?
2137    :PROPERTIES:
2138    :CUSTOM_ID: agenda-wrong-time-of-day
2139    :END:
2141 When preparing the agenda view, org-mode scans each relevant headline
2142 for a time designation. This approach is very nice for adding
2143 free-form timestamps to an item for scheduling. Thus, either of the
2144 following work would work to schedule an item at 10:00am:
2146 #+begin_src org
2147 ,** 10:00am Get dried ice at the magic store
2148 ,   SCHEDULED: <2009-05-27 Wed>
2149 #+end_src
2151 #+begin_src org
2152 ,** Get dried ice at the magic store
2153 ,   SCHEDULED: <2009-05-27 Wed 10:00>
2154 #+end_src
2156 To enable this flexibility, org-mode scans the entire headline for
2157 time of day notation. A potential problem can arise if you use
2158 inactive timestamps in the headline to note when an item was created.
2159 For example,
2161 #+begin_src org
2162 ,** Get dried ice at the magic store [2009-05-26 Tue 12:58]
2163 ,   SCHEDULED: <2009-05-27 Wed>
2164 #+end_src
2166 Org mode would interpret the time in the inactive timestamp as a
2167 time-of-day indicator and the entry would appear in your agenda at
2168 12:58.
2170 If you would like to turn off the time-of-day search, you can
2171 configure the variable =org-agenda-search-headline-for-time= (requires
2172 org-mode >= 6.24).
2174 ** How can I change the visibility of an item from the agenda?
2175    :PROPERTIES:
2176    :CUSTOM_ID: cycling-visibility-from-agenda
2177    :END:
2179 You can add a keybinding as follows:
2181 #+begin_src emacs-lisp
2182 (add-hook 'org-agenda-mode-hook
2183    (lambda ()
2184      (define-key org-agenda-mode-map " " 'org-agenda-cycle-show)))
2185 #+end_src
2187 Then, as you press SPACE on an item on the agenda, it will cycle the
2188 visibility of its original location.
2190 * Appointments/Diary
2191   :PROPERTIES:
2192   :CUSTOM_ID: Appointments/Diary
2193   :END:
2194 ** Is it possible to include entries from org-mode files into my emacs diary?
2195    :PROPERTIES:
2196    :CUSTOM_ID: include-entries-from-org-mode-files-into-emacs-diary
2197    :END:
2199    Since the org-mode agenda is much more powerful and can contain the
2200    diary, you should think twice before deciding to do this.  If you
2201    insist, however, integrating Org-mode information into the diary is
2202    possible.  You need to turn on /fancy diary display/ by setting in
2203    .emacs:
2205    : (add-hook 'diary-display-hook 'diary-fancy-display)
2207    Then include the following line into your ~/diary file, in
2208    order to get the entries from all files listed in the variable
2209    =org-agenda-files=
2211    : &%%(org-diary)
2213    You may also select specific files with
2215    : &%%(org-diary) ~/path/to/some/org-file.org
2216    : &%%(org-diary) ~/path/to/another/org-file.org
2218    If you now launch the calendar and press @<tt>d@</tt> to display a
2219    diary, the headlines of entries containing a timestamp, date range,
2220    schedule, or deadline referring to the selected date will be listed.
2221    Just like Org-mode's agenda view, the diary for /today/ contains
2222    additional entries for overdue deadlines and scheduled items.  See
2223    also the documentation of the =org-diary= function.  Under XEmacs, it
2224    is not possible to jump back from the diary to the org, this works
2225    only in the agenda buffer.
2226 ** I want to add my Org scheduled/deadlined entries in my diary!
2227    :PROPERTIES:
2228    :CUSTOM_ID: add-Org-scheduled/deadlined-entries-to-diary!
2229    :END:
2231   Put this in your ~/.diary:
2233   : &%%(org-diary :scheduled :timestamp :deadline)
2235 ** How can I set up automatic reminders based on Org information?
2236    :PROPERTIES:
2237    :CUSTOM_ID: automatic-reminders
2238    :END:
2240   See [[http://article.gmane.org/gmane.emacs.orgmode/5271][this post]] by N. Dokos on the list.
2241 ** How can I make =appt= notice my Org appointments?
2242    :PROPERTIES:
2243    :CUSTOM_ID: appt-notice-my-Org-appointments
2244    :END:
2246   : M-x org-agenda-to-appt RET
2248 ** How can I create more complex appointments in my org-files?
2249    :PROPERTIES:
2250    :CUSTOM_ID: diary-sexp-in-org-files
2251    :END:
2253 Org-mode's active timestamps work very well for scheduling individual
2254 or recurring appointments, such as:
2256 #+begin_src org
2257   ,* 8:00am Dentist appointment <2009-01-16 Fri>
2258 #+end_src
2261 #+begin_src org
2262   ,* Vacation
2263   ,  <2009-03-20 Fri>--<2009-04-01 Wed>
2264 #+end_src
2268 #+begin_src org
2269   ,* Weekly meeting with boss
2270   ,  <2009-01-20 Tue 14:00 +1w>
2271 #+end_src
2273 Sometimes, however, you need to set up more complicated recurring
2274 appointments. Org-mode has built-in support for many of
2275 [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Sexp-Diary-Entries.html][the
2276 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
2277 instance, that you teach a class that meets every Monday evening
2278 between February 16 and April 20, 2009. The way to enter this an
2279 org-mode file is:
2281 #+begin_src org
2282   ,** Class 7:00pm-9:00pm
2283   ,   <%%(and (= 1 (calendar-day-of-week date)) (diary-block 2 16 2009 4 20 2009))>
2284 #+end_src
2286 The expression above designates all Mondays that fall between February
2287 16 and April 20. How exactly does it work?
2289  - (and... :: Indicates that *both* of the conditions that follow have
2290           to be true.
2292    - (= 1 (calendar-day-of-week date)) :: Is the day of the week a
2293         Monday?
2295        - Note: the function calendar-day-of-week converts the date to the day of week
2296          expressed in numeric form, where 0 = Sunday, 1 = Monday, and so on.
2298    - (diary-block 2 16 2009 4 20 2009) :: Does the date fall between
2299         these two dates?
2301 You can make a sexp as complex as you like. If you wanted to omit a
2302 week because of holidays, for instance, you could add another
2303 condition to the sexp:
2305 #+begin_src org
2306   ,** Class 7:00pm-9:00pm
2307   ,   <%%(unless (diary-block 3 9 2009 3 13 2009) (and (= 1 (calendar-day-of-week date)) (diary-block 2 16 2009 4 20 2009)))>
2308 #+end_src
2310 The sexp above would omit Monday during the week of March 9, 2009. For
2311 another way to accomplish the same thing, see [[org-diary-class][this FAQ]].
2313 Another diary function commonly used for more complex scheduling is
2314 diary-float. For instance,
2316 #+begin_src org
2317   ,* Monthly meeting
2318   ,  <%%(diary-float t 3 3)>
2319 #+end_src
2321 ...would appear on the third Wednesday of every month.
2323 For more ideas on how to create diary special expressions, see [[http://www.emacswiki.org/cgi-bin/wiki/DiaryMode][this
2324 page on the Emacs wiki]].
2326 ** How can I schedule a weekly class that lasts for a limited period of time?
2327    :PROPERTIES:
2328    :CUSTOM_ID: org-diary-class
2329    :END:
2331 1. Method 1
2332 Org-mode offers a convenient diary sexp function for setting up a
2333 recurring appointment that lasts for a certain period of time, such as
2334 a class. It is called org-diary-class and it can be entered as
2335 follows:
2337 #+begin_src org
2338   ,** Class 7:00pm-9:00pm
2339   ,   <%%(org-diary-class 2 16 2009 4 20 2009 1 10)>
2340 #+end_src
2342 The function above schedules an appointment for every Monday (1)
2343 between February 16 and April 20, 2009, except for ISO week 10 (March
2344 1 to March 7).
2346 The function org-diary-class has the following format:
2348 : (org-diary-class M1 D1 Y1 M2 D2 Y2 DAYNAME &rest SKIP-WEEKS)
2350 M1/2, D1/2, and Y1/2 indicate the beginning and ending dates. Dayname
2351 takes the form of a number indicating the day of the week (0 = Sunday,
2352 1 = Monday, and so on...). In addition, one can add an optional
2353 argument SKIP-WEEKS to indicate weeks on the calendar that should be
2354 skipped. This argument should be expressed as an ISO week number. You
2355 can find the number by invoking emacs' built-in calendar (=M-x
2356 calendar=), navigating to the appropriate week, and typing =p c=
2357 (calendar-iso-print-date).
2359 2. Method 2
2361 For example, say you are taking night classes in Spanish. The class is every
2362 Wednesday evening at 7pm, starting on 18 August, and runs for 8 weeks. AFAIK
2363 Org's timestamps do not support limited occurrences of recurrent items -- you
2364 have to schedule the item with infinite recurrences, then delete it when it
2365 finishes.
2367 To schedule the Spanish classes, put the following in your =.emacs=:
2369 #+begin_src emacs-lisp
2370   (defun diary-limited-cyclic (recurrences interval m d y)
2371     "For use in emacs diary. Cyclic item with limited number of recurrences.
2372   Occurs every INTERVAL days, starting on YYYY-MM-DD, for a total of
2373   RECURRENCES occasions."
2374     (let ((startdate (calendar-absolute-from-gregorian (list m d y)))
2375           (today (calendar-absolute-from-gregorian date)))
2376       (and (not (minusp (- today startdate)))
2377            (zerop (% (- today startdate) interval))
2378            (< (floor (- today startdate) interval) recurrences))))
2379 #+end_src
2380 The item in the org file looks like this:
2382 #+begin_src org
2383   ,** 19:00-21:00 Spanish lessons
2384   ,   <%%(diary-limited-cyclic 8 7 8 18 2010)>
2385 #+end_src
2386 [Source: Paul Sexton's post on Org-mode mailing list.]
2388 ** How can I set an event to occur every day except Saturday and Sunday?
2390 #+begin_src org
2391   ,** Daily meeting
2392   ,   <%%(memq (calendar-day-of-week date) '(1 2 3 4 5))>
2393 #+end_src
2395 ** How do I schedule events relative to Easter Sunday?
2397    Easter's date moves around from year to year according to a
2398    complicated set of criteria which I do not claim to understand.
2399    However the following code will allow you to schedule recurring
2400    events relative to Easter Sunday.
2402    Note: the function da-easter is from:
2403    http://github.com/soren/elisp/blob/master/da-kalender.el
2405    Put the following in your .emacs:
2407 #+begin_src emacs-lisp
2408   (defun da-easter (year)
2409     "Calculate the date for Easter Sunday in YEAR. Returns the date in the
2410   Gregorian calendar, ie (MM DD YY) format."
2411     (let* ((century (1+ (/ year 100)))
2412            (shifted-epact (% (+ 14 (* 11 (% year 19))
2413                                 (- (/ (* 3 century) 4))
2414                                 (/ (+ 5 (* 8 century)) 25)
2415                                 (* 30 century))
2416                              30))
2417            (adjusted-epact (if (or (= shifted-epact 0)
2418                                    (and (= shifted-epact 1)
2419                                         (< 10 (% year 19))))
2420                                (1+ shifted-epact)
2421                              shifted-epact))
2422            (paschal-moon (- (calendar-absolute-from-gregorian
2423                              (list 4 19 year))
2424                             adjusted-epact)))
2425       (calendar-dayname-on-or-before 0 (+ paschal-moon 7))))
2428   (defun da-easter-gregorian (year)
2429     (calendar-gregorian-from-absolute (da-easter year)))
2431   (defun calendar-days-from-easter ()
2432     "When used in a diary sexp, this function will calculate how many days
2433   are between the current date (DATE) and Easter Sunday."
2434     (- (calendar-absolute-from-gregorian date)
2435        (da-easter (calendar-extract-year date))))
2436 #+end_src
2438     Now we can schedule the public holidays associated with Easter as
2439     recurring events. Good Friday is 2 days before "Easter", Easter
2440     Monday is one day after.
2442 #+begin_src org
2443   ,* Good Friday
2444   ,  <%%(= -2 (calendar-days-from-easter))>
2446   ,* Easter Sunday
2447   ,  <%%(= 0 (calendar-days-from-easter))>
2449   ,* Easter Monday
2450   ,  <%%(= 1 (calendar-days-from-easter))>
2451 #+end_src
2452    [Source: Posted by Paul Sexton on Org-mode mailing list.]
2454 ** How to schedule public holiday that is "the nearest Monday to DATE"?
2456    In New Zealand each regional capital has an "Anniversary Day". The
2457    date of Auckland's anniversary day is "the nearest Monday to 29
2458    January".
2460    Put this in your =.emacs=:
2462 #+begin_src emacs-lisp
2463   (defun calendar-nearest-to (target-dayname target-day target-month)
2464     "Recurring event that occurs in the nearest TARGET-DAYNAME to
2465   the date TARGET-DAY, TARGET-MONTH each year."
2466     (interactive)
2467     (let* ((dayname (calendar-day-of-week date))
2468            (target-date (list target-month target-day (calendar-extract-year date)))
2469            (days-diff (abs (- (calendar-day-number date)
2470                               (calendar-day-number target-date)))))
2471       (and (= dayname target-dayname)
2472            (< days-diff 4))))
2473 #+end_src
2475    Now we can schedule Auckland Anniversary Day. The first argument,
2476    1, means Monday (days of the week are numbered starting with
2477    Sunday=0).
2479    [Source: Originally posted by Paul Sexton on Org-mode mailing list.]
2481 ** How to schedule public holiday on "the 4th Monday in October"?
2483    This does not require any additions to =.emacs=:
2485 #+begin_src org
2486   ,* Labour Day (NZ)
2487   ,  <%%(diary-float 10 1 4)>
2488 #+end_src
2490 * Export
2491   :PROPERTIES:
2492   :CUSTOM_ID: Export
2493   :END:
2494 ** Can I get TODO items exported to HTML as lists, rather than as headlines?
2495    :PROPERTIES:
2496    :CUSTOM_ID: export-TODO-items-as-lists
2497    :END:
2499    If you plan to use ASCII or HTML export, make sure things you want to
2500    be exported as item lists are level 4 at least, even if that does
2501    mean there is a level jump.  For example:
2503    : * Todays top priorities
2504    : **** TODO write a letter to xyz
2505    : **** TODO Finish the paper
2506    : **** Pick up kids at the school
2508    Alternatively, if you need a specific value for the heading/item
2509    transition in a particular file, use the =#+OPTIONS= line to
2510    configure the H switch.
2512    : #+OPTIONS:   H:2; ...
2514 ** Can I export only a single subtree?
2515    :PROPERTIES:
2516    :CUSTOM_ID: export-single-subtree
2517    :END:
2519    If you want to export a subtree, mark the subtree as region and then
2520    export.  Marking can be done with =C-c @ C-x C-x=, for example.
2522 ** How can I tell my calendar web application about appointments in my agenda files?
2524 Here is what you need to do:
2526 1. a script that calls Emacs in batch mode and produce a .ics file
2527 2. a script that uploads this .ics file somewhere on the web
2528 3. tell your webapp to fetch this .ics file on the web
2530 Here is the script I use for the first step:
2532 #+begin_src shell-script-mode
2533 #!/bin/bash
2535 /usr/local/bin/emacs --batch --eval \
2536 "(progn (load-file \"~/install/git/org-mode/org.el\") \
2537         (load-file \"~/elisp/config/org-batch-config.el\") \
2538         (setq org-combined-agenda-icalendar-file \"~/org/cal/org.ics\")
2539         (setq org-agenda-files (quote (\"~/org/bzg.org\"))))" \
2540     -f org-export-icalendar-combine-agenda-files
2541 #+end_src
2543 Depending on your configuration, you might change the load sequence.
2545 Here is the script I use for the second step:
2547 #+begin_src shell-script-mode
2548 #!/bin/bash
2549 /usr/bin/rsync -rtv ~/org/org.ics -e ssh me@my_server:/home/me/public_html/
2550 #+end_src
2552 Note: if you want to cron this rsync script, you will need to let
2553 =my_server= to know about your SSH public key.  Check [[http://troy.jdmz.net/rsync/index.html][this page]] as a
2554 starter.
2556 Now you can cron the two scripts above and your webapp will always be
2557 up to date with your Org agendas.
2559 Also see [[http://orgmode.org/org.html#Exporting-Agenda-Views][Exporting agenda views]] from Org manual.
2561 ** How can I get Mac OSX 10.3 iCal to import my Org-exported .ics files?
2562    :PROPERTIES:
2563    :CUSTOM_ID: iCal-import-ics-files-old
2564    :END:
2566    When using iCal under Apple MacOS X Tiger, you can create a new
2567    calendar /OrgMode/ (the default name for the calendar created by =C-c
2568    C-e c=, see the variables =org-icalendar-combined-name= and
2569    =org-combined-agenda-icalendar-file=).  Then set Org-mode to
2570    overwrite the corresponding file /~/Library/Calendars/OrgMode.ics/.
2571    You may even use AppleScript to make iCal re-read the calendar files
2572    each time a new version of /OrgMode.ics/ is produced.  Here is the
2573    setup needed for this:
2575    : (setq org-combined-agenda-icalendar-file
2576    :     "~/Library/Calendars/OrgMode.ics")
2577    : (add-hook 'org-after-save-iCalendar-file-hook
2578    :  (lambda ()
2579    :   (shell-command
2580    :    "osascript -e 'tell application \"iCal\" to reload calendars'")))
2582 ** How can I get Mac OSX 10.4 or later iCal to import my Org-exported .ics files?
2583    :PROPERTIES:
2584    :CUSTOM_ID: iCal-import-ics-files-new
2585    :END:
2587    For Mac OS X 10.4, you need to write the ics file to
2588    =/Library/WebServer/Documents/= and then subscribe iCalendar to
2589    =http: //localhost/orgmode.ics=
2591 ** How can I remove timestamps and todo keywords from my exported file?
2592    :PROPERTIES:
2593    :CUSTOM_ID: export-options-remove-timestamps
2594    :END:
2596 You can place an options line at the top of your org file:
2598 : #+OPTIONS: <:nil todo:nil
2600 There is a whole host of export options you can set with an in-buffer
2601 options or via global variables. See [[http://orgmode.org/manual/Export-options.html#Export-options][this section]] of the manual for a
2602 full list.
2604 ** How can I preserve faces when I export an agenda from the command line?
2605    :PROPERTIES:
2606    :CUSTOM_ID: preserving-faces-during-batch-export
2607    :END:
2609 Normally, when you export an org file or an agenda view from within
2610 emacs, htmlize will convert your face definitions to direct color css
2611 styles inlined into each =<span>= object, resulting in an HTML output
2612 that preserves the general look of your Org buffers and agenda views.
2614 Let's say you generate an export from the command line, such as the
2615 following:
2617 : emacs -batch -l ~/.emacs -eval '(org-batch-agenda "e")'
2621 : emacs -batch -l ~/.emacs -eval '(org-publish-all)'
2623 In such an instance, the exported HTML will contain only very basic
2624 color styles. The reason is that when Emacs is run in batch mode, it
2625 does not have a display and therefore only rudimentary face
2626 definitions.  If you'd like to use more complex styles, you'll have to
2627 make sure that the export process only assigns classes instead of
2628 direct color values.  This can be done by binding the variable
2629 =org-export-htmlize-output-style= to =css= for the duration of the
2630 export, for example with
2632 : emacs -batch -l ~/.emacs
2633 :   -eval '(let ((org-export-htmlize-generate-css (quote css)))
2634 :            (org-batch-agenda "e"))'
2636 Then you can use a style file to make these classes look any way you
2637 like.  To generate face definitions for a CSS file based on any faces
2638 you are currently using in Emacs, you can use the following command:
2640 : M-x org-export-htmlize-generate-css RET
2642 This will generate a =<style>...</style>= section, the content of
2643 which you can add to your style file.
2645 ** How can I avoid dark color background when exporting agenda to ps format?
2646    :PROPERTIES:
2647    :CUSTOM_ID: avoiding-dark-background-when-exporting-agenda
2648    :END:
2650 Add this to your .emacs and evaluate it.
2652 #+BEGIN_SRC emacs-lisp
2653   (setq org-agenda-exporter-settings
2654         '((ps-print-color-p 'black-white)))
2655 #+END_SRC
2657 ** How can I get colored source code when exporting to LaTeX?
2658    :PROPERTIES:
2659    :CUSTOM_ID: fontified_source_code_w_latex
2660    :END:
2662 As of Sun Aug 9 2009 the "current" version of Org-mode (see
2663 [[keeping-current-with-Org-mode-development]]) supports exporting source
2664 code to LaTeX using the listings package.
2666 To turn on listing export add the following to your Org-mode
2667 customization.
2668 #+begin_src emacs-lisp
2669   ;; requite org-latex so that the following variables are defined
2670   (require 'org-latex)
2672   ;; tell org to use listings
2673   (setq org-export-latex-listings t)
2675   ;; you must include the listings package
2676   (add-to-list 'org-export-latex-packages-alist '("" "listings"))
2678   ;; if you want colored source code then you need to include the color package
2679   (add-to-list 'org-export-latex-packages-alist '("" "color"))
2680 #+end_src
2682 The listings package will now be used to fontify source code in your
2683 LaTeX documents.  By default listings will not color any of your
2684 source code.  If you would like to set colors for keywords and
2685 comments in your latex documents you can do so using LaTeX directives
2686 like the following.
2687 #+begin_src latex
2688   \lstset{keywordstyle=\color{blue},
2689     commentstyle=\color{red},
2690     stringstyle=\color{green}
2691   }
2692 #+end_src
2694 of if you want to get even fancier with your colors you can try
2695 something like the following
2696 #+begin_src latex
2697 \definecolor{keywords}{RGB}{255,0,90}
2698 \definecolor{comments}{RGB}{60,179,113}
2699 \definecolor{fore}{RGB}{249,242,215}
2700 \definecolor{back}{RGB}{51,51,51}
2701 \lstset{
2702   basicstyle=\color{fore},
2703   keywordstyle=\color{keywords},
2704   commentstyle=\color{comments},
2705   backgroundcolor=\color{back}
2707 #+end_src
2709 For more complex listings use cases consult the [[ftp://ftp.tex.ac.uk/tex-archive/macros/latex/contrib/listings/listings.pdf][listings manual]].
2711 ** How can I export to Latex Beamer
2712    :PROPERTIES:
2713    :CUSTOM_ID: beamer
2714    :END:
2715 The latex [[http://latex-beamer.sourceforge.net/][Beamer Class]] is a useful class for generating slide shows.
2716 The following can be used to export Org-mode documents to LaTeX
2717 beamer.
2719 Add the following to your Emacs initialization file.
2720 #+begin_src emacs-lisp
2721   (unless (boundp 'org-export-latex-classes)
2722     (setq org-export-latex-classes nil))
2723   (add-to-list 'org-export-latex-classes
2724                '("beamer"
2725                  "\\documentclass[11pt]{beamer}\n\\usepackage[utf8]{inputenc}\n\\usepackage[T1]{fontenc}\n\\usepackage{hyperref}\n\\usepackage{verbatim}\n"
2726                  ("\\section{%s}" . "\\section*{%s}")
2727                  ("\\begin{frame}\\frametitle{%s}" "\\end{frame}"
2728                   "\\begin{frame}\\frametitle{%s}" "\\end{frame}")))
2729 #+end_src
2731 Then by placing
2732 : #+LaTeX_CLASS: beamer
2733 in the header of your Org-mode document it will automatically export
2734 to the Beamer document class on LaTeX export.  With the above
2735 configuration top-level headers will be mapped to sections in the
2736 Beamer document, second-level headers will be mapped to frames, and
2737 lower level headlines will be mapped to itemize objects.
2739 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
2740 Thomas Dye]].  For a much more complex Beamer setup see the [[http://article.gmane.org/gmane.emacs.orgmode/17767/match=beamer+dokos][email by
2741 Thomas Dye]].
2743 ** How can I use RefTeX in Org-mode files for LaTeX export and in Org-babel LaTeX code blocks?
2745 [[http://www.gnu.org/software/auctex/reftex.html][RefTeX]] is an indispensable tool for the author of LaTeX documents.  It
2746 aids in creation of bibliographies, cross-references, indexes, and
2747 glossaries.  RefTeX understands the structure of multi-file LaTeX
2748 documents and is able to collect from them information about the
2749 location(s) of external data stores used in creation of the final
2750 document.  RefTeX was written by Carsten Dominik and is currently
2751 being maintained by the [[http://www.gnu.org/software/auctex/index.html][AucTeX]] project.
2753 *** Using RefTeX In Org-mode Files for LaTeX Export
2754 In Org-mode files for LaTeX export, the trick is to find a way to tell
2755 RefTeX the locations of external data stores.  One way is to set the
2756 variable, =reftex-default-bibliography=.  Add lines like these to
2757 .emacs:
2759 #+begin_src emacs-lisp
2760   (setq reftex-default-bibliography
2761         (quote
2762          ("default.bib" "other-default.bib")))
2763 #+end_src
2765 In practice, this is a limited solution and the
2766 typical user will want to pass this information on a per-file basis.
2767 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
2768 Braindump]].
2770 The first solution, proposed by Mario, enables the RefTeX citation
2771 function in Org-mode.  Add these lines to .emacs:
2773 #+begin_src emacs-lisp
2774   (defun org-mode-reftex-setup ()
2775     (load-library "reftex")
2776     (and (buffer-file-name)
2777          (file-exists-p (buffer-file-name))
2778          (reftex-parse-all))
2779     (define-key org-mode-map (kbd "C-c )") 'reftex-citation))
2780   (add-hook 'org-mode-hook 'org-mode-reftex-setup)
2781 #+end_src
2783 Then add the following lines anywhere in the Org-mode file (Org-mode
2784 will recognize them as LaTeX commands):
2786 #+begin_src org
2787 \bibliographystyle{plain}
2788 \bibliography{BIB-NAME}
2789 #+end_src
2791 With this setup, =C-c )= will invoke =reftex-citation= which will
2792 insert a reference in the usual way:
2794 #+begin_src org
2795   ,* test reftex
2797   ,This is a citation \cite{tierney90}.
2799   ,\bibliographystyle{plain}
2800   ,\bibliography{tsd}
2801 #+end_src
2803 This Org-mode file will export the following LaTeX output:
2805 #+begin_src latex :exports code
2806   % Created 2010-03-22 Mon 14:34
2807   \documentclass[11pt,letter]{article}
2808   \usepackage[utf8]{inputenc}
2809   \usepackage[T1]{fontenc}
2810   \usepackage{hyperref}
2812   \title{test.org}
2813   \author{Tom Dye}
2814   \date{2010-03-22 Mon}
2816   \begin{document}
2818   \maketitle
2820   \setcounter{tocdepth}{3}
2821   \tableofcontents
2822   \vspace*{1cm}
2824   \section{test reftex}
2825   \label{sec-1}
2828   This is a citation \cite{tierney90}.
2830   \bibliographystyle{plain}
2831   \bibliography{tsd}
2833   \end{document}
2834 #+end_src
2837 A second solution, to activate the RefTeX minor mode on a per-file
2838 basis, was posted by Kevin Brubeck Unhammer in response to this idea.
2839 Add the following lines to .emacs:
2841 #+begin_src emacs-lisp
2842   (add-hook ‘org-mode-hook
2843              (lambda ()
2844                (if (member “WRITE” org-todo-keywords-1)
2845                    (org-mode-article-modes))))
2846 #+end_src
2848 where =org-mode-article-modes= is defined as follows:
2850 #+begin_src emacs-lisp
2851   (defun org-mode-article-modes ()
2852     (reftex-mode t)
2853     (bib-cite-minor-mode t)
2854     (and (buffer-file-name)
2855          (file-exists-p (buffer-file-name))
2856          (reftex-parse-all)))
2857 #+end_src
2859 Add the =\bibliographystyle{}= and =\bibliography{}= lines to the
2860 Org-mode file as before and define a TODO keyword, =WRITE=, perhaps
2861 like this:
2863 #+begin_src org
2864   ,#+TODO: TODO(t) STARTED(s) WRITE | DONE(d) DEFERRED(f)
2865 #+end_src
2867 With this setup, you insert a citation with =M-x reftex-citation RET=.
2869 *** Using RefTeX in Org-babel LaTeX Code Blocks
2871 In Org-babel LaTeX code blocks, the trick is to give RefTeX access to
2872 information in other Org-babel LaTeX code blocks.  If you use an Emacs
2873 starter kit where configuration information is held in Org-mode files,
2874 then the second solution is preferable because you won't be asked for
2875 a master file when Emacs is started.  For this reason, the second
2876 solution is modified for use with Org-babel latex code blocks.  No
2877 key-binding is needed here because Org-babel code blocks are edited
2878 within the usual AucTeX environment.
2880 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]])
2881 #+begin_src emacs-lisp
2882   (defun org-mode-article-modes ()
2883     (reftex-mode t)
2884     (and (buffer-file-name)
2885          (file-exists-p (buffer-file-name))
2886          (reftex-parse-all)))
2888   (add-hook 'org-mode-hook
2889             (lambda ()
2890               (if (member "REFTEX" org-todo-keywords-1)
2891                   (org-mode-article-modes))))
2892 #+end_src
2894 Then add a line like the following line to the top of your org-mode file:
2896 #+begin_src org
2897   ,#+TODO: TODO(t) STARTED(s) | DONE(d) DEFERRED(f) REFTEX
2898 #+end_src
2900 When you open an org-mode file with a line like this, RefTeX will
2901 prompt for the master .tex file, which will be parsed in the usual
2902 way.  This means that the .tex file should already exist, perhaps by
2903 tangling the LaTeX preamble and postamble, before
2904 =org-mode-article-modes= is activated for the Org-mode file.
2906 ** Why is my exported PDF file almost unreadable?
2908 Some PDF viewers (earlier versions (< v6) of Acrobat Reader, Evince,
2909 possibly others) do not get along with Adobe Type3 fonts, producing
2910 almost unreadable screen output (printed output is OK). If you see
2911 this, first verify the fonts that your document uses: open it with
2912 Acrobat Reader or Evince, select "Properties" from the "File" menu and
2913 click on the "Fonts" tab; alternatively, you can use the pdffonts
2914 program (part of the xpdf-reader package) from the command line.  If
2915 that is indeed the problem, then either use a different viewer or
2916 install Type1 versions of the problematic fonts. For more details, see
2917 the "PDF export" section of [[./org-dependencies.org][org-dependencies]].
2920 * MobileOrg
2922 ** Which versions of MobileOrg do exist
2923    :PROPERTIES:
2924    :CUSTOM_ID: mobileorg_versions
2925    :END:
2927 - MobileOrg for the iPhone/iPod Touch/iPad series of devices, by
2928   Richard Moreland.  Check out
2929   [[http://mobileorg.ncogni.to/][Richard's page]]
2930 - Matt Jones is developing a feature-equivalent application for
2931   Android, see
2932   [[http://wiki.github.com/matburt/mobileorg-android/][his project page]].
2934 ** What can I do if I don't want to use Dropbox.com
2935    :PROPERTIES:
2936    :CUSTOM_ID: mobileorg_webdav
2937    :END:
2939 Dropbox.com is the easiest way to connect between Emacs and MobileOrg,
2940 you can get a free account there.  If for some reason you cannot or do
2941 not want to use this path, you can use any webdav server.  On this
2942 webdav server you need to create a dedicated directory for the
2943 communication between Emacs and MobileOrg.  If you can mount that
2944 directory locally so that Emacs can directly write to it, just point
2945 to that directory using the variable =org-mobile-directory=.  Using
2946 the /tramp/ method, =org-mobile-directory= may point to a remote
2947 directory accessible through, for example, /ssh/ and /scp/:
2949 #+begin_src emacs-lisp
2950 (setq org-mobile-directory "/scpc:user@@remote.host:org/webdav/")
2951 #+end_src
2953 If Emacs cannot access the WebDAV directory directly using a /tramp/
2954 method, you can use a local directory for staging.  Other means must
2955 then be used to keep this directory in sync with the WebDAV directory.
2956 In the following example, files are staged in =~/stage/=, and Org-mode
2957 hooks take care of moving files to and from the WebDAV directory using
2958 /scp/.
2960 #+begin_src emacs-lisp
2961 (setq org-mobile-directory "~/stage/")
2962 (add-hook 'org-mobile-post-push-hook
2963   (lambda () (shell-command "scp -r ~/stage/* user@@wdhost:mobile/")))
2964 (add-hook 'org-mobile-pre-pull-hook
2965   (lambda () (shell-command "scp user@@wdhost:mobile/mobileorg.org ~/stage/ ")))
2966 (add-hook 'org-mobile-post-pull-hook
2967   (lambda () (shell-command "scp ~/stage/mobileorg.org user@@wdhost:mobile/")))
2968 #+end_src
2970 * COMMENT HTML style specifications
2972 #+begin_src emacs-lisp
2973   (defun org-faq-make-target ()
2974     "Make hard target for current headline."
2975     (interactive)
2976     (if (not (org-on-heading-p))
2977         (error "Not on a headline"))
2978     (let ((h (org-trim (org-get-heading 'no-tags))))
2979       (if (string-match "[ \t]*\\?\\'" h)
2980           (setq h (replace-match "" t t h)))
2981       (while (string-match "[ \t]+" h)
2982         (setq h (replace-match "-" t t h)))
2983       (org-entry-put nil "CUSTOM_ID" h)))
2984 #+end_src