org-hacks.org: more outlining, new field coordinates in formulas
[Worg.git] / org-faq.org
blobf75f59636936d730d99343c8e5505f7ab871f95e
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:info 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 * Keeping current
126   :PROPERTIES:
127   :CUSTOM_ID: Keeping-current
128   :END:
129 ** How do I keep current with Org mode development?
130    :PROPERTIES:
131    :CUSTOM_ID: keeping-current-with-Org-mode-development
132    :END:
134    Org mode is developed in [[http://en.wikipedia.org/wiki/Git_(software)][Git]].  You can keep up-to-date with Org
135    mode developement by cloning Org mode repository and refreshing
136    your copy with latest changes whenever you wish.  You only need to
137    use two Git commands (clone and pull.)  Here are the steps in
138    brief (please customize locations to suit your setup):
140    1. Select a location to house the Org mode repository (approx. 40
141       MB; includes documentation, compiled elisp files and history
142       going all the way back to v4.12a)
144       : $ mkdir $HOME/elisp && cd $HOME/elisp
146    2. Clone the Org mode Git repository.
148       Recommended approach:
150       : $ git clone git://repo.or.cz/org-mode.git
152       Alternate approach if you are behind a firewall that allows only
153       HTTP (can be quite slow):
155       : $ git clone http://repo.or.cz/r/org-mode.git
157    3. Compile and install Org mode and build documentation.
159       : $ cd org-mode && make && make doc && make install
161       Please note that you can choose to /not/ compile at all and run
162       using source =.el= files only.  Compiled files speed things up.
164    4. This is where you configure Org mode with Emacs.  Please refer
165       to [[./org-tutorials/index.org][Org tutorials]].
167    5. Keeping up-to-date.
169       Cloning the repository is a one time activity.  From this point
170       onwards you only need to /pull/ the latest changes.
172       : $ cd $HOME/elisp/org-mode
174       and then
176       : $ git pull && make clean && make && make doc && make install
178    6. You should restart org mode to have the changes take effect (if
179       you are not rebooting Emacs.)  Also since the intention is to
180       "keep up" with Org mode, you should visit ChangeLog and updated
181       sections of documentation for latest updates (use =git log=.)
183    7. As you use your repository over time it will accumulate loose objects.
184       You can reduce the total size of your git repository with
186       : $ git gc
188       which will consolidate loose git objects into pack files.  This
189       reduces the size of the repository and speeds up data access to
190       the objects.
192 ** How can I keep local changes and still track Org mode development?
193    :PROPERTIES:
194    :CUSTOM_ID: keeping-local-changes-current-with-Org-mode-development
195    :END:
197   Say you want to make minor changes to the Makefile to reflect your
198   location for =emacs=.
200   Create a local branch for your changes on top of origin/master as
201   follows:
203   : $ git checkout -b local origin/master
204   : $ git config branch.local.rebase true
205   : # Make your changes to the Makefile and create a new commit
206   : $ git add Makefile
207   : $ git commit -m 'My local Makefile configurations'
208   : # Update git to a newer version
209   : $ git pull
211   Now each time you pull new commits from the distribution repository
212   your local commits will be rewound and replayed on top of the new
213   origin/master.
215 -----------
217   You would normally work on your =local= branch which includes your
218   custom commits; there's no need to switch back to the =master=
219   branch.
221 -----------
223 Here is an example of dealing with conflict resolution during git pull.
225 If you get a conflict during a =git pull= you will need to edit the
226 file with the conflict to fix up the conflicting lines and then tell
227 git that you have resolved the conflict.
229 Conflict resolution goes something like this:
231 1. =git pull= fails with a conflict
232 2. edit the file
233 3. =git add= the file to mark the conflict resolved
234 4. =git rebase --continue=
235 5. lather, rinse, and repeat 2-4 as needed
237 For this example we have the following Makefile:
239 : #
240 : # Example Makefile
241 : #
243 : EMACS=emacs
245 : VERSION=V1.0
247 and we need to change the =EMACS=emacs= line to =EMACS=myemacs= to
248 make it work well on our system.
250 To do this we
252   - create a local branch for our work
254     : $ git checkout -b local origin/master
255     : $ git config branch.local.rebase true
257     This marks the branch so that all local commits on it are rebased
258     on top of any new commits we get in origin/master during a =git
259     pull= operation.
261   - Make our custom changes
263     Edit the makefile so it looks like this:
265     : #
266     : # Example Makefile
267     : #
268     :
269     : EMACS=myemacs
270     :
271     : VERSION=V1.0
273   - Create a commit with our custom changes
274     : $ git add Makefile
275     : $ git commit -m 'My local Makefile configurations'
277   - Later we do a =git pull= but that fails with conflicts.
279     : $ git pull
280     : remote: Counting objects: 5, done.
281     : ...
282     : Patch failed at 0001.
283     :
284     : When you have resolved this problem run "git rebase --continue".
285     : If you would prefer to skip this patch, instead run "git rebase --skip".
286     : To restore the original branch and stop rebasing run "git rebase --abort".
288   - Fix the conflict in your favourite editor
290     Conflict markers look like this:
292     : <<<<<<< HEAD:Makefile
293     : EMACS=emacs22
294     : =======
295     : EMACS=myemacs
296     : >>>>>>> Change emacs location:Makefile
298     This attempted =git pull= caused a conflict.  Fire up your
299     favourite editor and fix the conflict in the Makefile.  The
300     conflict markers are <<<<<<<<<< , ======= , and >>>>>>>>>>.  Fix
301     the Makefile appropriately and delete the conflict markers.  You
302     already edited these lines earlier so fixing it should be trivial.
304     In this case we changed =EMACS=emacs= to =EMACS=myemacs= and
305     upstream changed =EMACS=emacs= to =EMACS=emacs22=.  Just fix the
306     file and save it by deleting the conflict markers and keeping the
307     code you need (in this case the =EMACS=myemacs= line which we
308     originally modified.)
310   - Mark the file's conflict resolved
312     : $ git add Makefile
314     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.
316   - Continue the rebase operation
318     : $ git rebase --continue
320     If any other conflicts arise you fix them the same way - edit the file, mark the conflict resolved, and continue.
322 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"
323 using
324 : $ git rebase --abort
326 ** How can I install an up-to-date version of org-mode without "make" tools?
327    :PROPERTIES:
328    :CUSTOM_ID: installing-org-without-make-tools
329    :END:
331 If you are using org-mode on a computer that lacks developer tools for
332 compiling software, such as [[http://www.gnu.org/software/make/][GNU Make]], you will have to use a
333 *different* installation method than [[http://orgmode.org/manual/Installation.html#Installation][the one outlined in the manual]].
335 Please see [[http://article.gmane.org/gmane.emacs.orgmode/15264][this thread]] on the mailing list for several different ways
336 you can install a recent version of org-mode without using the
337 customary =make clean && make && make install=.
339 The result of that discussion is the file/function found in
340 [[http://orgmode.org/worg/org-hacks.php#compiling-org-without-make]].
342 * Setup
343   :PROPERTIES:
344   :CUSTOM_ID: Setup
345   :END:
347 ** How can I quickly browse all Org options?
349 =M-x org-customize RET=
351 See also [[file:org-tutorials/org-customize.org][Carsten's Org customize tutorial]] and [[file:org-configs/org-customization-guide.org][this customization guide]]
352 for details.
354 ** Can I use the editing features of org-mode in other modes?
355    :PROPERTIES:
356    :CUSTOM_ID: use-editing-features-in-other-modes
357    :END:
359    Not really---but there are a few editing features you can use in
360    other modes.
362    - For tables there is =orgtbl-mode= which implements the table
363      editor as a minor mode. (To enable, type =M-x orgtbl-mode=)
364    - For ordered lists there is =orgstuct-mode= which allows for easy
365      list editing as a minor mode. (To enable, type =M-x
366      orgstruct-mode=)
368    You can activate these modes automatically by using hooks:
370    : (add-hook 'mail-mode-hook 'turn-on-orgtbl)
371    : (add-hook 'mail-mode-hook 'turn-on-orgstruct)
373    For footnotes, there is the function =org-footnote-action=, which
374    works in non-org buffers. This function is a powerful tool for
375    creating and sorting footnotes. To use it globally, you can add the
376    following keybinding to your =.emacs= file (requires Org 6.17 or
377    greater):
379    : (global-set-key (kbd "C-c f") 'org-footnote-action)
381    For other features you need to switch to Org-mode temporarily, or
382    prepare text in a different buffer.
384 ** Why isn't feature "X" working the way it is described in the manual?
385    :PROPERTIES:
386    :CUSTOM_ID: making-sure-org-mode-is-up-to-date
387    :END:
389 Org-mode develops very quickly. There have been a great many changes,
390 for instance, since the release of Emacs 22, which shipped with
391 version 4.67d of org-mode. (Emacs 23 is expected to ship with version
392 6.21b.)
394 Many of the users on the org-mode mailing list are using either a
395 recent release of org-mode or the
396 [[http://orgmode.org/index.html#sec-3.2][development version of
397 org-mode from the git repository]].
399 If some settings and features aren't working the way you expect, make
400 sure that the version of the manual you are consulting matches the
401 version of org-mode you are using.
403    - You can check which version of org-mode you are using by
404      selection =Org --> Documentation --> Show Version= in the Emacs
405      menu.
407    - The [[http://orgmode.org/manual/index.html][online manual]] at [[http://orgmode.org][orgmode.org]] corresponds to the most recent
408      release.
410    - 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
411      released with the latest official Gnu Emacs release (Emacs 22 and
412      org-mode 4.67d as of February 2009). Note: compared with the
413      manual at the orgmode.org, the manual at www.gnu.org is
414      considerably out of date.
416 For instructions on how to stay current with org-mode, consult [[keeping-current-with-Org-mode-development][this
417 FAQ]] or follow the instructions on [[http://orgmode.org][the official org-mode site]].
419 ** Can I get the visibility-cycling features in outline-mode and outline-minor-mode?
420    :PROPERTIES:
421    :CUSTOM_ID: use-visibility-cycling-in-outline-mode
422    :END:
424    Yes, these functions are written in a way that they are independent of
425    the outline setup.  The following setup provides standard Org-mode
426    functionality in outline-mode on =TAB= and =S-TAB=.  For
427    outline-minor-mode, we use =C-TAB= instead of =TAB=,
428    because =TAB= usually has mode-specific tasks.
430 #+BEGIN_SRC emacs-lisp
431 (add-hook 'outline-minor-mode-hook
432   (lambda ()
433     (define-key outline-minor-mode-map [(control tab)] 'org-cycle)
434     (define-key outline-minor-mode-map [(shift tab)] 'org-global-cycle)))
435 (add-hook 'outline-mode-hook
436   (lambda ()
437     (define-key outline-mode-map [(tab)] 'org-cycle)
438     (define-key outline-mode-map [(shift tab)] 'org-global-cycle)))
439 #+END_SRC
441 Or check out /outline-magic.el/, which does this and also provides
442 promotion and demotion functionality.  /outline-magic.el/ is
443 available at [[http://www.astro.uva.nl/~dominik/Tools/outline-magic.el][Outline Magic]].
445 ** Can I save/restore the visibility state of an org-mode buffer?
447 Well, no.
449 ** How can I keep track of changes in my Org files?
450    :PROPERTIES:
451    :CUSTOM_ID: track-of-changes-in-Org-files
452    :END:
454   Use git to track the history of the files, use a cronjob to check in
455   changes regularly.  Such a setup is described by Bernt Hansen
456   in [[http://article.gmane.org/gmane.emacs.orgmode/6233][this message]] on [[http://dir.gmane.org/gmane.emacs.orgmode][emacs-orgmode]].
458 ** Can I use Org-mode as the default mode for all README files?
459    :PROPERTIES:
460    :CUSTOM_ID: Org-mode-as-default-mode
461    :END:
463 Add the following to your .emacs file:
465 : (add-to-list 'auto-mode-alist '("README$" . org-mode))
467 You can even make it the default mode for any files with unspecified
468 mode using
470 : (setq default-major-mode 'org-mode)
472 ** Can I use ido.el for completing stuff in Org?
473    :PROPERTIES:
474    :CUSTOM_ID: ido-complete
475    :END:
477    Yes, you can.  If you are an ido user and ido-mode is active, the
478    following setting will make Org use =ido-completing-read= for most
479    of its completing prompts.
481 : (setq org-completion-use-ido t)
483 ** Should I use one big org file or multiple files?
484    :PROPERTIES:
485    :CUSTOM_ID: how-to-organize-org-mode-files
486    :END:
488 Org-mode is flexible enough to accomodate a variety of organizational
489 and time management schemes. Org's
490 [[http://orgmode.org/manual/Document-Structure.html#Document-Structure][outline
491 cycling and convenient editing and navigation commands]] make it
492 possible to maintain all of your projects and notes in a single file.
493 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
494 notes and todos]], also make it a delight to maintain a private "wiki"
495 consisting of multiple files.
497 No matter how you organize your org files, org-mode's agenda commands
498 make it easy to search all your notes and gather together crucial data
499 in a single view.
501 Moreover, several org-mode settings can be configured either globally
502 in your =.emacs= file or locally (per file or per outline tree). See
503 the [[http://orgmode.org/manual/index.html#Top][manual]] for more details. For an example of local customizations
504 see [[limit-agenda-with-category-match][this FAQ]].
506 Here are a few ideas for organizing org-mode files:
508 - A single file for all your projects and notes.
509 - One file per project.
510 - One file per client.
511 - One file per area of responsibility or type of work (e.g.,
512   household, health, work, etc.).
513 - One file for projects, one for appointments, one for reference
514   material, one for someday/maybe items, etc.
515 - A wiki of hyperlinked files that grows and adapts to meet your
516   needs.
518 For more ideas, see some of the links on the [[file:org-tutorials/index.org][org-tutorial index]] or
519 [[file:org-gtd-etc.org][this page on org-mode and GTD]].
521 ** Why doesn't C-c a call the agenda? Why don't some org keybindings work?
522    :PROPERTIES:
523    :CUSTOM_ID: setting-global-keybindings
524    :END:
526 Org-mode has a few global keybindings that the user must set
527 explicitly in an =.emacs= file. These keybindings include the
528 customary shortcut for calling the agenda (=C-c a=). If nothing
529 happens when you type =C-c a=, then make sure that the following lines
530 are in your =.emacs= file:
532 #+BEGIN_SRC emacs-lisp
533 ;; The following lines are always needed.  Choose your own keys.
534 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
535 (global-set-key "\C-cl" 'org-store-link)
536 (global-set-key "\C-ca" 'org-agenda)
537 (global-set-key "\C-cb" 'org-iswitchb)
538 #+END_SRC emacs-lisp
540 You may, of course, choose whatever keybindings work best for you
541 and do not conflict with other modes.
543 Please see [[http://orgmode.org/manual/Activation.html][this section of the manual]] if you have additional
544 questions.
546 ** Why aren't some of the variables I've customized having an effect?
547    :PROPERTIES:
548    :CUSTOM_ID: load-org-after-setting-variables
549    :END:
551 Some org variables have to be set before org.el is loaded or else they
552 will not work. (An example is the new variable
553 =org-enforce-todo-dependencies=.)
555 To make sure all your variables work you should not use =(require
556 'org)=. Instead use the following setting:
558 : (require 'org-install)
560 You should also make sure that you do not require any other =org-...=
561 files in your =.emacs= file before you have set your org variables,
562 since these will also cause org.el to be loaded. To be safe, load org
563 files *after* you have set your variables.
565 ** Org-mode has a lot of colors?  How can I change them?
566    :PROPERTIES:
567    :CUSTOM_ID: customizing-org-faces
568    :END:
570 This is a question that applies to Emacs as a whole, but it comes up
571 quite frequently on the org-mode mailing list, so it is appropriate to
572 discuss it here.
574 If you would like to change the style of a face in org-mode (or any
575 other Emacs mode), simply type =M-x customize-face [RET]= while the
576 cursor is on the color/style you are interested in modifying. You will
577 be given the opportunity to customize all the faces located at that
578 point.
580 If you would like an overview of all the faces in org-mode, you can
581 type =C-u M-x list-faces-display [RET] org= and you will be shown all
582 the faces defined by org-mode along with an illustration of their
583 current settings.
585 If you would like to customize org-faces and other aspects of
586 org-appearance, type =M-x customize-group org-font-lock [RET]=.
588 Finally, if you would like verbose information about the properties of
589 the text under the cursor, you can type =C-u C-x ==.
591 See the Worg page on [[file:org-tutorials/org-appearance.org][customizing Org appearance]] for further information.
593 ** How can I make sure that timestamps appear in English?
594    :PROPERTIES:
595    :CUSTOM_ID: timestamps-and-system-time-locale
596    :END:
598 If your system's locale is not set to English, but you would like the
599 timestamps in your org-mode files to appear in English, you can set
600 the following variable:
602 #+begin_src emacs-lisp
603   (setq system-time-locale "C")
604 #+end_src
606 * Errors and general problems
607   :PROPERTIES:
608   :CUSTOM_ID: Errors
609   :END:
610 ** When I try to use Org-mode, I always get the error message =(wrong-type-argument keymapp nil)=
611    :PROPERTIES:
612    :CUSTOM_ID: wrong-type-argument-keymapp
613    :END:
615    This is a conflict with an outdated version of the /allout.el/, see
616    the [[http://orgmode.org/manual/Conflicts.html#Conflicts][Conflicts]] section in the manual
618 ** How can I control the application launched by Org-mode to open a certain file type like pdf, html.... 
619    :PROPERTIES:
620    :CUSTOM_ID: external-application-launched-to-open-file-link
621    :END:
623 If you want special control about how Org-mode opens files, see the
624 variables =org-file-apps=, =org-file-apps-defaults-gnu=,
625 =org-file-apps-defaults-macosx=, =org-file-apps-defaults-windowsnt=.
627 *However*, normally it is best to just use the mechanism the
628 operating-system provides:
630 *** GNU/Linux systems
631     You you have to check your mailcap settings, find the files:
633     : /etc/mailcap
634     : 
635     : or  
636     : 
637     : $HOME/.mailcap
639 and modify them accordingly. Please read their manual entry.
641 *** Windows systems 
642     + for html pages you may configure the =browse-url-= variables through
643       the Customize interface,
644     + the pdf files are automatically opened with Acrobat Reader (if it is
645       installed)
647 *** Mac OSX
648     Change the application responsible for this file type by selecting
649     such a file in the Finder, select =File->Get Info= from the menu
650     and select the application to open this file with.  Then, to
651     propagate the change to all files with the same extension, select
652     the =Change all= button.
654 ** Org-mode takes over the TAB key.  I also want to use YASnippet, is there a way to fix this conflict?
655    :PROPERTIES:
656    :CUSTOM_ID: YASnippet
657    :END:
659 [[http://code.google.com/p/yasnippet/][yasnippet]] is yet another snippet expansion system for Emacs.  It is
660 inspired by TextMate's templating syntax.
661 - watch the [[http://www.youtube.com/watch?v=vOj7btx3ATg][video on YouTube]]
662 - see the [[http://yasnippet.googlecode.com/svn/trunk/doc/index.html][intro and tutorial]]
664 *Note*: yasnippet is not compatible with =org-indent-mode= currently
665 there is no known way to use both successfully with =yas/trigger-key=
666 set to =TAB= (or =[tab]= etc...)
668 The way Org-mode binds the =TAB= key (binding to =[tab]= instead of
669 =\t=) overrules yasnippets' access to this key.  The following code
670 fixes this problem:
672 #+begin_src emacs-lisp
673 (add-hook 'org-mode-hook
674           (lambda ()
675             (org-set-local 'yas/trigger-key [tab])
676             (define-key yas/keymap [tab] 'yas/next-field-group)))
677 #+end_src
679 If the above code doesn't work (which it may not with later versions
680 of yasnippet).  Then try the following
682 #+begin_src emacs-lisp
683   (defun yas/org-very-safe-expand ()
684     (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
685   
686   (add-hook 'org-mode-hook
687             (lambda ()
688               ;; yasnippet (using the new org-cycle hooks)
689               (make-variable-buffer-local 'yas/trigger-key)
690               (setq yas/trigger-key [tab])
691               (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
692               (define-key yas/keymap [tab] 'yas/next-field)))
693 #+end_src
695 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]])
696 with YASnippets for Org-mode.
698 ** Org-mode takes over the S-cursor keys.  I also want to use CUA-mode, is there a way to fix this conflict?
699    :PROPERTIES:
700    :CUSTOM_ID: CUA-mode
701    :END:
703 Yes, see the  [[http://orgmode.org/manual/Conflicts.html#Conflicts][Conflicts]] section of the manual.
705 ** Org-mode takes over the S-cursor keys.  I also want to use windmove.el, is there a way to fix this conflict?
706    :PROPERTIES:
707    :CUSTOM_ID: windmove.el
708    :END:
710 Yes, see the [[http://orgmode.org/manual/Conflicts.html#Conflicts][Conflicts]] section of the manual.
712 ** Org behaves strangely: some keys don't work, some features are missing, my settings have no effect, ...
713    :PROPERTIES:
714    :CUSTOM_ID: loaded-old-org
715    :END:
717 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=.
719 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.
721 You should add your directories to the =load-path= at the beginning:
723 :  (add-to-list 'load-path "~/.emacs.d/org-mode/lisp") (require 'org-install)
725 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)=.
727 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.
729 ** Why doesn't org-batch-agenda work under Win32?
730    :PROPERTIES:
731    :CUSTOM_ID: org-batch-agenda-under-win32
732    :END:
734 When I run the example batch files to print my agenda to the console
735 under Win32 I get the failure:
737 : End of file during parsing
739 and no agenda is printed.
741 The problem is the use of single quotes surrounding the eval in the
742 emacs command-line. This gets confused under Win32. All string
743 parameters with spaces must be surrounded in double quotes. This means
744 that double quotes being passed to the eval must be escaped.
746 Therefore, instead of the following:
748 : <path to emacs>\emacs.exe -batch -l ~/_emacs_org \
749 :     -eval '(org-batch-agenda "a")'
751 you need to use the following:
753 :  <path to emacs>\emacs.exe -batch -l ~/_emacs_org \
754 :     -eval "(org-batch-agenda \"a\")"
756 (all on one line, of course).
758 ** Org agenda seems very slow
759    :PROPERTIES:
760    :CUSTOM_ID: slow-agenda
761    :END:
763 If it takes a long time to generate or refresh the agenda, you might
764 want first check which version of org-mode you are using. There have
765 been major optimizations of org-agenda since 6.21b, which was the
766 version of org-mode released with Emacs 23. If you are using 6.21b or
767 earlier (you can check with =M-x org-version=), then you might want to
768 consider upgrading to a more recent version of org-mode.
770 Here are some other ideas for speeding up the agenda:
772 1. Use a one day agenda view (rather than a seven day view).
774    =(setq org-agenda-ndays 1)=
776 2. Archive inactive items to separate files.
777    
778    =C-c C-x C-s= (org-archive-subtree)
780 3. Do not include the global todo list in your agenda view.
782    (setq org-agenda-include-all-todo nil)
784 4. Make sure that your org files are byte-compiled.
786    I.e., make sure there are files ending in .elc in your org
787    installation directory.
789 ** Visual-line-mode doesn't work well with org-mode
790    :PROPERTIES:
791    :CUSTOM_ID: visual-line-mode
792    :END:
794 Visual-line-mode "soft wraps" lines so that the visual edge of the
795 buffer is considered a line break for purposes of navigation, even
796 though there is no line break in reality. 
798 In older versions of org-mode, org-beginning-of-line and
799 org-end-of-line do not work well with visual line mode. (The two
800 commands disregard soft line breaks and move to the beginning and end
801 of the hard line break.) A patch was introduces to fix this behavior
802 in July of 2009. n
804 If you are using an older version of org mode, you can:
806 1. Add a hook to turn off visual line mode.
808 2. Add the following to your =.emacs=:
810 #+begin_src emacs-lisp
812 (add-hook 'org-mode-hook
813   (lambda ()
814     (define-key org-mode-map "\C-a" 'move-beginning-of-line)
815     (define-key org-mode-map "\C-e" 'move-end-of-line)))
817 #+end_src
819 * Outline
820   :PROPERTIES:
821   :CUSTOM_ID: Outline
822   :END:
823 ** Can I have two windows on the same Org-mode file, with different outline visibilities?
824    :PROPERTIES:
825    :CUSTOM_ID: indirect-buffers
826    :END:
828    You may use /indirect buffers/ which do exactly this.  See the
829    documentation on the command =make-indirect-buffer=.
831    Org-mode has built-in commands that allow you create an indirect
832    buffer from a subtree of an outline. To open a subtree in new
833    window, type =C-c C-x b=. Any changes you make in the new window
834    will be saved to the original file, but the visibility of both
835    buffers will remain independent of one another.
837    For multiple indirect buffers from the same file, you must use the
838    prefix =C-u= when creating the second (or third) buffer. Otherwise
839    the new indirect buffer will replace the old.
841    You can also create an independent view of an outline subtree by
842    typing =b= on an item in the agenda.
844 ** Emacs outlines are unreadable.  Can I get rid of all those stars?
845    :PROPERTIES:
846    :CUSTOM_ID: Emacs-outlines-are-unreadable
847    :END:
849    See the section [[http://orgmode.org/manual/Clean-view.html#Clean-view][Clean outline view]] in the manual.
850 ** C-k is killing whole subtrees!  I lost my work!
851    :PROPERTIES:
852    :CUSTOM_ID: C-k-is-killing-subtrees
853    :END:
855   =(setq org-special-ctrl-k t)= before losing your work.
857 ** Why aren't commands working on regions?
858    :PROPERTIES:
859    :CUSTOM_ID: transient-mark-mode
860    :END:
862 Some org-mode commands, such as M-right and M-left for demoting or
863 promoting headlines (see [[demote-multiple-headlines][this FAQ]]), can be applied to entire regions.
864 These commands, however, will only work on active regions set with
865 [[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
866 Emacs 23. To enable it in earlier versions of emacs, put the following
867 in your =.emacs= file:
869 : (transient-mark-mode 1)
871 Alternatively, you may turn off transient mark mode and use [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Momentary-Mark.html][a
872 momentary mark]] (=C-<SPC> C-<SPC>=).
874 ** Why is a blank line inserted after headlines and list items?
875    :PROPERTIES:
876    :ID:       2463F4D8-F686-4CF3-AA07-08976F8A4972
877    :END:
878    :PROPERTIES:
879    :CUSTOM_ID: blank-line-after-headlines-and-list-items
880    :END:
882 In org-mode, typing =M-RET= at the end of a headline will create a new
883 headline of the same level on a new line. The same is true for plain
884 lists. By default org-mode uses context to determine if a blank line
885 should be inserted after each headline or plain list item when =M-RET=
886 is pressed. For instance, if a there is a blank line before a
887 headline, then typing =M-RET= at the end of the line will insert a
888 blank line before the new headline. For instance, hitting =M-RET=
889 at the end of "Headline Two" below inserts a new headline without a
890 blank line:
892 : ** Headline One
893 : ** Headline Two
894 : **
896 If there is a blank line between Headline One and Headline Two,
897 however, the results will be as follows:
899 : ** Headline One
901 : ** Headline Two
903 : **
905 If you do not like the default behavior you can change it with the
906 variable =org-blank-before-new-entry=. You can set headings and/or
907 plain lists to auto (the default setting), t (always), or nil (never).
909 ** How can I promote or demote multiple headlines at once?
910    :PROPERTIES:
911    :CUSTOM_ID: demote-multiple-headlines
912    :END:
914 If you have a long list of first level headlines that you'd like to
915 demote to second level headlines, you can select the headlines as a
916 region and then hit =M-<right>= to demote all the headlines at once.
918 Note: =M-S-<right>= will not work on a selected region. Its use is to
919 demote a single subtree (i.e., a headline and all sub-headlines).
921 If M-<right> doesn't seem to work, make sure transient mark mode is
922 enabled. See [[transient-mark-mode][this FAQ]].
924 ** What's the deal with all the ellipses in my org outlines?
925    :PROPERTIES:
926    :CUSTOM_ID: org-ellipses
927    :END:
929 Org-mode uses ellipses to indicate folded (and thus hidden) text. Most
930 commonly, ellispes occur at the end of headings with folded content:
932 : * Heading ...
934 Or, for instance, they may indicate closed drawers:
936 : :PROPERTIES: ...
938 Sometimes, as a result of editing and cycling an outline, ellipses may
939 appear in unexpected places. You should *never* delete these ellipses,
940 as you may accidentally delete hidden text. Instead, you can type =C-c
941 C-r= (org-reveal) to display all hidden text in the vicinity. Or you
942 may type =M-x RET show-all= to reveal all text in the org file.
944 If you would prefer a symbol or face for indicating hidden text, you
945 can customize the variable org-ellipses.
947 ** How do I yank a subtree so it's indented according to points' location?
948    :PROPERTIES:
949    :CUSTOM_ID: yank-indent-subtree
950    :END:
952 You can either use =C-c C-w= with a working [[http://orgmode.org/manual/Refiling-notes.html#Refiling-notes][refile-targets]] setup.
954 Or set =org-yank-adjusted-subtrees= to =t= which will adjust the
955 yanked headline's level correctly.
957 Just use =C-k= and =C-y= as you would everywhere else in Emacs.
959 * Todos and Tags
960   :PROPERTIES:
961   :CUSTOM_ID: Todos-and-Tags
962   :END:
963 ** How can I cycle through the TODO keyword of an entry?
964    :PROPERTIES:
965    :CUSTOM_ID: cycle-TODO-keywords
966    :END:
968   =C-c C-t= or =S-<left/right>= is what you need.
970 ** How do I track state changes for tasks in Org?
971    :PROPERTIES:
972    :CUSTOM_ID: track-state-changes-for-tasks
973    :END:
975   Take a look at the [[http://thread.gmane.org/gmane.emacs.orgmode/6082][post by Bernt Hansen]] for setting up TODO keyword
976   states and logging timestamps for task state changes.
978 ** Can I select the TODO keywords with a tag-like interface?
979    :PROPERTIES:
980    :CUSTOM_ID: select-TODO-keywords-with-tag-like-interface
981    :END:
983   Yes.  Use =(setq org-use-fast-todo-selection t)=
985   If you want to set both your todos and your tags using a single
986   interface, then check out the variable
987   =org-fast-tag-selection-include-todo=.
989   See [[http://orgmode.org/manual/Fast-access-to-TODO-states.html][this section of the manual]] for more details.
991 ** How can I quickly set the tag of an entry?
992    :PROPERTIES:
993    :CUSTOM_ID: quickly-set-tag-of-entry
994    :END:
996    Use =C-c C-c= or =C-c C-q= on the headline. =C-c C-q= is useful for
997    setting tabs in a [[http://orgmode.org/manual/Remember.html#Remember][remember]] buffer, since =C-c C-c= is the default
998    keybinding for filing a note from the remember buffer.
1000    You can set tags even more quickly by setting one of the character
1001    shortcuts for [[http://orgmode.org/manual/Setting-tags.html#Setting-tags][fast tag selection]].
1003    To set tag shortcuts for all org buffers, put something like the
1004    following in your =.emacs= file (or create the same settings by
1005    typing =M-x customize-variable RET org-tag-alist=):
1007 : (setq org-tag-alist '(("computer" . ?c) ("office" . ?o) ("home" . ?h)))
1009    To set tag shortcuts for a single buffer, put something like the
1010    following at the top of your org file:
1012 : #+TAGS: computer(c) office(o) home(h)
1014 ** How can I change the colors of TODO keywords?
1016 You can use the variable org-todo-keyword-faces. Here are some sample
1017 settings:
1019 #+begin_src emacs-lisp
1020 (setq org-todo-keyword-faces
1021       '(
1022         ("TODO"  . (:foreground "firebrick2" :weight bold))
1023         ("WAITING"  . (:foreground "olivedrab" :weight bold))
1024         ("LATER"  . (:foreground "sienna" :weight bold))
1025         ("PROJECT"  . (:foreground "steelblue" :weight bold))
1026         ("DONE"  . (:foreground "forestgreen" :weight bold))
1027         ("MAYBE"  . (:foreground "dimgrey" :weight bold))
1028         ("CANCELED"  . shadow)
1029         ))
1030 #+end_src
1032 If you want to change the color of all active todos or all inactive
1033 todos, type:
1035 : M-x customize-face RET org-todo
1036 : M-x customize-face RET org-done
1038 You can also set values for each of these in your =.emacs= file:
1040 : (set-face-foreground 'org-todo "firebrick2")
1041 : (set-face-foreground 'org-done "forestgreen")
1043 * Hyperlinks
1044   :PROPERTIES:
1045   :CUSTOM_ID: Hyperlinks
1046   :END:
1047 ** Why do I have to confirm the execution of each shell/elisp link?
1048    :PROPERTIES:
1049    :CUSTOM_ID: confirm-shell/elisp-link
1050    :END:
1052    The confirmation is there to protect you from unwantingly execute
1053    potentially dangerous commands.  For example, imagine a link
1055    : [[shell:rm -rf ~/*][Google Search]]
1057    In an Org-mode buffer, this command would look like /Google Search/,
1058    but really it would remove your home directory.  If you wish, you can
1059    make it easier to respond to the query by setting
1061    : (setq org-confirm-shell-link-function 'y-or-n-p
1062    :       org-confirm-elisp-link-function 'y-or-n-p).
1064    Then a single keypress will be enough to confirm those links.  It is
1065    also possible to turn off this check entirely, but I strongly
1066    recommend against this.  Be warned.
1068 ** Can I use RET or TAB to follow a link?
1069    :PROPERTIES:
1070    :CUSTOM_ID: RET-or-TAB-to-follow-link
1071    :END:
1073    Yes, this is how:
1075    : (setq org-return-follows-link t)
1076    : (setq org-tab-follows-link t)
1078 ** Can I keep mouse-1 clicks from following a link?
1079    :PROPERTIES:
1080    :CUSTOM_ID: mouse-1-following-link
1081    :END:
1083    Activating links with =mouse-1= is a new feature in Emacs 22, to make
1084    link behavior similar to other applications like web browsers.  If
1085    you hold the mouse button down a bit longer, the cursor will be set
1086    without following the link.  If you cannot get used to this behavior,
1087    you can (as in Emacs 21) use =mouse-2= to follow links and turn off
1088    link activation for =mouse-1= with
1090    : (setq org-mouse-1-follows-link nil)
1092 ** How can I get completion of file names when creating a link?
1093    :PROPERTIES:
1094    :CUSTOM_ID: completion-of-file-links
1095    :END:
1097 You can use org-insert-link with a prefix argument:
1099 : C-u C-c C-l
1101 You will be greeted with prompt in the minibuffer that allows for file
1102 completion using your preferred Emacs method for finding files.
1104 * Plain Lists
1105   :PROPERTIES:
1106   :CUSTOM_ID: Plain-Lists
1107   :END:
1108 ** How can I insert an empty line before each newly inserted headline, but not before each newly inserted plain-list item?
1109    :PROPERTIES:
1110    :CUSTOM_ID: empty-line-before-each-new-headline-but-not-item
1111    :END:
1113 : (setq org-blank-before-new-entry
1114 :       '((heading . t) (plain-list-item . nil))
1116 See also [[id:2463F4D8-F686-4CF3-AA07-08976F8A4972][Why is a blank line inserted after headlines and list items?]].
1118 ** How can I convert itemized lists to enumerated lists?
1119    :PROPERTIES:
1120    :CUSTOM_ID: convert-itemized-to-enumerated-lists
1121    :END:
1123    You can use =C-c -= or =S-<left>/<right>= to cycle through the various
1124    bullet headlines available for lists: =-, +, *, 1., 1)=.
1126    See [[http://orgmode.org/manual/Plain-lists.html#Plain-lists][this section of the manual]] for more information.
1128 ** How can I convert plain lists to headlines and vice versa?
1129    :PROPERTIES:
1130    :CUSTOM_ID: convert-plain-lists-to-headlines
1131    :END:
1133    To convert a plain list item or line to a headline, type =C-c *= on
1134    the headline. This will make the line a subheading of the current
1135    headline.
1137    To convert a headline to a plain list item, type =C-c -= while the
1138    cursor is on the headline.
1140    To convert a headline to an unadorned line of text, type =C-c *= on
1141    the headline.
1143    You can use query replace to accomplish the same things, as Bernt
1144    Hansen explains in [[http://article.gmane.org/gmane.emacs.orgmode/10148][this mailing list post]].
1146 ** Is there a good way to create a description list?
1147    :PROPERTIES:
1148    :CUSTOM_ID: description-lists
1149    :END:
1151   Yes, these are now built-in:
1153 #+BEGIN_EXAMPLE
1154 - item1 :: Description of this item 1
1155 - item2 :: Description of this item 2
1156 - item1 :: Description of this item 3
1157       also in multiple lines
1158 #+END_EXAMPLE
1160 * Tables
1161   :PROPERTIES:
1162   :CUSTOM_ID: Tables
1163   :END:
1164 ** Can I plot data from a table?
1165    :PROPERTIES:
1166    :CUSTOM_ID: plotting-table-data
1167    :END:
1169    Yes, you can, using org-plot.el written by James TD Smith and now
1170    bundled with Org.  See [[http://orgmode.org/manual/Org-Plot.html#Org-Plot][the manual section about this]].
1172    See also [[file:org-tutorials/org-plot.org][this excellent tutorial]] by Eric Schulte.
1174 ** How can I fill a table column with incremental numbers?
1175    :PROPERTIES:
1176    :CUSTOM_ID: fill-table-column-with-incremental-numbers
1177    :END:
1179 Here is how: Use a field formula to set the first value in the column:
1181 #+begin_src org
1182 ,| N   |   |
1183 ,|-----+---|
1184 ,| :=1 |   |
1185 ,|     |   |
1186 ,|     |   |
1187 ,|     |   |
1188 ,#+TBLFM: @2$1=1
1189 #+end_src
1191 Then define a column formula in the second field:
1193 #+begin_src org
1194 ,| N        |   |
1195 ,|----------+---|
1196 ,| 1        |   |
1197 ,| =@-1 + 1 |   |
1198 ,|          |   |
1199 ,|          |   |
1200 ,#+TBLFM: @2$1=1
1201 #+end_src
1203 After recomputing the table, the column will be filled with
1204 incremental numbers:
1206 #+begin_src org
1207 ,| N |   |
1208 ,|---+---|
1209 ,| 1 |   |
1210 ,| 2 |   |
1211 ,| 3 |   |
1212 ,| 4 |   |
1213 ,#+TBLFM: $1=@-1 + 1::@2$1=1
1214 #+end_src
1216 Note that you could use arbitrary starting values and column formulas.
1218 ** Why does my table column get filled with #ERROR?
1219    :PROPERTIES:
1220    :CUSTOM_ID: table-column-filled-with-ERROR
1221    :END:
1223    Org-mode tried to compute the column from other fields using a
1224    formula stored in the =#+TBLFM:= line just below the table, and
1225    the evaluation of the formula fails.  Fix the fields used in the
1226    formula, or fix the formula, or remove it!
1228 ** How can I stop the table editor from creating new lines?
1229    :PROPERTIES:
1230    :CUSTOM_ID: table-editor-creates-new-lines
1231    :END:
1233    When I am in the last column of a table and just above a horizontal
1234    line in the table, pressing TAB creates a new table line before the
1235    horizontal line.  To move to the line below the
1236    horizontal line instead, do this:
1238    Press =down= (to get on the separator line) and then =TAB=.
1239    Or configure the variable
1241    : (setq org-table-tab-jumps-over-hlines t)
1243 ** How can I get table fields starting with "="?
1244    :PROPERTIES:
1245    :CUSTOM_ID: table-fields-starting-with-=
1246    :END:
1248    With the setting
1250    : (setq org-table-formula-evaluate-inline nil)
1252    this will no longer happen.  You can still use formulas using the
1253    commands @<tt>C-c =@</tt> and @<tt>C-u C-c =@</tt>
1255 ** How can I change the indentation of an entire table without fixing every line by hand?
1256    :PROPERTIES:
1257    :CUSTOM_ID: change-indentation-entire-table
1258    :END:
1260    The indentation of a table is set by the first line.  So just fix the
1261    indentation of the first line and realign with =TAB=.
1263 ** In my huge table the realigning after each TAB takes too long.  What can I do?
1264    :PROPERTIES:
1265    :CUSTOM_ID: table-realigning-after-TAB-takes-long
1266    :END:
1268    Either split the table into several by inserting an empty line every
1269    100 lines or so.  Or turn off the automatic re-align with
1271    : (setq org-table-automatic-realign nil)
1273    After this the only way to realign a table is to press =C-c C-c=.  It
1274    will no longer happen automatically, removing the corresponding delays
1275    during editing.
1277 ** Recalculation of my table takes too long.  What can I do?
1278    :PROPERTIES:
1279    :CUSTOM_ID: Recalculation-of-my-table-takes-too-long
1280    :END:
1282    Nothing, really.  The spreadsheet in org is mostly done to make
1283    calculations possible, not so much to make them fast.  Since Org-mode
1284    is firmly committed to the ASCII format, nothing is stopping you from
1285    editing the table by hand.  Therefore, there is no internal
1286    representation of the data.  Each time Org-mode starts a computation,
1287    it must scan the table for special lines, find the fields etc.  This
1288    is slow.  Furthermore, Calc is slow compared to hardware
1289    computations.  To make this work with normal editing, recalculation
1290    is not happening automatically, or only for the current line, so that
1291    the long wait for a full table iteration only happens when you ask
1292    for it.
1294    So for really complex tables, moving to a "real" spreadsheet may
1295    still be the best option.
1297    That said, there are some ways to optimize things in Org-mode, and I
1298    have been thinking about moving a bit further down this line.
1299    However, for my applications this has so far not been an issue at
1300    all.  If you have a good case, you could try to convince me.
1302 ** =S-RET= in a table keeps increasing the copied numbers.  How can I stop this?
1303    :PROPERTIES:
1304    :CUSTOM_ID: S-RET-in-a-table-increases-copied-numbers
1305    :END:
1307    Well, it is /supposed/ to be a feature, to make it easy to create a
1308    column with increasing numbers.  If this gets into your way, turn it
1309    off with
1311    : (setq org-org-table-copy-increment nil)
1313 ** When I export tables to html, they don't have borders.
1314    :PROPERTIES:
1315    :CUSTOM_ID: table-borders-in-html-export
1316    :END:
1318 By default, org mode exports tables without borders.
1320 You can changed this by placing an =#+ATTR_HTML= line before the
1321 table:
1323 :  #+ATTR_HTML: border="2" rules="all" frame="all"
1325 See [[http://orgmode.org/manual/Tables-in-HTML-export.html#Tables-in-HTML-export][the manual]] for more details.
1327 * Markup
1328   :PROPERTIES:
1329   :CUSTOM_ID: Footnotes
1330   :END:
1331 ** How can I get automatic renumbering of footnotes in org-mode?
1332    :PROPERTIES:
1333    :CUSTOM_ID:       footnote-auto-adjust
1334    :END:
1336 You can add the following line to your .emacs file:
1338 : (setq org-footnote-auto-adjust t)
1340 Or, if you prefer, you can turn this option on locally by placing the
1341 following line at the top of your org file:
1343 : #+STARTUP: fnadjust
1345 When auto-adjust is turned on, footnotes in the file with numerical
1346 labels will be renumbered whenever a new footnote is added. Meanwhile,
1347 all footnotes, including those with custom labels such
1348 =[fn:custom-label ]=, will be sorted in the order of their appearance
1349 in the text.
1351 This emulates the footnote behavior that many users may be familiar
1352 with from word-processing programs or from the footnote-mode included
1353 with emacs.
1355 If you do not turn on org-footnote-auto-adjust, you sort and/or
1356 renumber footnotes at any time by calling org-footnote-action with a
1357 prefix argument.
1359 ** Why isn't auto renumbering of footnotes turned on by default?
1360    :PROPERTIES:
1361    :CUSTOM_ID:       why-no-default-auto-adjust
1362    :END:
1364 Org mode has a very robust footnote mechanism allowing for a variety
1365 of types of footnotes. With some of the following footnote notations,
1366 auto-adjust may be either irrelevant or undesired:
1368  - Automatically numbered
1369  - Footnotes with custom labels
1370  - Inline footnotes
1372 In addition, org mode can be customized to place footnotes either at
1373 the end of a document or at the end of the outline heading in which
1374 they appear. Users who change this setting while editing a document
1375 may be disconcerted to find all of their footnotes rearranged
1376 automatically.
1378 ** I have auto-fill-mode set and org-mode is inserting unwanted comment markers!
1379    :PROPERTIES:
1380    :CUSTOM_ID: auto-fill-and-unwanted-comments
1381    :END:
1383 If the following occurs:
1385 #+begin_src org
1387 #+OPTIONS: toc:nil
1388 Some entered text.
1389 # More entered tex.
1391 #+end_src
1393 Make sure that the variable comment-start is nil.
1395 * Remember
1396   :PROPERTIES:
1397   :CUSTOM_ID: Remember
1398   :END:
1399 ** Can I use the remember buffer to clock a customer phone call?
1400    :PROPERTIES:
1401    :CUSTOM_ID: use-remember-buffer-to-clock-phone-call
1402    :END:
1404   Yes, you can.  Take a look at the [[http://thread.gmane.org/gmane.emacs.orgmode/5482][setup described by Bernt Hansen]]
1405   and check out (in the same thread) what Nick Docos had to fix to
1406   make Bernt's set-up work for him.
1407 ** Can I automatically start the clock when opening a remember template?
1408    :PROPERTIES:
1409    :CUSTOM_ID: start-clock-when-opening-remember-template
1410    :END:
1412    Yes, this is possible.  Use the following code and make sure that
1413    after executing it, `my-start-clock-if-needed' is in
1414    `remember-mode-hook' /after/ `org-remember-apply-template'.
1416    : (add-hook 'remember-mode-hook 'my-start-clock-if-needed 'append)
1417    : (defun my-start-clock-if-needed ()
1418    :   (save-excursion
1419    :     (goto-char (point-min))
1420    :     (when (re-search-forward " *CLOCK-IN *" nil t)
1421    :       (replace-match "")
1422    :       (org-clock-in))))
1424    Then, when a template contains the key string CLOCK-IN, the clock
1425    will be started.  Starting with Org-mode version 5.20, the clock will
1426    automatically be stopped when storing the remember buffer.
1428 * Searches
1429   :PROPERTIES:
1430   :CUSTOM_ID: Searches
1431   :END:
1432 ** Isearch does not find string hidden in links.  What can I do?
1433    :PROPERTIES:
1434    :CUSTOM_ID: isearch-in-links
1435    :END:
1437   M-x =visible-mode= will display the full link, making them searchable.
1439 ** How can I reduce the amount of context shown in sparse trees?
1440    :PROPERTIES:
1441    :CUSTOM_ID: context-in-sparse-trees
1442    :END:
1444    Take a look at the following variables:
1446    - =org-show-hierarchy-above=
1447    - =org-show-following-headline=
1448    - =org-show-siblings=
1449    - =org-show-entry-blow=
1451    which give command-dependent control over how much context is shown
1452    by a particular operation.
1454 ** How can I combine the results of two calls to =org-occur=?
1455    :PROPERTIES:
1456    :CUSTOM_ID: two-calls-to-org-occur
1457    :END:
1459    You can construct a regular expression that matches all targets you
1460    want.  Alternatively, use a =C-u= prefix with the second and any
1461    further calls to =org-occur= to keep the current visibility and
1462    highlighting in addition to the new ones.
1464 * Agenda
1465   :PROPERTIES:
1466   :CUSTOM_ID: Agenda
1467   :END:
1468 ** How can I change the advanced warning time for deadlines?
1469 ##<<warning-period-for-deadlines>>
1471 Deadline warnings appear in the daily agenda view a specified number
1472 of days before the deadline is due. The default setting is 14 days.
1473 You can change this with the variable =org-deadline-warning-days=.
1474 (See [[http://orgmode.org/manual/Deadlines-and-scheduling.html#Deadlines-and-scheduling][this section]] of the manual.)
1476 For instance,
1478 : (setq org-deadline-warning-days 30)
1480 would cause warnings for each deadline to appear 30 days in advance.
1482 Naturally, you might not want warnings for all of your deadlines to
1483 appear so far in advance. Thus, you can change the lead time for
1484 individual items as follows:
1486 : * TODO Get a gift for the party
1487 :   DEADLINE: <2009-01-16 Fri -2d>
1489 The "-2d" above changes the lead time for this deadline warning to two
1490 days in advance. You can also use "w" for weeks and "m" for months.
1491 ** How can I postpone a task until a certain date?
1492    :PROPERTIES:
1493    :CUSTOM_ID: deferring-tasks
1494    :END:
1496 The easiest way to postpone a task is to schedule it in the future.
1497 For instance, typing =C-c C-s +2w= on a headline will push a task two
1498 weeks into the future, so that it won't show up on the daily agenda
1499 until two weeks from now.
1501 If you'd like to prevent the task from showing up on your global todo
1502 list, you have a couple of options.
1504 1. You can set the variable =org-agenda-todo-ignore-scheduled= to =t=.
1505    This will exclude any scheduled items from your global list of
1506    active todos (=C-c a t=). (The variable
1507    =org-agenda-todo-ignore-with-date= will exclude both scheduled and
1508    deadline items from your todo list).
1509 2. You can remove the todo keyword from the item (C-c C-t <SPC>). The
1510    item will still appear on your agenda two weeks from today, but it
1511    won't show up on your todo lists.
1512 ** Can I send myself an email containing tasks or other agenda info?
1513    :PROPERTIES:
1514    :CUSTOM_ID: email-containing-tasks-or-other-agenda-info
1515    :END:
1517    Yes.  See [[http://article.gmane.org/gmane.emacs.orgmode/6112][this thread]] on the list.
1519 ** How can I limit the agenda view to my "work" tasks?
1520    :PROPERTIES:
1521    :CUSTOM_ID: limit-agenda-with-tag-filtering
1522    :END:
1524    It is often convenient to group org files into separate categories,
1525    such as "home" and "work" (or "personal" and "professional"). One
1526    of the main reasons for such classification is to create agenda
1527    views that are limited by type of work or area of responsibility.
1528    For instance, while at work, one may want to see only professional
1529    tasks; while away from work, one may want to see only personal
1530    tasks.
1532    One way to categorize files and tasks is to use a "#+FILETAGS"
1533    declaration at the top of each file, such as:
1535    : #+FILETAGS: work
1537    As long as org-use-tag-inheritance is turned on, the filetags will
1538    be inherited by all tasks in the file. A file can have multiple
1539    filetags. And, of course, tags can be added to individual headings.
1541    Tasks can be quickly filtered by tag from within the agenda by
1542    typing "/" and the name of the tag. The full key sequence to filter
1543    for work items in an agenda view would be:
1545    : C-c a a / work [or a tag shortcut]
1547 ** How can I limit the agenda view to a particular category?
1548    :PROPERTIES:
1549    :CUSTOM_ID: limit-agenda-with-category-match
1550    :END:
1552    Another way to filter agenda views by type of work is to use a
1553    "#+CATEGORY" declaration at the top of each file, such as:
1555    : #+CATEGORY: work
1557    Categories can also be added to individual headings within a file:
1559    : * Big project
1560    :   :PROPERTIES:
1561    :   :CATEGORY: work
1562    :   :END:
1564    All todos belonging to the category "work" can be found a with a
1565    simple tags-todo search:
1567    : C-c a M
1569    At the prompt, type:
1571    : CATEGORY="work"
1573    The same results can be achieved with custom agenda commands, such as:
1575 #+BEGIN_SRC emacs-lisp
1576 (setq org-agenda-custom-commands
1577       '(("h" tags-todo "CATEGORY=\"home\"")
1578         ("w" tags-todo "CATEGORY=\"work\"")
1579         ;; other custom agenda commands here
1580         ))
1581 #+END_SRC
1583 ** How can include all org files in a directory in my agenda?
1584    :PROPERTIES:
1585    :CUSTOM_ID: set-agenda-files-using-wildcards
1586    :END:
1588 You can simply include the directory (as one of the items) in the
1589 value of the variable org-agenda-files:
1591 : (setq org-agenda-files '("/my/special/path/org/"))
1593 There is another way of accomplishing the same end:
1595 : (setq org-agenda-files (file-expand-wildcards "/my/special/path/org/*.org"))
1597 ** Why aren't items disappearing from my agenda once they are marked done?
1598    :PROPERTIES:
1599    :CUSTOM_ID: removing-done-items-from-agenda
1600    :END:
1602 If items remain on your daily/weekly agenda after they are marked
1603 done, check the configuration of the following variables:
1605 : org-agenda-skip-scheduled-if-done
1606 : org-agenda-skip-deadline-if-done
1607 : org-agenda-skip-timestamp-if-done
1609 For instance, type:
1611 : M-x customize-variable RET org-agenda-skip-scheduled-if-done
1613 If this variable is turned off (=nil=), then scheduled items will
1614 remain on the agenda even after they are marked done.
1616 If the variable is turned on (=t=), then scheduled items will
1617 disappear from the agenda after they are marked done.
1619 If these settings seem not to behave the way you expect, then make
1620 sure you understand [[scheduled-vs-deadline-vs-timestamp][the
1621 difference between SCHEDULED, DEADLINE, and timestamps]].
1623 ** What is the difference between SCHEDULED, DEADLINE, and plain timestamps?
1624    :PROPERTIES:
1625    :CUSTOM_ID: scheduled-vs-deadline-vs-timestamp
1626    :END:
1628 1. SCHEDULED items (set with =C-c C-s=) will appear on your agenda on
1629    the day they are scheduled and on every day thereafter until they
1630    are done. Schedule a task if you want to be reminded to do
1631    something beginning on a certain day and until it is done.
1633 : ** TODO Scheduled item
1634 :    SCHEDULED: <2009-03-01 Sun>
1636 2. Items with a DEADLINE timestamp (set with =C-c C-d=) appear on your
1637    agenda in advance of the when they are due and remain on your
1638    agenda until they are done. Add a DEADLINE to an item if you want
1639    to make sure to complete it by a certain date. (The variable
1640    org-deadline-warning-days determines how far in advance items with
1641    deadlines will show up in the agenda. See [[warning-period-for-deadlines][this FAQ]] for more
1642    information.)
1644 : ** TODO Item with a deadline
1645 :    DEADLINE: <2009-01-20 Tue>
1647 3. An active timestamp (set with =C-c .=) will appear on your agenda
1648    only on the day it is scheduled. Use a timestamp for appointments
1649    or any reminders you want to show up only on a particular day.
1651 : ** TODO Item with an active timestamp
1652 : <2009-04-18 Sat>
1654 Note: items with inactive timestamps (set with C-c ! and marked by
1655 square brackets) will not show up in the agenda at all.
1657 ** Can I add files recursively to my list of agenda files?
1658    :PROPERTIES:
1659    :CUSTOM_ID: set-agenda-files-recursively
1660    :END:
1662 Yes, you can use the library "find-lisp."
1664 : (load-library "find-lisp")
1665 : (setq org-agenda-files (find-lisp-find-files "~/org" "\.org$"))
1667 This will add all files ending in =org= in the directory "~/org"
1668 and all of its subdirectories to your list of agenda files.
1670 See [[http://thread.gmane.org/gmane.emacs.orgmode/8992][this thread]] on the mailing list for more information.
1672 ** Why does an item appearing at the wrong time of day in my agenda?
1673    :PROPERTIES:
1674    :CUSTOM_ID: agenda-wrong-time-of-day
1675    :END:
1677 When preparing the agenda view, org-mode scans each relevant headline
1678 for a time designation. This approach is very nice for adding
1679 free-form timestamps to an item for scheduling. Thus, either of the
1680 following work would work to schedule an item at 10:00am:
1682 #+begin_src org
1683 ,** 10:00am Get dried ice at the magic store
1684 ,   SCHEDULED: <2009-05-27 Wed>
1685 #+end_src
1687 #+begin_src org
1688 ,** Get dried ice at the magic store
1689 ,   SCHEDULED: <2009-05-27 Wed 10:00>
1690 #+end_src
1692 To enable this flexibility, org-mode scans the entire headline for
1693 time of day notation. A potential problem can arise if you use
1694 inactive timestamps in the headline to note when an item was created.
1695 For example,
1697 #+begin_src org
1698 ,** Get dried ice at the magic store [2009-05-26 Tue 12:58]
1699 ,   SCHEDULED: <2009-05-27 Wed>
1700 #+end_src
1702 Org mode would interpret the time in the inactive timestamp as a
1703 time-of-day indicator and the entry would appear in your agenda at
1704 12:58.
1706 If you would like to turn off the time-of-day search, you can
1707 configure the variable =org-agenda-search-headline-for-time= (requires
1708 org-mode >= 6.24).
1710 * Appointments/Diary
1711   :PROPERTIES:
1712   :CUSTOM_ID: Appointments/Diary
1713   :END:
1714 ** Is it possible to include entries from org-mode files into my emacs diary?
1715    :PROPERTIES:
1716    :CUSTOM_ID: include-entries-from-org-mode-files-into-emacs-diary
1717    :END:
1719    Since the org-mode agenda is much more powerful and can contain the
1720    diary, you should think twice before deciding to do this.  If you
1721    insist, however, integrating Org-mode information into the diary is
1722    possible.  You need to turn on /fancy diary display/ by setting in
1723    .emacs:
1725    : (add-hook 'diary-display-hook 'diary-fancy-display)
1727    Then include the following line into your ~/diary file, in
1728    order to get the entries from all files listed in the variable
1729    =org-agenda-files=
1731    : &%%(org-diary)
1733    You may also select specific files with
1735    : &%%(org-diary) ~/path/to/some/org-file.org
1736    : &%%(org-diary) ~/path/to/another/org-file.org
1738    If you now launch the calendar and press @<tt>d@</tt> to display a
1739    diary, the headlines of entries containing a timestamp, date range,
1740    schedule, or deadline referring to the selected date will be listed.
1741    Just like Org-mode's agenda view, the diary for /today/ contains
1742    additional entries for overdue deadlines and scheduled items.  See
1743    also the documentation of the =org-diary= function.  Under XEmacs, it
1744    is not possible to jump back from the diary to the org, this works
1745    only in the agenda buffer.
1746 ** I want to add my Org scheduled/deadlined entries in my diary!
1747    :PROPERTIES:
1748    :CUSTOM_ID: add-Org-scheduled/deadlined-entries-to-diary!
1749    :END:
1751   Put this in your ~/.diary:
1753   : &%%(org-diary :scheduled :timestamp :deadline)
1755 ** How can I set up automatic reminders based on Org information?
1756    :PROPERTIES:
1757    :CUSTOM_ID: automatic-reminders
1758    :END:
1760   See [[http://article.gmane.org/gmane.emacs.orgmode/5271][this post]] by N. Dokos on the list.
1761 ** How can I make =appt= notice my Org appointments?
1762    :PROPERTIES:
1763    :CUSTOM_ID: appt-notice-my-Org-appointments
1764    :END:
1766   : M-x org-agenda-to-appt RET
1768 ** How can I create more complex appointments in my org-files?
1769    :PROPERTIES:
1770    :CUSTOM_ID: diary-sexp-in-org-files
1771    :END:
1773 Org-mode's active timestamps work very well for scheduling individual
1774 or recurring appointments, such as:
1776 #+begin_src org
1777   ,* 8:00am Dentist appointment <2009-01-16 Fri>
1778 #+end_src
1781 #+begin_src org
1782   ,* Vacation
1783   ,  <2009-03-20 Fri>--<2009-04-01 Wed>
1784 #+end_src
1788 #+begin_src org
1789   ,* Weekly meeting with boss
1790   ,  <2009-01-20 Tue 14:00 +1w>
1791 #+end_src
1793 Sometimes, however, you need to set up more complicated recurring
1794 appointments. Org-mode has built-in support for many of
1795 [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Sexp-Diary-Entries.html][the
1796 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
1797 instance, that you teach a class that meets every Monday evening
1798 between February 16 and April 20, 2009. The way to enter this an
1799 org-mode file is:
1801 #+begin_src org
1802   ,** Class 7:00pm-9:00pm
1803   ,   <%%(and (= 1 (calendar-day-of-week date)) (diary-block 2 16 2009 4 20 2009))>
1804 #+end_src
1806 The expression above designates all Mondays that fall between February
1807 16 and April 20. How exactly does it work?
1809  - (and... :: Indicates that *both* of the conditions that follow have
1810           to be true.
1812    - (= 1 (calendar-day-of-week date)) :: Is the day of the week a
1813         Monday?
1815        - Note: the function calendar-day-of-week converts the date to the day of week
1816          expressed in numeric form, where 0 = Sunday, 1 = Monday, and so on.
1818    - (diary-block 2 16 2009 4 20 2009) :: Does the date fall between
1819         these two dates?
1821 You can make a sexp as complex as you like. If you wanted to omit a
1822 week because of holidays, for instance, you could add another
1823 condition to the sexp:
1825 #+begin_src org
1826   ,** Class 7:00pm-9:00pm
1827   ,   <%%(unless (diary-block 3 9 2009 3 13 2009) (and (= 1 (calendar-day-of-week date)) (diary-block 2 16 2009 4 20 2009)))>
1828 #+end_src
1830 The sexp above would omit Monday during the week of March 9, 2009. For
1831 another way to accomplish the same thing, see [[org-diary-class][this FAQ]].
1833 Another diary function commonly used for more complex scheduling is
1834 diary-float. For instance,
1836 #+begin_src org
1837   ,* Monthly meeting
1838   ,  <%%(diary-float t 3 3)>
1839 #+end_src
1841 ...would appear on the third Wednesday of every month.
1843 For more ideas on how to create diary special expressions, see [[http://www.emacswiki.org/cgi-bin/wiki/DiaryMode][this
1844 page on the Emacs wiki]].
1846 ** How can I schedule a weekly class that lasts for a limited period of time?
1847    :PROPERTIES:
1848    :CUSTOM_ID: org-diary-class
1849    :END:
1851 Org-mode offers a convenient diary sexp function for setting up a
1852 recurring appointment that lasts for a certain period of time, such as
1853 a class. It is called org-diary-class and it can be entered as
1854 follows:
1856 #+begin_src org
1857   ,** Class 7:00pm-9:00pm
1858   ,   <%%(org-diary-class 2 16 2009 4 20 2009 1 10)>
1859 #+end_src
1861 The function above schedules an appointment for every Monday (1)
1862 between February 16 and April 20, 2009, except for ISO week 10 (March
1863 1 to March 7).
1865 The function org-diary-class has the following format:
1867 : (org-diary-class M1 D1 Y1 M2 D2 Y2 DAYNAME &rest SKIP-WEEKS)
1869 M1/2, D1/2, and Y1/2 indicate the beginning and ending dates. Dayname
1870 takes the form of a number indicating the day of the week (0 = Sunday,
1871 1 = Monday, and so on...). In addition, one can add an optional
1872 argument SKIP-WEEKS to indicate weeks on the calendar that should be
1873 skipped. This argument should be expressed as an ISO week number. You
1874 can find the number by invoking emacs' built-in calendar (=M-x
1875 calendar=), navigating to the appropriate week, and typing =p c=
1876 (calendar-iso-print-date).
1878 ** How can I set an event to occur every day except Saturday and Sunday?
1880    #+begin_example
1881    ** Daily meeting
1882       <%%(memq (calendar-day-of-week date) '(1 2 3 4 5))>
1883    #+end_example
1885 * Export
1886   :PROPERTIES:
1887   :CUSTOM_ID: Export
1888   :END:
1889 ** Can I get TODO items exported to HTML as lists, rather than as headlines?
1890    :PROPERTIES:
1891    :CUSTOM_ID: export-TODO-items-as-lists
1892    :END:
1894    If you plan to use ASCII or HTML export, make sure things you want to
1895    be exported as item lists are level 4 at least, even if that does
1896    mean there is a level jump.  For example:
1898    : * Todays top priorities
1899    : **** TODO write a letter to xyz
1900    : **** TODO Finish the paper
1901    : **** Pick up kids at the school
1903    Alternatively, if you need a specific value for the heading/item
1904    transition in a particular file, use the =#+OPTIONS= line to
1905    configure the H switch.
1907    : #+OPTIONS:   H:2; ...
1909 ** Can I export only a single subtree?
1910    :PROPERTIES:
1911    :CUSTOM_ID: export-single-subtree
1912    :END:
1914    If you want to export a subtree, mark the subtree as region and then
1915    export.  Marking can be done with =C-c @ C-x C-x=, for example.
1917 ** How can I tell my calendar web application about appointments in my agenda files?
1919 Here is what you need to do:
1921 1. a script that calls Emacs in batch mode and produce a .ics file
1922 2. a script that uploads this .ics file somewhere on the web
1923 3. tell your webapp to fetch this .ics file on the web
1925 Here is the script I use for the first step:
1927 #+begin_src shell-script-mode
1928 #!/bin/bash
1930 /usr/local/bin/emacs --batch --eval \
1931 "(progn (load-file \"~/install/git/org-mode/org.el\") \
1932         (load-file \"~/elisp/config/org-batch-config.el\") \
1933         (setq org-combined-agenda-icalendar-file \"~/org/cal/org.ics\")
1934         (setq org-agenda-files (quote (\"~/org/bzg.org\"))))" \
1935     -f org-export-icalendar-combine-agenda-files
1936 #+end_src
1938 Depending on your configuration, you might change the load sequence.
1940 Here is the script I use for the second step:
1942 #+begin_src shell-script-mode
1943 #!/bin/bash
1944 /usr/bin/rsync -rtv ~/org/org.ics -e ssh me@my_server:/home/me/public_html/
1945 #+end_src
1947 Note: if you want to cron this rsync script, you will need to let
1948 =my_server= to know about your SSH public key.  Check [[http://troy.jdmz.net/rsync/index.html][this page]] as a
1949 starter.
1951 Now you can cron the two scripts above and your webapp will always be
1952 up to date with your Org agendas.
1954 Also see [[http://orgmode.org/org.html#Exporting-Agenda-Views][Exporting agenda views]] from Org manual.
1956 ** How can I get Mac OSX 10.3 iCal to import my Org-exported .ics files?
1957    :PROPERTIES:
1958    :CUSTOM_ID: iCal-import-ics-files-old
1959    :END:
1961    When using iCal under Apple MacOS X Tiger, you can create a new
1962    calendar /OrgMode/ (the default name for the calendar created by =C-c
1963    C-e c=, see the variables =org-icalendar-combined-name= and
1964    =org-combined-agenda-icalendar-file=).  Then set Org-mode to
1965    overwrite the corresponding file /~/Library/Calendars/OrgMode.ics/.
1966    You may even use AppleScript to make iCal re-read the calendar files
1967    each time a new version of /OrgMode.ics/ is produced.  Here is the
1968    setup needed for this:
1970    : (setq org-combined-agenda-icalendar-file
1971    :     "~/Library/Calendars/OrgMode.ics")
1972    : (add-hook 'org-after-save-iCalendar-file-hook
1973    :  (lambda ()
1974    :   (shell-command
1975    :    "osascript -e 'tell application \"iCal\" to reload calendars'")))
1977 ** How can I get Mac OSX 10.4 or later iCal to import my Org-exported .ics files?
1978    :PROPERTIES:
1979    :CUSTOM_ID: iCal-import-ics-files-new
1980    :END:
1982    For Mac OS X 10.4, you need to write the ics file to
1983    =/Library/WebServer/Documents/= and then subscribe iCalendar to
1984    =http: //localhost/orgmode.ics=
1986 ** How can I remove timestamps and todo keywords from my exported file?
1987    :PROPERTIES:
1988    :CUSTOM_ID: export-options-remove-timestamps
1989    :END:
1991 You can place an options line at the top of your org file:
1993 : #+OPTIONS: <:nil todo:nil
1995 There is a whole host of export options you can set with an in-buffer
1996 options or via global variables. See [[http://orgmode.org/manual/Export-options.html#Export-options][this section]] of the manual for a
1997 full list.
1999 ** How can I preserve faces when I export an agenda from the command line?
2000    :PROPERTIES:
2001    :CUSTOM_ID: preserving-faces-during-batch-export
2002    :END:
2004 Normally, when you export an org file or an agenda view from within
2005 emacs, htmlize will convert your face definitions to direct color css
2006 styles inlined into each =<span>= object, resulting in an HTML output
2007 that preserves the general look of your Org buffers and agenda views.
2009 Let's say you generate an export from the command line, such as the
2010 following:
2012 : emacs -batch -l ~/.emacs -eval '(org-batch-agenda "e")'
2016 : emacs -batch -l ~/.emacs -eval '(org-publish-all)'
2018 In such an instance, the exported HTML will contain only very basic
2019 color styles. The reason is that when Emacs is run in batch mode, it
2020 does not have a display and therefore only rudimentary face
2021 definitions.  If you'd like to use more complex styles, you'll have to
2022 make sure that the export process only assigns classes instead of
2023 direct color values.  This can be done by binding the variable
2024 =org-export-htmlize-output-style= to =css= for the duration of the
2025 export, for example with
2027 : emacs -batch -l ~/.emacs
2028 :   -eval '(let ((org-export-htmlize-generate-css (quote css)))
2029 :            (org-batch-agenda "e"))'
2031 Then you can use a style file to make these classes look any way you
2032 like.  To generate face definitions for a CSS file based on any faces
2033 you are currently using in Emacs, you can use the following command:
2035 : M-x org-export-htmlize-generate-css RET
2037 This will generate a =<style>...</style>= section, the content of
2038 which you can add to your style file.
2040 ** How can I avoid dark color background when exporting agenda to ps format?
2041    :PROPERTIES:
2042    :CUSTOM_ID: avoiding-dark-background-when-exporting-agenda
2043    :END:
2045 Add this to your .emacs and evaluate it.
2047 #+BEGIN_SRC emacs-lisp
2048   (setq org-agenda-exporter-settings
2049         '((ps-print-color-p 'black-white)))
2050 #+END_SRC
2052 ** How can I get colored source code when exporting to LaTeX?
2053    :PROPERTIES:
2054    :CUSTOM_ID: fontified_source_code_w_latex
2055    :END:
2057 As of Sun Aug 9 2009 the "current" version of Org-mode (see
2058 [[keeping-current-with-Org-mode-development]]) supports exporting source
2059 code to LaTeX using the listings package.
2061 To turn on listing export add the following to your Org-mode
2062 customization.
2063 #+begin_src emacs-lisp
2064   ;; requite org-latex so that the following variables are defined
2065   (require 'org-latex)
2066   
2067   ;; tell org to use listings
2068   (setq org-export-latex-listings t)
2069   
2070   ;; you must include the listings package
2071   (add-to-list 'org-export-latex-packages-alist '("" "listings"))
2072   
2073   ;; if you want colored source code then you need to include the color package
2074   (add-to-list 'org-export-latex-packages-alist '("" "color"))
2075 #+end_src
2077 The listings package will now be used to fontify source code in your
2078 LaTeX documents.  By default listings will not color any of your
2079 source code.  If you would like to set colors for keywords and
2080 comments in your latex documents you can do so using LaTeX directives
2081 like the following.
2082 #+begin_src latex
2083   \lstset{keywordstyle=\color{blue},
2084     commentstyle=\color{red},
2085     stringstyle=\color{green}
2086   }
2087 #+end_src
2089 of if you want to get even fancier with your colors you can try
2090 something like the following
2091 #+begin_src latex
2092 \definecolor{keywords}{RGB}{255,0,90}
2093 \definecolor{comments}{RGB}{60,179,113}
2094 \definecolor{fore}{RGB}{249,242,215}
2095 \definecolor{back}{RGB}{51,51,51}
2096 \lstset{
2097   basicstyle=\color{fore},
2098   keywordstyle=\color{keywords},  
2099   commentstyle=\color{comments},
2100   backgroundcolor=\color{back}
2102 #+end_src
2104 For more complex listings use cases consult the [[ftp://ftp.tex.ac.uk/tex-archive/macros/latex/contrib/listings/listings.pdf][listings manual]].
2106 ** How can I export to Latex Beamer
2107    :PROPERTIES:
2108    :CUSTOM_ID: beamer
2109    :END:
2110 The latex [[http://latex-beamer.sourceforge.net/][Beamer Class]] is a useful class for generating slide shows.
2111 The following can be used to export Org-mode documents to LaTeX
2112 beamer.
2114 Add the following to your Emacs initialization file.
2115 #+begin_src emacs-lisp
2116   (unless (boundp 'org-export-latex-classes)
2117     (setq org-export-latex-classes nil))
2118   (add-to-list 'org-export-latex-classes
2119                '("beamer"
2120                  "\\documentclass[11pt]{beamer}\n\\usepackage[utf8]{inputenc}\n\\usepackage[T1]{fontenc}\n\\usepackage{hyperref}\n\\usepackage{verbatim}\n"
2121                  ("\\section{%s}" . "\\section*{%s}")
2122                  ("\\begin{frame}\\frametitle{%s}" "\\end{frame}"
2123                   "\\begin{frame}\\frametitle{%s}" "\\end{frame}")))
2124 #+end_src
2126 Then by placing
2127 : #+LaTeX_CLASS: beamer
2128 in the header of your Org-mode document it will automatically export
2129 to the Beamer document class on LaTeX export.  With the above
2130 configuration top-level headers will be mapped to sections in the
2131 Beamer document, second-level headers will be mapped to frames, and
2132 lower level headlines will be mapped to itemize objects.
2134 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
2135 Thomas Dye]].  For a much more complex Beamer setup see the [[http://article.gmane.org/gmane.emacs.orgmode/17767/match=beamer+dokos][email by
2136 Thomas Dye]].
2138 ** How can I use RefTeX in Org-mode files for LaTeX export and in Org-babel LaTeX code blocks?
2140 [[http://www.gnu.org/software/auctex/reftex.html][RefTeX]] is an indispensable tool for the author of LaTeX documents.  It
2141 aids in creation of bibliographies, cross-references, indexes, and
2142 glossaries.  RefTeX understands the structure of multi-file LaTeX
2143 documents and is able to collect from them information about the
2144 location(s) of external data stores used in creation of the final
2145 document.  RefTeX was written by Carsten Dominik and is currently
2146 being maintained by the [[http://www.gnu.org/software/auctex/index.html][AucTeX]] project.
2148 *** Using RefTeX In Org-mode Files for LaTeX Export
2149 In Org-mode files for LaTeX export, the trick is to find a way to tell
2150 RefTeX the locations of external data stores.  One way is to set the
2151 variable, =reftex-default-bibliography=.  Add lines like these to
2152 .emacs:
2154 #+begin_src emacs-lisp 
2155   (setq reftex-default-bibliography
2156         (quote
2157          ("default.bib" "other-default.bib")))       
2158 #+end_src
2160 In practice, this is a limited solution and the
2161 typical user will want to pass this information on a per-file basis.
2162 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
2163 Braindump]].  
2165 The first solution, proposed by Mario, enables the RefTeX citation
2166 function in Org-mode.  Add these lines to .emacs:
2168 #+begin_src emacs-lisp
2169   (defun org-mode-reftex-setup ()
2170     (load-library "reftex")
2171     (and (buffer-file-name)
2172          (file-exists-p (buffer-file-name))
2173          (reftex-parse-all))
2174     (define-key org-mode-map (kbd "C-c )") 'reftex-citation))
2175   (add-hook 'org-mode-hook 'org-mode-reftex-setup)
2176 #+end_src
2178 Then add the following lines anywhere in the Org-mode file (Org-mode
2179 will recognize them as LaTeX commands):
2181 #+begin_src org
2182 \bibliographystyle{plain}
2183 \bibliography{BIB-NAME}
2184 #+end_src
2186 With this setup, =C-c )= will invoke =reftex-citation= which will
2187 insert a reference in the usual way:
2189 #+begin_src org
2190 * test reftex
2192 This is a citation \cite{tierney90}.
2194 \bibliographystyle{plain}
2195 \bibliography{tsd}
2196 #+end_src
2198 This Org-mode file will export the following LaTeX output:
2200 #+begin_src latex :exports code
2201   % Created 2010-03-22 Mon 14:34
2202   \documentclass[11pt,letter]{article}
2203   \usepackage[utf8]{inputenc}
2204   \usepackage[T1]{fontenc}
2205   \usepackage{hyperref}
2206   
2207   \title{test.org}
2208   \author{Tom Dye}
2209   \date{2010-03-22 Mon}
2210   
2211   \begin{document}
2212   
2213   \maketitle
2214   
2215   \setcounter{tocdepth}{3}
2216   \tableofcontents
2217   \vspace*{1cm}
2218   
2219   \section{test reftex}
2220   \label{sec-1}
2221   
2222   
2223   This is a citation \cite{tierney90}.
2224   
2225   \bibliographystyle{plain}
2226   \bibliography{tsd}
2227   
2228   \end{document}
2229 #+end_src
2232 A second solution, to activate the RefTeX minor mode on a per-file
2233 basis, was posted by Kevin Brubeck Unhammer in response to this idea.
2234 Add the following lines to .emacs:
2236 #+begin_src emacs-lisp
2237   (add-hook ‘org-mode-hook
2238              (lambda ()
2239                (if (member “WRITE” org-todo-keywords-1)
2240                    (org-mode-article-modes))))
2241 #+end_src
2243 where =org-mode-article-modes= is defined as follows:
2245 #+begin_src emacs-lisp
2246   (defun org-mode-article-modes ()
2247     (reftex-mode t)
2248     (bib-cite-minor-mode t)
2249     (and (buffer-file-name)
2250          (file-exists-p (buffer-file-name))
2251          (reftex-parse-all)))
2252 #+end_src
2254 Add the =\bibliographystyle{}= and =\bibliography{}= lines to the
2255 Org-mode file as before and define a TODO keyword, =WRITE=, perhaps
2256 like this:
2258 #+begin_src org
2259   ,#+TODO: TODO(t) STARTED(s) WRITE | DONE(d) DEFERRED(f)
2260 #+end_src
2262 With this setup, you insert a citation with =M-x reftex-citation RET=.
2264 *** Using RefTeX in Org-babel LaTeX Code Blocks
2266 In Org-babel LaTeX code blocks, the trick is to give RefTeX access to
2267 information in other Org-babel LaTeX code blocks.  If you use an Emacs
2268 starter kit where configuration information is held in Org-mode files,
2269 then the second solution is preferable because you won't be asked for
2270 a master file when Emacs is started.  For this reason, the second
2271 solution is modified for use with Org-babel latex code blocks.  No
2272 key-binding is needed here because Org-babel code blocks are edited
2273 within the usual AucTeX environment.
2275 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]])
2276 #+begin_src emacs-lisp
2277   (defun org-mode-article-modes ()
2278     (reftex-mode t)
2279     (and (buffer-file-name)
2280          (file-exists-p (buffer-file-name))
2281          (reftex-parse-all)))
2282   
2283   (add-hook 'org-mode-hook
2284             (lambda ()
2285               (if (member "REFTEX" org-todo-keywords-1)
2286                   (org-mode-article-modes))))
2287 #+end_src
2289 Then add a line like the following line to the top of your org-mode file:
2291 #+begin_src org
2292   ,#+TODO: TODO(t) STARTED(s) | DONE(d) DEFERRED(f) REFTEX
2293 #+end_src
2295 When you open an org-mode file with a line like this, RefTeX will
2296 prompt for the master .tex file, which will be parsed in the usual
2297 way.  This means that the .tex file should already exist, perhaps by
2298 tangling the LaTeX preamble and postamble, before
2299 =org-mode-article-modes= is activated for the Org-mode file.
2301 * COMMENT HTML style specifications
2303 #+begin_src emacs-lisp
2304   (defun org-faq-make-target ()
2305     "Make hard target for current headline."
2306     (interactive)
2307     (if (not (org-on-heading-p))
2308         (error "Not on a headline"))
2309     (let ((h (org-trim (org-get-heading 'no-tags))))
2310       (if (string-match "[ \t]*\\?\\'" h)
2311           (setq h (replace-match "" t t h)))
2312       (while (string-match "[ \t]+" h)
2313         (setq h (replace-match "-" t t h)))
2314       (org-entry-put nil "CUSTOM_ID" h)))
2315 #+end_src