annotate lisp/textmodes/org.el @ 70015:8676ce0ffe86

*** empty log message ***
author Carsten Dominik <dominik@science.uva.nl>
date Thu, 13 Apr 2006 14:57:46 +0000
parents c49248393916
children b47f8cdc0b75
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1 ;;; org.el --- Outline-based notes management and organize
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
2 ;; Carstens outline-mode for keeping track of everything.
68648
067115a6e738 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 68480
diff changeset
3 ;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
4 ;;
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: Carsten Dominik <dominik at science dot uva dot nl>
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6 ;; Keywords: outlines, hypermedia, calendar, wp
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
8 ;; Version: 4.23
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
9 ;;
58794
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
10 ;; This file is part of GNU Emacs.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11 ;;
58794
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; any later version.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
58794
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7cae75ad3466 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 58792
diff changeset
20 ;; GNU General Public License for more details.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
65638
e274642bf5d5 Update FSF street address; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 65583
diff changeset
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
e274642bf5d5 Update FSF street address; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 65583
diff changeset
25 ;; Boston, MA 02110-1301, USA.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;;; Commentary:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; project planning with a fast and effective plain-text system.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; Org-mode develops organizational tasks around a NOTES file that contains
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
34 ;; information about projects as plain text. Org-mode is implemented on top
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
35 ;; of outline-mode - ideal to keep the content of large files well structured.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
36 ;; It supports ToDo items, deadlines and time stamps, which can be extracted
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
37 ;; to create a daily/weekly agenda that also integrates the diary of the Emacs
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
38 ;; calendar. Tables are easily created with a built-in table editor. Plain
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
39 ;; text URL-like links connect to websites, emails (VM, RMAIL, WANDERLUST),
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
40 ;; Usenet messages (Gnus), BBDB entries, and any files related to the
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
41 ;; projects. For printing and sharing of notes, an Org-mode file (or a part
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
42 ;; of it) can be exported as a structured ASCII file, or as HTML.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; Installation
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; ------------
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
46 ;; If Org-mode is part of the Emacs distribution or an XEmacs package, you
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
47 ;; only need to copy the following lines to your .emacs file. The last two
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
48 ;; lines define *global* keys for the commands `org-store-link' and
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
49 ;; `org-agenda' - please choose suitable keys yourself.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;;
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
51 ;; (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
52 ;; (define-key global-map "\C-cl" 'org-store-link)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
53 ;; (define-key global-map "\C-ca" 'org-agenda)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
54 ;;
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
55 ;; If you have downloaded Org-mode from the Web, you must byte-compile
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
56 ;; org.el and put it on your load path. In addition to the Emacs Lisp
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
57 ;; lines above, you also need to add the following lines to .emacs:
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; (autoload 'org-mode "org" "Org mode" t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; (autoload 'org-diary "org" "Diary entries from Org mode")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;; (autoload 'org-agenda "org" "Multi-file agenda from Org mode" t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 ;; (autoload 'org-store-link "org" "Store a link to the current location" t)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
63 ;; (autoload 'orgtbl-mode "org" "Org tables as a minor mode" t)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
64 ;; (autoload 'turn-on-orgtbl "org" "Org tables as a minor mode")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;;
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
66 ;; This setup will put all files with extension ".org" into Org-mode. As
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
67 ;; an alternative, make the first line of a file look like this:
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 ;; MY PROJECTS -*- mode: org; -*-
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ;; which will select Org-mode for this buffer no matter what the file's
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;; name is.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ;;
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ;; Documentation
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ;; -------------
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
76 ;; The documentation of Org-mode can be found in the TeXInfo file. The
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
77 ;; distribution also contains a PDF version of it. At the homepage of
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
78 ;; Org-mode, you can read the same text online as HTML. There is also an
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
79 ;; excellent reference card made by Philip Rooke. This card can be found
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
80 ;; in the etc/ directory of Emacs 22.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 ;;
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
82 ;; Changes since version 4.00:
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
83 ;; ---------------------------
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
84 ;; Version 4.23
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
85 ;; - Bug fixes.
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
86 ;;
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
87 ;; Version 4.22
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
88 ;; - Bug fixes.
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
89 ;; - In agenda buffer, mouse-1 no longer follows link.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
90 ;; See `org-agenda-mouse-1-follows-link' and `org-mouse-1-follows-link'.
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
91 ;;
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
92 ;; Version 4.20
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
93 ;; - Links use now the [[link][description]] format by default.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
94 ;; When inserting links, the user is prompted for a description.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
95 ;; - If a link has a description, only the description is displayed
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
96 ;; the link part is hidden. Use C-c C-l to edit the link part.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
97 ;; - TAGS are now bold, but in the same color as the headline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
98 ;; - The width of a table column can be limited by using a field "<N>".
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
99 ;; - New structure for the customization tree.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
100 ;; - Bug fixes.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
101 ;;
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
102 ;; Version 4.13
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
103 ;; - The list of agenda files can be maintainted in an external file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
104 ;; - Bug fixes.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
105 ;;
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
106 ;; Version 4.12
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
107 ;; - Templates for remember buffer. Note that the remember setup changes.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
108 ;; To set up templates, see `org-remember-templates'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
109 ;; - The time in new time stamps can be rounded, see new option
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
110 ;; `org-time-stamp-rounding-minutes'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
111 ;; - Bug fixes (there are *always* more bugs).
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
112 ;;
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
113 ;; Version 4.10
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
114 ;; - Bug fixes.
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
115 ;;
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
116 ;; Version 4.09
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
117 ;; - Bug fixes.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
118 ;; - Small improvements to font-lock support.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
119 ;; - MHE support finalized.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
120 ;;
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
121 ;; Version 4.08
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
122 ;; - Bug fixes.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
123 ;; - Improved MHE support
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
124 ;;
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
125 ;; Version 4.07
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
126 ;; - Bug fixes.
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
127 ;; - Leading stars in headlines can be hidden, so make the outline look
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
128 ;; cleaner.
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
129 ;; - Mouse-1 can be used to follow links.
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
130 ;;
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
131 ;; Version 4.06
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
132 ;; - HTML exporter treats targeted internal links.
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
133 ;; - Bug fixes.
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
134 ;;
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
135 ;; Version 4.05
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
136 ;; - Changes to internal link system (thanks to David Wainberg for ideas).
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
137 ;; - in-file links: [[Search String]] instead of <file:::Search String>
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
138 ;; - automatic links to "radio targets".
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
139 ;; - CamelCase not longer active by default, configure org-activate-camels
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
140 ;; if you want to turn it back on.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
141 ;; - After following a link, `C-c &' jumps back to it.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
142 ;; - MH-E link support (thanks to Thomas Baumann).
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
143 ;; - Special table lines are no longer exported.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
144 ;; - Bug fixes and minor improvements.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
145 ;;
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
146 ;; Version 4.04
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
147 ;; - Cleanup tags display in agenda.
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
148 ;; - Bug fixes.
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
149 ;;
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
150 ;; Version 4.03
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
151 ;; - Table alignment fixed for use with wide characters.
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
152 ;; - `C-c -' leaves cursor in current table line.
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
153 ;; - The current TAG can be incorporated into the agenda prefix.
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
154 ;; See option `org-agenda-prefix-format' for details.
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
155 ;;
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
156 ;; Version 4.02
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
157 ;; - Minor bug fixes and improvements around tag searches.
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
158 ;; - XEmacs compatibility fixes.
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
159 ;;
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
160 ;; Version 4.01
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
161 ;; - Tags can also be set remotely from agenda buffer.
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
162 ;; - Boolean logic for tag searches.
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
163 ;; - Additional agenda commands can be configured through the variable
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
164 ;; `org-agenda-custom-commands'.
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
165 ;; - Minor bug fixes.
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
166 ;;
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 ;;; Code:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
169 (eval-when-compile
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
170 (require 'cl)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
171 (require 'calendar))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 (require 'outline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 (require 'time-date)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 (require 'easymenu)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
176 (defvar calc-embedded-close-formula) ; defined by the calc package
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
177 (defvar calc-embedded-open-formula) ; defined by the calc package
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
178 (defvar font-lock-unfontify-region-function) ; defined by font-lock.el
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
179
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 ;;; Customization variables
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
182 (defvar org-version "4.22"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 "The version number of the file org.el.")
59596
8e7a2f6f9fa7 (org-version): Unnecessary prefix arg removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 59547
diff changeset
184 (defun org-version ()
8e7a2f6f9fa7 (org-version): Unnecessary prefix arg removed.
Carsten Dominik <dominik@science.uva.nl>
parents: 59547
diff changeset
185 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 (message "Org-mode version %s" org-version))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
188 ;; The following constant is for compatibility with different versions
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
189 ;; of outline.el.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 (defconst org-noutline-p (featurep 'noutline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 "Are we using the new outline mode?")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
192 (defconst org-xemacs-p (featurep 'xemacs))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
193 (defconst org-format-transports-properties-p
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
194 (let ((x "a"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
195 (add-text-properties 0 1 '(test t) x)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
196 (get-text-property 0 'test (format "%s" x)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
197 "Does format transport text properties?")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 (defgroup org nil
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
200 "Outline-based notes management and organizer."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 :tag "Org"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 :group 'outlines
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 :group 'hypermedia
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 :group 'calendar)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 (defgroup org-startup nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 "Options concerning startup of Org-mode."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 :tag "Org Startup"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
211 (defcustom org-startup-folded t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
212 "Non-nil means, entering Org-mode will switch to OVERVIEW.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
213 This can also be configured on a per-file basis by adding one of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
214 the following lines anywhere in the buffer:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
215
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
216 #+STARTUP: fold
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
217 #+STARTUP: nofold
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
218 #+STARTUP: content"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
219 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
220 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
221 (const :tag "nofold: show all" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
222 (const :tag "fold: overview" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
223 (const :tag "content: all headlines" content)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
224
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
225 (defcustom org-startup-truncated t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
226 "Non-nil means, entering Org-mode will set `truncate-lines'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
227 This is useful since some lines containing links can be very long and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
228 uninteresting. Also tables look terrible when wrapped."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
229 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
230 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
231
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
232 (defcustom org-startup-align-all-tables nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
233 "Non-nil means, align all tables when visiting a file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
234 This is useful when the column width in tables is forced with <N> cookies
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
235 in table fields. Such tables will look correct only after the first re-align."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
236 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
237 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
238
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
239 (defcustom org-startup-with-deadline-check nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
240 "Non-nil means, entering Org-mode will run the deadline check.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
241 This means, if you start editing an org file, you will get an
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
242 immediate reminder of any due deadlines.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
243 This can also be configured on a per-file basis by adding one of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
244 the following lines anywhere in the buffer:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
245
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
246 #+STARTUP: dlcheck
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
247 #+STARTUP: nodlcheck"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
248 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
249 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
250
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
251 (defcustom org-insert-mode-line-in-empty-file nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
252 "Non-nil means insert the first line setting Org-mode in empty files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
253 When the function `org-mode' is called interactively in an empty file, this
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
254 normally means that the file name does not automatically trigger Org-mode.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
255 To ensure that the file will always be in Org-mode in the future, a
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
256 line enforcing Org-mode will be inserted into the buffer, if this option
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
257 has been set."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
258 :group 'org-startup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
259 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
260
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
261 (defcustom org-CUA-compatible nil
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
262 "Non-nil means use alternative key bindings for S-<cursor movement>.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
263 Org-mode used S-<cursor movement> for changing timestamps and priorities.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
264 S-<cursor movement> is also used for example by `CUA-mode' to select text.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
265 If you want to use Org-mode together with `CUA-mode', Org-mode needs to use
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
266 alternative bindings. Setting this variable to t will replace the following
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
267 keys both in Org-mode and in the Org-agenda buffer.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
268
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
269 S-RET -> C-S-RET
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
270 S-up -> M-p
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
271 S-down -> M-n
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
272 S-left -> M--
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
273 S-right -> M-+
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
274
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
275 If you do not like the alternative keys, take a look at the variable
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
276 `org-disputed-keys'.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
277
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
278 This option is only relevant at load-time of Org-mode. Changing it requires
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
279 a restart of Emacs to become effective."
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
280 :group 'org-startup
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
281 :type 'boolean)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
282
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
283 (defvar org-disputed-keys
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
284 '((S-up [(shift up)] [(meta ?p)])
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
285 (S-down [(shift down)] [(meta ?n)])
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
286 (S-left [(shift left)] [(meta ?-)])
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
287 (S-right [(shift right)] [(meta ?+)])
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
288 (S-return [(shift return)] [(control shift return)]))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
289 "Keys for which Org-mode and other modes compete.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
290 This is an alist, cars are symbols for lookup, 1st element is the default key,
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
291 second element will be used when `org-CUA-compatible' is t.")
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
292
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
293 (defun org-key (key)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
294 "Select a key according to `org-CUA-compatible'."
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
295 (nth (if org-CUA-compatible 2 1)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
296 (or (assq key org-disputed-keys)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
297 (error "Invalid Key %s in `org-key'" key))))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
298
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
299 (defcustom org-ellipsis nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
300 "The ellipsis to use in the Org-mode outline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
301 When nil, just use the standard three dots. When a string, use that instead,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
302 and just in Org-mode (which will then use its own display table).
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
303 Changing this requires executing `M-x org-mode' in a buffer to become
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
304 effective."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 :group 'org-startup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
306 :type '(choice (const :tag "Default" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
307 (string :tag "String" :value "...#")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
308
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
309 (defvar org-display-table nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
310 "The display table for org-mode, in case `org-ellipsis' is non-nil.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 (defgroup org-keywords nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
313 "Keywords in Org-mode."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 :tag "Org Keywords"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 (defcustom org-deadline-string "DEADLINE:"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 "String to mark deadline entries.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 A deadline is this string, followed by a time stamp. Should be a word,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 terminated by a colon. You can insert a schedule keyword and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 a timestamp with \\[org-deadline].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 Changes become only effective after restarting Emacs."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 :group 'org-keywords
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 (defcustom org-scheduled-string "SCHEDULED:"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 "String to mark scheduled TODO entries.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 A schedule is this string, followed by a time stamp. Should be a word,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 terminated by a colon. You can insert a schedule keyword and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 a timestamp with \\[org-schedule].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 Changes become only effective after restarting Emacs."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332 :group 'org-keywords
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
335 (defcustom org-closed-string "CLOSED:"
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
336 "String used as the prefix for timestamps logging closing a TODO entry."
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
337 :group 'org-keywords
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
338 :type 'string)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
339
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 (defcustom org-comment-string "COMMENT"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 "Entries starting with this keyword will never be exported.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 An entry can be toggled between COMMENT and normal with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 \\[org-toggle-comment].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 Changes become only effective after restarting Emacs."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 :group 'org-keywords
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
348 (defcustom org-quote-string "QUOTE"
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
349 "Entries starting with this keyword will be exported in fixed-width font.
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
350 Quoting applies only to the text in the entry following the headline, and does
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
351 not extend beyond the next headline, even if that is lower level.
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
352 An entry can be toggled between QUOTE and normal with
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
353 \\[org-toggle-fixed-width-section]."
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
354 :group 'org-keywords
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
355 :type 'string)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
356
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 (defgroup org-structure nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
358 "Options concerning the general structure of Org-mode files."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 :tag "Org Structure"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
362 (defgroup org-cycle nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
363 "Options concerning visibility cycling in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
364 :tag "Org Cycle"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
365 :group 'org-structure)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
366
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
367 (defcustom org-cycle-emulate-tab t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
368 "Where should `org-cycle' emulate TAB.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
369 nil Never
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
370 white Only in completely white lines
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
371 t Everywhere except in headlines"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
372 :group 'org-cycle
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
373 :type '(choice (const :tag "Never" nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
374 (const :tag "Only in completely white lines" white)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
375 (const :tag "Everywhere except in headlines" t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
376 ))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
377
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
378 (defcustom org-cycle-hook '(org-optimize-window-after-visibility-change)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
379 "Hook that is run after `org-cycle' has changed the buffer visibility.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
380 The function(s) in this hook must accept a single argument which indicates
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
381 the new state that was set by the most recent `org-cycle' command. The
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
382 argument is a symbol. After a global state change, it can have the values
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
383 `overview', `content', or `all'. After a local state change, it can have
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
384 the values `folded', `children', or `subtree'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
385 :group 'org-cycle
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
386 :type 'hook)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
387
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
388 (defgroup org-edit-structure nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
389 "Options concerning structure editing in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
390 :tag "Org Edit Structure"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
391 :group 'org-structure)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
392
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
393 (defcustom org-odd-levels-only nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
394 "Non-nil means, skip even levels and only use odd levels for the outline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
395 This has the effect that two stars are being added/taken away in
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
396 promotion/demotion commands. It also influences how levels are
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
397 handled by the exporters.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
398 Changing it requires restart of `font-lock-mode' to become effective
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
399 for fontification also in regions already fontified."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
400 :group 'org-edit-structure
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
401 :group 'org-font-lock
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
402 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
403
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
404 (defcustom org-adapt-indentation t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
405 "Non-nil means, adapt indentation when promoting and demoting.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
406 When this is set and the *entire* text in an entry is indented, the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
407 indentation is increased by one space in a demotion command, and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
408 decreased by one in a promotion command. If any line in the entry
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
409 body starts at column 0, indentation is not changed at all."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
410 :group 'org-edit-structure
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
411 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
412
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
413 (defcustom org-enable-fixed-width-editor t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
414 "Non-nil means, lines starting with \":\" are treated as fixed-width.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
415 This currently only means, they are never auto-wrapped.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
416 When nil, such lines will be treated like ordinary lines.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
417 See also the QUOTE keyword."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
418 :group 'org-edit-structure
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
419 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
420
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
421 (defgroup org-sparse-trees nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
422 "Options concerning sparse trees in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
423 :tag "Org Sparse Trees"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
424 :group 'org-structure)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
425
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
426 (defcustom org-highlight-sparse-tree-matches t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
427 "Non-nil means, highlight all matches that define a sparse tree.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
428 The highlights will automatically disappear the next time the buffer is
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
429 changed by an edit command."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
430 :group 'org-sparse-trees
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
431 :type 'boolean)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
432
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
433 (defcustom org-show-hierarchy-above t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
434 "Non-nil means, show full hierarchy when showing a spot in the tree.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
435 Turning this off makes sparse trees more compact, but also less clear."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
436 :group 'org-sparse-trees
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
437 :type 'boolean)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
438
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
439 (defcustom org-show-following-heading t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
440 "Non-nil means, show heading following match in `org-occur'.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
441 When doing an `org-occur' it is useful to show the headline which
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
442 follows the match, even if they do not match the regexp. This makes it
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
443 easier to edit directly inside the sparse tree. However, if you use
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
444 `org-occur' mainly as an overview, the following headlines are
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
445 unnecessary clutter."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
446 :group 'org-sparse-trees
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
447 :type 'boolean)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
448
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
449 (defcustom org-occur-hook '(org-first-headline-recenter)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
450 "Hook that is run after `org-occur' has constructed a sparse tree.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
451 This can be used to recenter the window to show as much of the structure
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
452 as possible."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
453 :group 'org-sparse-trees
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
454 :type 'hook)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
455
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
456 (defgroup org-plain-lists nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
457 "Options concerning plain lists in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
458 :tag "Org Plain lists"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
459 :group 'org-structure)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
460
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
461 (defcustom org-cycle-include-plain-lists nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
462 "Non-nil means, include plain lists into visibility cycling.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
463 This means that during cycling, plain list items will *temporarily* be
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
464 interpreted as outline headlines with a level given by 1000+i where i is the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
465 indentation of the bullet. In all other operations, plain list items are
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
466 not seen as headlines. For example, you cannot assign a TODO keyword to
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
467 such an item."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
468 :group 'org-plain-lists
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
469 :type 'boolean)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
470
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
472 (defcustom org-plain-list-ordered-item-terminator t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
473 "The character that makes a line with leading number an ordered list item.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
474 Valid values are ?. and ?\). To get both terminators, use t. While
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
475 ?. may look nicer, it creates the danger that a line with leading
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
476 number may be incorrectly interpreted as an item. ?\) therefore is
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
477 the safe choice."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
478 :group 'org-plain-lists
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
479 :type '(choice (const :tag "dot like in \"2.\"" ?.)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
480 (const :tag "paren like in \"2)\"" ?\))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
481 (const :tab "both" t)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
482
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
483 (defcustom org-auto-renumber-ordered-lists t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
484 "Non-nil means, automatically renumber ordered plain lists.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
485 Renumbering happens when the sequence have been changed with
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
486 \\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands,
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
487 use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
488 :group 'org-plain-lists
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
489 :type 'boolean)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
490
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
491 (defgroup org-archive nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
492 "Options concerning archiving in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
493 :tag "Org Archive"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
494 :group 'org-structure)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
495
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
496 (defcustom org-archive-location "%s_archive::"
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
497 "The location where subtrees should be archived.
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
498 This string consists of two parts, separated by a double-colon.
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
499
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
500 The first part is a file name - when omitted, archiving happens in the same
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
501 file. %s will be replaced by the current file name (without directory part).
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
502 Archiving to a different file is useful to keep archived entries from
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
503 contributing to the Org-mode Agenda.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
504
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
505 The part after the double colon is a headline. The archived entries will be
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
506 filed under that headline. When omitted, the subtrees are simply filed away
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
507 at the end of the file, as top-level entries.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
508
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
509 Here are a few examples:
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
510 \"%s_archive::\"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
511 If the current file is Projects.org, archive in file
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
512 Projects.org_archive, as top-level trees. This is the default.
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
513
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
514 \"::* Archived Tasks\"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
515 Archive in the current file, under the top-level headline
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
516 \"* Archived Tasks\".
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
517
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
518 \"~/org/archive.org::\"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
519 Archive in file ~/org/archive.org (absolute path), as top-level trees.
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
520
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
521 \"basement::** Finished Tasks\"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
522 Archive in file ./basement (relative path), as level 3 trees
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
523 below the level 2 heading \"** Finished Tasks\".
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
524
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
525 You may set this option on a per-file basis by adding to the buffer a
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
526 line like
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
527
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
528 #+ARCHIVE: basement::** Finished Tasks"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
529 :group 'org-archive
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
530 :type 'string)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
531
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
532 (defcustom org-archive-mark-done t
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
533 "Non-nil means, mark archived entries as DONE."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
534 :group 'org-archive
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
535 :type 'boolean)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
536
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
537 (defcustom org-archive-stamp-time t
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
538 "Non-nil means, add a time stamp to archived entries.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
539 The time stamp will be added directly after the TODO state keyword in the
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
540 first line, so it is probably best to use this in combinations with
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
541 `org-archive-mark-done'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
542 :group 'org-archive
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 (defgroup org-table nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 "Options concerning tables in Org-mode."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547 :tag "Org Table"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
550 (defcustom org-enable-table-editor 'optimized
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 "Non-nil means, lines starting with \"|\" are handled by the table editor.
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
552 When nil, such lines will be treated like ordinary lines.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
553
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
554 When equal to the symbol `optimized', the table editor will be optimized to
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
555 do the following:
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
556 - Use automatic overwrite mode in front of whitespace in table fields.
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
557 This make the structure of the table stay in tact as long as the edited
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
558 field does not exceed the column width.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
559 - Minimize the number of realigns. Normally, the table is aligned each time
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
560 TAB or RET are pressed to move to another field. With optimization this
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
561 happens only if changes to a field might have changed the column width.
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
562 Optimization requires replacing the functions `self-insert-command',
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
563 `delete-char', and `backward-delete-char' in Org-mode buffers, with a
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
564 slight (in fact: unnoticeable) speed impact for normal typing. Org-mode is
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
565 very good at guessing when a re-align will be necessary, but you can always
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
566 force one with \\[org-ctrl-c-ctrl-c].
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
567
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
568 If you would like to use the optimized version in Org-mode, but the
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
569 un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'.
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
570
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
571 This variable can be used to turn on and off the table editor during a session,
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
572 but in order to toggle optimization, a restart is required.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
573
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
574 See also the variable `org-table-auto-blank-field'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 :group 'org-table
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
576 :type '(choice
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
577 (const :tag "off" nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
578 (const :tag "on" t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
579 (const :tag "on, optimized" optimized)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
581 (defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
582 "Non-nil means, use the optimized table editor version for `orgtbl-mode'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
583 In the optimized version, the table editor takes over all simple keys that
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
584 normally just insert a character. In tables, the characters are inserted
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
585 in a way to minimize disturbing the table structure (i.e. in overwrite mode
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
586 for empty fields). Outside tables, the correct binding of the keys is
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
587 restored.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
588
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
589 The default for this option is t if the optimized version is also used in
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
590 Org-mode. See the variable `org-enable-table-editor' for details. Changing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
591 this variable requires a restart of Emacs to become effective."
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
592 :group 'org-table
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
593 :type 'boolean)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
594
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
595 (defgroup org-table-settings nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
596 "Settings for tables in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
597 :tag "Org Table Settings"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
598 :group 'org-table)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
599
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 (defcustom org-table-default-size "5x2"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 "The default size for newly created tables, Columns x Rows."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
602 :group 'org-table-settings
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
603 :type 'string)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 (defcustom org-table-number-regexp "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 "Regular expression for recognizing numbers in table columns.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 If a table column contains mostly numbers, it will be aligned to the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608 right. If not, it will be aligned to the left.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
610 The default value of this option is a regular expression which allows
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 anything which looks remotely like a number as used in scientific
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 context. For example, all of the following will be considered a
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613 number:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 12 12.2 2.4e-08 2x10^12 4.034+-0.02 2.7(10) >3.5
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
616 Other options offered by the customize interface are more restrictive."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
617 :group 'org-table-settings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
618 :type '(choice
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
619 (const :tag "Positive Integers"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
620 "^[0-9]+$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
621 (const :tag "Integers"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
622 "^[-+]?[0-9]+$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
623 (const :tag "Floating Point Numbers"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
624 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.[0-9]*\\)$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
625 (const :tag "Floating Point Number or Integer"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
626 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.?[0-9]*\\)$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
627 (const :tag "Exponential, Floating point, Integer"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
628 "^[-+]?[0-9.]+\\([eEdD][-+0-9]+\\)?$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
629 (const :tag "Very General Number-Like"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
630 "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
631 (string :tag "Regexp:")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 (defcustom org-table-number-fraction 0.5
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 "Fraction of numbers in a column required to make the column align right.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 In a column all non-white fields are considered. If at least this
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 fraction of fields is matched by `org-table-number-fraction',
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 alignment to the right border applies."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
638 :group 'org-table-settings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 :type 'number)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
641 (defgroup org-table-editing nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
642 "Bahavior of tables during editing in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
643 :tag "Org Table Editing"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
644 :group 'org-table)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
645
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
646 (defcustom org-table-automatic-realign t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
647 "Non-nil means, automatically re-align table when pressing TAB or RETURN.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
648 When nil, aligning is only done with \\[org-table-align], or after column
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
649 removal/insertion."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
650 :group 'org-table-editing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
651 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
652
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
653 (defcustom org-table-limit-column-width t ;kw
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
654 "Non-nil means, allow to limit the width of table columns with <N> fields."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
655 :group 'org-table-editing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
656 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
657
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
658 (defcustom org-table-auto-blank-field t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
659 "Non-nil means, automatically blank table field when starting to type into it.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
660 This only happens when typing immediately after a field motion
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
661 command (TAB, S-TAB or RET).
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
662 Only relevant when `org-enable-table-editor' is equal to `optimized'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
663 :group 'org-table-editing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
664 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
665
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
666 (defcustom org-table-tab-jumps-over-hlines t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
667 "Non-nil means, tab in the last column of a table with jump over a hline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
668 If a horizontal separator line is following the current line,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
669 `org-table-next-field' can either create a new row before that line, or jump
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
670 over the line. When this option is nil, a new line will be created before
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
671 this line."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
672 :group 'org-table-editing
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
675 (defcustom org-table-tab-recognizes-table.el t
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
676 "Non-nil means, TAB will automatically notice a table.el table.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
677 When it sees such a table, it moves point into it and - if necessary -
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
678 calls `table-recognize-table'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
679 :group 'org-table-editing
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
680 :type 'boolean)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
681
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
682 (defgroup org-table-calculation nil
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
683 "Options concerning tables in Org-mode."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
684 :tag "Org Table Calculation"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
685 :group 'org-table)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
686
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
687 (defcustom org-table-copy-increment t
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
688 "Non-nil means, increment when copying current field with \\[org-table-copy-down]."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
689 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
690 :type 'boolean)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
691
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
692 (defcustom org-calc-default-modes
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
693 '(calc-internal-prec 12
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
694 calc-float-format (float 5)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
695 calc-angle-mode deg
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
696 calc-prefer-frac nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
697 calc-symbolic-mode nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
698 calc-date-format (YYYY "-" MM "-" DD " " Www (" " HH ":" mm))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
699 calc-display-working-message t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
700 )
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
701 "List with Calc mode settings for use in calc-eval for table formulas.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
702 The list must contain alternating symbols (Calc modes variables and values).
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
703 Don't remove any of the default settings, just change the values. Org-mode
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
704 relies on the variables to be present in the list."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
705 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
706 :type 'plist)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
707
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
708 (defcustom org-table-formula-evaluate-inline t
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
709 "Non-nil means, TAB and RET evaluate a formula in current table field.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
710 If the current field starts with an equal sign, it is assumed to be a formula
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
711 which should be evaluated as described in the manual and in the documentation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
712 string of the command `org-table-eval-formula'. This feature requires the
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
713 Emacs calc package.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
714 When this variable is nil, formula calculation is only available through
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
715 the command \\[org-table-eval-formula]."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
716 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
717 :type 'boolean)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
718
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
719
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
720 (defcustom org-table-formula-use-constants t
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
721 "Non-nil means, interpret constants in formulas in tables.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
722 A constant looks like `$c' or `$Grav' and will be replaced before evaluation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
723 by the value given in `org-table-formula-constants', or by a value obtained
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
724 from the `constants.el' package."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
725 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
726 :type 'boolean)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
727
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
728 (defcustom org-table-formula-constants nil
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
729 "Alist with constant names and values, for use in table formulas.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
730 The car of each element is a name of a constant, without the `$' before it.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
731 The cdr is the value as a string. For example, if you'd like to use the
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
732 speed of light in a formula, you would configure
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
733
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
734 (setq org-table-formula-constants '((\"c\" . \"299792458.\")))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
735
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
736 and then use it in an equation like `$1*$c'."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
737 :group 'org-table-calculation
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
738 :type '(repeat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
739 (cons (string :tag "name")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
740 (string :tag "value"))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
741
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
742 (defcustom org-table-formula-numbers-only nil
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
743 "Non-nil means, calculate only with numbers in table formulas.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
744 Then all input fields will be converted to a number, and the result
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
745 must also be a number. When nil, calc's full potential is available
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
746 in table calculations, including symbolics etc."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
747 :group 'org-table-calculation
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
748 :type 'boolean)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
749
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
750 (defcustom org-table-allow-automatic-line-recalculation t
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
751 "Non-nil means, lines marked with |#| or |*| will be recomputed automatically.
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
752 Automatically means, when TAB or RET or C-c C-c are pressed in the line."
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
753 :group 'org-table-calculation
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
754 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
755
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
756 (defgroup org-link nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
757 "Options concerning links in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
758 :tag "Org Link"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
759 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
760
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
761 (defcustom org-descriptive-links t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
762 "Non-nil means, hide link part and only show description of bracket links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
763 Bracket links are like [[link][descritpion]]. This variable sets the initial
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
764 state in new org-mode buffers. The setting can then be toggled on a
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
765 per-buffer basis from the Org->Hyperlinks menu."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
766 :group 'org-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
767 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
768
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
769 (defcustom org-link-style 'bracket
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
770 "The style of links to be inserted with \\[org-insert-link].
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
771 Possible values are:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
772 bracket [[link][description]]. This is recommended
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
773 plain Description \\n link. The old way, no longer recommended."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
774 :group 'org-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
775 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
776 (const :tag "Bracket (recommended)" bracket)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
777 (const :tag "Plain (no longer recommended)" plain)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
778
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
779 (defcustom org-link-format "%s"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
780 "Default format for external, URL-like linkes in the buffer.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
781 This is a format string for printf, %s will be replaced by the link text.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
782 The recommended value is just \"%s\", since links will be protected by
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
783 enclosing them in double brackets. If you prefer plain links (see variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
784 `org-link-style'), \"<%s>\" is useful. Some people also recommend an
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
785 additional URL: prefix, so the format would be \"<URL:%s>\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
786 :group 'org-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
787 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
788 (const :tag "\"%s\" (e.g. http://www.there.com)" "%s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
789 (const :tag "\"<%s>\" (e.g. <http://www.there.com>)" "<%s>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
790 (const :tag "\"<URL:%s>\" (e.g. <URL:http://www.there.com>)" "<URL:%s>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
791 (string :tag "Other" :value "<%s>")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
792
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
793 (defcustom org-activate-links '(bracket angle plain radio tag date)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
794 "Types of links that should be activated in Org-mode files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
795 This is a list of symbols, each leading to the activation of a certain link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
796 type. In principle, it does not hurt to turn on most link types - there may
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
797 be a small gain when turning off unused link types. The types are:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
798
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
799 bracket The recommended [[link][description]] or [[link]] links with hiding.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
800 angular Links in angular brackes that may contain whitespace like
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
801 <bbdb:Carsten Dominik>.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
802 plain Plain links in normal text, no whitespace, like http://google.com.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
803 radio Text that is matched by a radio target, see manual for details.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
804 tag Tag settings in a headline (link to tag search).
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
805 date Time stamps (link to calendar).
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
806 camel CamelCase words defining text searches.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
807
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
808 Changing this variable requires a restart of Emacs to become effective."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
809 :group 'org-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
810 :type '(set (const :tag "Double bracket links (new style)" bracket)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
811 (const :tag "Angular bracket links (old style)" angular)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
812 (const :tag "plain text links" plain)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
813 (const :tag "Radio target matches" radio)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
814 (const :tag "Tags" tag)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
815 (const :tag "Timestamps" date)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
816 (const :tag "CamelCase words" camel)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
817
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
818 (defgroup org-link-store nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
819 "Options concerning storing links in Org-mode"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
820 :tag "Org Store Link"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
821 :group 'org-link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
822
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
823 (defcustom org-context-in-file-links t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
824 "Non-nil means, file links from `org-store-link' contain context.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
825 A search string will be added to the file name with :: as separator and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
826 used to find the context when the link is activated by the command
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
827 `org-open-at-point'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
828 Using a prefix arg to the command \\[org-store-link] (`org-store-link')
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
829 negates this setting for the duration of the command."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
830 :group 'org-link-store
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
831 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
832
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
833 (defcustom org-file-link-context-use-camel-case nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
834 "Non-nil means, use CamelCase to store a search context in a file link.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
835 When nil, the search string simply consists of the words of the string.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
836 CamelCase is deprecated, and support for it may be dropped in the future."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
837 :group 'org-link-store
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
838 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
839
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
840 (defcustom org-keep-stored-link-after-insertion nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
841 "Non-nil means, keep link in list for entire session.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
842
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
843 The command `org-store-link' adds a link pointing to the current
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
844 location to an internal list. These links accumulate during a session.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
845 The command `org-insert-link' can be used to insert links into any
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
846 Org-mode file (offering completion for all stored links). When this
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
847 option is nil, every link which has been inserted once using \\[org-insert-link]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
848 will be removed from the list, to make completing the unused links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
849 more efficient."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
850 :group 'org-link-store
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
851 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
852
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
853 (defcustom org-usenet-links-prefer-google nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
854 "Non-nil means, `org-store-link' will create web links to Google groups.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
855 When nil, Gnus will be used for such links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
856 Using a prefix arg to the command \\[org-store-link] (`org-store-link')
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
857 negates this setting for the duration of the command."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
858 :group 'org-link-store
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
859 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
860
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
861 (defgroup org-link-follow nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
862 "Options concerning following links in Org-mode"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
863 :tag "Org Follow Link"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
864 :group 'org-link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
865
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
866 (defcustom org-tab-follows-link nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
867 "Non-nil means, on links TAB will follow the link.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
868 Needs to be set before org.el is loaded."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
869 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
870 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
871
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
872 (defcustom org-return-follows-link nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
873 "Non-nil means, on links RET will follow the link.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
874 Needs to be set before org.el is loaded."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
875 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
876 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
877
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
878 (defcustom org-mouse-1-follows-link t
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
879 "Non-nil means, mouse-1 on a link will follow the link.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
880 A longer mouse click will still set point. Does not wortk on XEmacs.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
881 Needs to be set before org.el is loaded."
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
882 :group 'org-link-follow
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
883 :type 'boolean)
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
884
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
885 (defcustom org-mark-ring-length 4
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
886 "Number of different positions to be recorded in the ring
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
887 Changing this requires a restart of Emacs to work correctly."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
888 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
889 :type 'interger)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
890
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
891 (defcustom org-link-frame-setup
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
892 '((vm . vm-visit-folder-other-frame)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
893 (gnus . gnus-other-frame)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
894 (file . find-file-other-window))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
895 "Setup the frame configuration for following links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
896 When following a link with Emacs, it may often be useful to display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
897 this link in another window or frame. This variable can be used to
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
898 set this up for the different types of links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
899 For VM, use any of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
900 `vm-visit-folder'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
901 `vm-visit-folder-other-frame'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
902 For Gnus, use any of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
903 `gnus'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
904 `gnus-other-frame'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
905 For FILE, use any of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
906 `find-file'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
907 `find-file-other-window'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
908 `find-file-other-frame'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
909 For the calendar, use the variable `calendar-setup'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
910 For BBDB, it is currently only possible to display the matches in
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
911 another window."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
912 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
913 :type '(list
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
914 (cons (const vm)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
915 (choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
916 (const vm-visit-folder)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
917 (const vm-visit-folder-other-window)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
918 (const vm-visit-folder-other-frame)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
919 (cons (const gnus)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
920 (choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
921 (const gnus)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
922 (const gnus-other-frame)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
923 (cons (const file)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
924 (choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
925 (const find-file)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
926 (const find-file-other-window)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
927 (const find-file-other-frame)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
928
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
929 (defcustom org-open-non-existing-files nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
930 "Non-nil means, `org-open-file' will open non-existing file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
931 When nil, an error will be generated."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
932 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
933 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
934
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
935 (defcustom org-confirm-shell-links 'yes-or-no-p
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
936 "Non-nil means, ask for confirmation before executing shell links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
937 Shell links can be dangerous, just thing about a link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
938
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
939 [[shell:rm -rf ~/*][Google Search]]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
940
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
941 This link would show up in your Org-mode document as \"Google Search\"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
942 but really it would remove your entire home directory. Dangerous indeed.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
943 Therefore I *definitely* advise agains setting this varaiable to nil.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
944 Just change it to `y-or-n-p' of you want to confirm with a single key press
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
945 rather than having to type \"yes\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
946 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
947 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
948 (const :tag "with yes-or-no (safer)" yes-or-no-p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
949 (const :tag "with y-or-n (faster)" y-or-n-p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
950 (const :tag "no confirmation (dangerous)" nil)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
951
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
952 (defconst org-file-apps-defaults-gnu
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
953 '((t . mailcap))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
954 "Default file applications on a UNIX or GNU/Linux system.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
955 See `org-file-apps'.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
956
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
957 (defconst org-file-apps-defaults-macosx
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
958 '((t . "open %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
959 ("ps" . "gv %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
960 ("ps.gz" . "gv %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
961 ("eps" . "gv %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
962 ("eps.gz" . "gv %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
963 ("dvi" . "xdvi %s")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
964 ("fig" . "xfig %s"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
965 "Default file applications on a MacOS X system.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
966 The system \"open\" is known as a default, but we use X11 applications
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
967 for some files for which the OS does not have a good default.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
968 See `org-file-apps'.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
969
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
970 (defconst org-file-apps-defaults-windowsnt
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
971 '((t . (w32-shell-execute "open" file)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
972 "Default file applications on a Windows NT system.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
973 The system \"open\" is used for most files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
974 See `org-file-apps'.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
975
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
976 (defcustom org-file-apps
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
977 '(
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
978 ("txt" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
979 ("tex" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
980 ("ltx" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
981 ("org" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
982 ("el" . emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
983 )
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
984 "External applications for opening `file:path' items in a document.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
985 Org-mode uses system defaults for different file types, but
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
986 you can use this variable to set the application for a given file
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
987 extension. The entries in this list are cons cells with a file extension
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
988 and the corresponding command. Possible values for the command are:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
989 `emacs' The file will be visited by the current Emacs process.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
990 `default' Use the default application for this file type.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
991 string A command to be executed by a shell; %s will be replaced
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
992 by the path to the file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
993 sexp A Lisp form which will be evaluated. The file path will
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
994 be available in the Lisp variable `file'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
995 For more examples, see the system specific constants
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
996 `org-file-apps-defaults-macosx'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
997 `org-file-apps-defaults-windowsnt'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
998 `org-file-apps-defaults-gnu'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
999 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1000 :type '(repeat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1001 (cons (choice :value ""
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1002 (string :tag "Extension")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1003 (const :tag "Default for unrecognized files" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1004 (const :tag "Links to a directory" directory))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1005 (choice :value ""
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1006 (const :tag "Visit with Emacs" emacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1007 (const :tag "Use system default" default)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1008 (string :tag "Command")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1009 (sexp :tag "Lisp form")))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1010
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1011 (defcustom org-mhe-search-all-folders nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1012 "Non-nil means, that the search for the mh-message will be extended to
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1013 all folders if the message cannot be found in the folder given in the link.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1014 Searching all folders is very effective with one of the search engines
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1015 supported by MH-E, but will be slow with pick."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1016 :group 'org-link-follow
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1017 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1018
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1019 (defgroup org-remember nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1020 "Options concerning interaction with remember.el."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1021 :tag "Org Remember"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1022 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1023
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1024 (defcustom org-directory "~/org"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1025 "Directory with org files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1026 This directory will be used as default to prompt for org files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1027 Used by the hooks for remember.el."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1028 :group 'org-remember
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1029 :type 'directory)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1030
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1031 (defcustom org-default-notes-file "~/.notes"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1032 "Default target for storing notes.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1033 Used by the hooks for remember.el. This can be a string, or nil to mean
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1034 the value of `remember-data-file'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1035 :group 'org-remember
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1036 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1037 (const :tag "Default from remember-data-file" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1038 file))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1039
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1040 (defcustom org-remember-templates nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1041 "Templates for the creation of remember buffers.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1042 When nil, just let remember make the buffer.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1043 When not nil, this is a list of 3-element lists. In each entry, the first
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1044 element is a character, a unique key to select this template.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1045 The second element is the template. The third element is optional and can
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1046 specify a destination file for remember items created with this template.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1047 The default file is given by `org-default-notes-file'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1048
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1049 The template specifies the structure of the remember buffer. It should have
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1050 a first line starting with a star, to act as the org-mode headline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1051 Furthermore, the following %-escapes will be replaced with content:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1052 %t time stamp, date only
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1053 %T time stamp with date and time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1054 %u inactive time stamp, date only
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1055 %U inactive time stamp with date and time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1056 %n user name
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1057 %a annotation, normally the link created with org-store-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1058 %i initial content, the region when remember is called with C-u.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1059 If %i is indented, the entire inserted text will be indented as well.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1060 %? This will be removed, and the cursor placed at this position."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1061 :group 'org-remember
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1062 :type '(repeat :tag "enabled"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1063 (list :value (?a "\n" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1064 (character :tag "Selection Key")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1065 (string :tag "Template")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1066 (file :tag "Destination file (optional)"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1067
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1068 (defcustom org-reverse-note-order nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1069 "Non-nil means, store new notes at the beginning of a file or entry.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1070 When nil, new notes will be filed to the end of a file or entry."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1071 :group 'org-remember
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1072 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1073 (const :tag "Reverse always" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1074 (const :tag "Reverse never" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1075 (repeat :tag "By file name regexp"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1076 (cons regexp boolean))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1077
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1078 (defgroup org-todo nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1079 "Options concerning TODO items in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1080 :tag "Org TODO"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1081 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1082
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1083 (defcustom org-todo-keywords '("TODO" "DONE")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1084 "List of TODO entry keywords.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1085 \\<org-mode-map>By default, this is '(\"TODO\" \"DONE\"). The last entry in the list is
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1086 considered to mean that the entry is \"done\". All the other mean that
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1087 action is required, and will make the entry show up in todo lists, diaries
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1088 etc.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1089 The command \\[org-todo] cycles an entry through these states, and an
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1090 additional state where no keyword is present. For details about this
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1091 cycling, see also the variable `org-todo-interpretation'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1092 Changes become only effective after restarting Emacs."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1093 :group 'org-todo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1094 :group 'org-keywords
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1095 :type '(repeat (string :tag "Keyword")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1096
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1097 (defcustom org-todo-interpretation 'sequence
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1098 "Controls how TODO keywords are interpreted.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1099 This variable is only relevant if `org-todo-keywords' contains more than two
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1100 states. \\<org-mode-map>Possible values are `sequence' and `type'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1101
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1102 When `sequence', \\[org-todo] will always switch to the next state in the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1103 `org-todo-keywords' list. When `type', \\[org-todo] only cycles from state
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1104 to state when executed several times in direct succession. Otherwise, it
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1105 switches directly to DONE from any state.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1106 See the manual for more information."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1107 :group 'org-todo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1108 :group 'org-keywords
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1109 :type '(choice (const sequence)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1110 (const type)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1111
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1112 (defcustom org-after-todo-state-change-hook nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1113 "Hook which is run after the state of a TODO item was changed.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1114 The new state (a string with a TODO keyword, or nil) is available in the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1115 Lisp variable `state'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1116 :group 'org-todo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1117 :type 'hook)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1118
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1119 (defcustom org-log-done nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1120 "When set, insert a (non-active) time stamp when TODO entry is marked DONE.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1121 When the state of an entry is changed from nothing to TODO, remove a previous
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1122 closing date."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1123 :group 'org-todo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1124 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1125
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1126 (defgroup org-priorities nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1127 "Keywords in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1128 :tag "Org Priorities"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1129 :group 'org-todo)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1130
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1131 (defcustom org-default-priority ?B
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1132 "The default priority of TODO items.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1133 This is the priority an item get if no explicit priority is given."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1134 :group 'org-priorities
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1135 :type 'character)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1136
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1137 (defcustom org-lowest-priority ?C
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1138 "The lowest priority of TODO items. A character like ?A, ?B etc."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1139 :group 'org-priorities
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1140 :type 'character)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1141
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1142 (defgroup org-time nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1143 "Options concerning time stamps and deadlines in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1144 :tag "Org Time"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1145 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1146
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1147 (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1148 "Formats for `format-time-string' which are used for time stamps.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1149 It is not recommended to change this constant.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1150
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1151 (defcustom org-time-stamp-rounding-minutes 0
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1152 "Number of minutes to round time stamps to upon insertion.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1153 When zero, insert the time unmodified. Useful rounding numbers
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1154 should be factors of 60, so for example 5, 10, 15.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1155 When this is not zero, you can still force an exact time-stamp by using
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1156 a double prefix argument to a time-stamp command like `C-c .' or `C-c !'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1157 :group 'org-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1158 :type 'integer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1159
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1160 (defcustom org-deadline-warning-days 30
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1161 "No. of days before expiration during which a deadline becomes active.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1162 This variable governs the display in the org file."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1163 :group 'org-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1164 :type 'number)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1165
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1166 (defcustom org-popup-calendar-for-date-prompt t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1167 "Non-nil means, pop up a calendar when prompting for a date.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1168 In the calendar, the date can be selected with mouse-1. However, the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1169 minibuffer will also be active, and you can simply enter the date as well.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1170 When nil, only the minibuffer will be available."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1171 :group 'org-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1172 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1173
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1174 (defcustom org-calendar-follow-timestamp-change t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1175 "Non-nil means, make the calendar window follow timestamp changes.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1176 When a timestamp is modified and the calendar window is visible, it will be
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1177 moved to the new date."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1178 :group 'org-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1179 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1180
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1181 (defgroup org-tags nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1182 "Options concerning startup of Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1183 :tag "Org Tags"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1184 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1185
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1186 (defcustom org-tags-column 48
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1187 "The column to which tags should be indented in a headline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1188 If this number is positive, it specifies the column. If it is negative,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1189 it means that the tags should be flushright to that column. For example,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1190 -79 works well for a normal 80 character screen."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1191 :group 'org-tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1192 :type 'integer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1193
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1194 (defcustom org-auto-align-tags t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1195 "Non-nil means, realign tags after pro/demotion of TODO state change.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1196 These operations change the length of a headline and therefore shift
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1197 the tags around. With this options turned on, after each such operation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1198 the tags are again aligned to `org-tags-column'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1199 :group 'org-tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1200 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1201
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1202 (defcustom org-use-tag-inheritance t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1203 "Non-nil means, tags in levels apply also for sublevels.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1204 When nil, only the tags directly given in a specific line apply there.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1205 If you turn off this option, you very likely want to turn on the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1206 companion option `org-tags-match-list-sublevels'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1207 :group 'org-tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1208 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1209
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1210 (defcustom org-tags-match-list-sublevels nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1211 "Non-nil means list also sublevels of headlines matching tag search.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1212 Because of tag inheritance (see variable `org-use-tag-inheritance'),
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1213 the sublevels of a headline matching a tag search often also match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1214 the same search. Listing all of them can create very long lists.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1215 Setting this variable to nil causes subtrees of a match to be skipped.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1216 This option is off by default, because inheritance in on. If you turn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1217 inheritance off, you very likely want to turn this option on.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1218
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1219 As a special case, if the tag search is restricted to TODO items, the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1220 value of this variable is ignored and sublevels are always checked, to
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1221 make sure all corresponding TODO items find their way into the list."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1222 :group 'org-tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1223 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1224
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1225 (defvar org-tags-history nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1226 "History of minibuffer reads for tags.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1227 (defvar org-last-tags-completion-table nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1228 "The last used completion table for tags.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1229
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1230 (defgroup org-agenda nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1231 "Options concerning agenda display Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1232 :tag "Org Agenda"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1233 :group 'org)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1234
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1235 (defvar org-category nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1236 "Variable used by org files to set a category for agenda display.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1237 Such files should use a file variable to set it, for example
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1238
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1239 -*- mode: org; org-category: \"ELisp\"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1240
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1241 or contain a special line
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1242
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1243 #+CATEGORY: ELisp
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1244
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1245 If the file does not specify a category, then file's base name
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1246 is used instead.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1247 (make-variable-buffer-local 'org-category)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1248
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1249 (defcustom org-agenda-files nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1250 "The files to be used for agenda display.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1251 Entries may be added to this list with \\[org-agenda-file-to-front] and removed with
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1252 \\[org-remove-file]. You can also use customize to edit the list.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1253
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1254 If the value of the variable is not a list but a single file name, then
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1255 the list of agenda files is actually stored and maintained in that file, one
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1256 agenda file per line."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1257 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1258 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1259 (repeat :tag "List of files" file)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1260 (file :tag "Store list in a file\n" :value "~/.agenda_files")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1261
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1262 (defcustom org-agenda-custom-commands '(("w" todo "WAITING"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1263 "Custom commands for the agenda.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1264 These commands will be offered on the splash screen displayed by the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1265 agenda dispatcher \\[org-agenda]. Each entry is a list of 3 items:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1266
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1267 key The key (a single char as a string) to be associated with the command.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1268 type The command type, any of the following symbols:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1269 todo Entries with a specific TODO keyword, in all agenda files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1270 tags Tags match in all agenda files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1271 todo-tree Sparse tree of specific TODO keyword in *current* file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1272 tags-tree Sparse tree with all tags matches in *current* file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1273 occur-tree Occur sparse tree for current file.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1274 match What to search for:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1275 - a single keyword for TODO keyword searches
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1276 - a tags match expression for tags searches
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1277 - a regular expression for occur searches"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1278 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1279 :type '(repeat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1280 (list (string :tag "Key")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1281 (choice :tag "Type"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1282 (const :tag "Tags search in all agenda files" tags)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1283 (const :tag "TODO keyword search in all agenda files" todo)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1284 (const :tag "Tags sparse tree in current buffer" tags-tree)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1285 (const :tag "TODO keyword tree in current buffer" todo-tree)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1286 (const :tag "Occur tree in current buffer" occur-tree))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1287 (string :tag "Match"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1288
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1289 (defcustom org-agenda-include-all-todo t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1290 "Non-nil means, the agenda will always contain all TODO entries.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1291 When nil, date-less entries will only be shown if `org-agenda' is called
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1292 with a prefix argument.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1293 When non-nil, the TODO entries will be listed at the top of the agenda, before
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1294 the entries for specific days."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1295 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1296 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1297
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1298 (defcustom org-agenda-include-diary nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1299 "If non-nil, include in the agenda entries from the Emacs Calendar's diary."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1300 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1301 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1302
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1303 (defcustom org-calendar-to-agenda-key [?c]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1304 "The key to be installed in `calendar-mode-map' for switching to the agenda.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1305 The command `org-calendar-goto-agenda' will be bound to this key. The
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1306 default is the character `c' because then `c' can be used to switch back and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1307 forth between agenda and calendar."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1308 :group 'org-agenda
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1309 :type 'sexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1310
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1311 (defgroup org-agenda-window-setup nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1312 "Options concerning setting up the Agenda window in Org Mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1313 :tag "Org Agenda Window Setup"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1314 :group 'org-agenda)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1315
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1316 (defcustom org-agenda-mouse-1-follows-link nil
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1317 "Non-nil means, mouse-1 on a link will follow the link in the agenda.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1318 A longer mouse click will still set point. Does not wortk on XEmacs.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1319 Needs to be set before org.el is loaded."
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1320 :group 'org-agenda-setup
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1321 :type 'boolean)
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1322
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1323 (defcustom org-select-timeline-window t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1324 "Non-nil means, after creating a timeline, move cursor into Timeline window.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1325 When nil, cursor will remain in the current window."
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1326 :group 'org-agenda-setup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1327 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1328
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1329 (defcustom org-select-agenda-window t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1330 "Non-nil means, after creating an agenda, move cursor into Agenda window.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1331 When nil, cursor will remain in the current window."
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1332 :group 'org-agenda-setup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1333 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1334
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1335 (defcustom org-fit-agenda-window t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1336 "Non-nil means, change window size of agenda to fit content."
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
1337 :group 'org-agenda-setup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1338 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1339
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1340 (defgroup org-agenda-display nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1341 "Options concerning what to display initially in Agenda."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1342 :tag "Org Agenda Display"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1343 :group 'org-agenda)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1344
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1345 (defcustom org-agenda-show-all-dates t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1346 "Non-nil means, `org-agenda' shows every day in the selected range.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1347 When nil, only the days which actually have entries are shown."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1348 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1349 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1350
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1351 (defcustom org-agenda-start-on-weekday 1
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1352 "Non-nil means, start the overview always on the specified weekday.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1353 0 denotes Sunday, 1 denotes Monday etc.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1354 When nil, always start on the current day."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1355 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1356 :type '(choice (const :tag "Today" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1357 (number :tag "Weekday No.")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1358
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1359 (defcustom org-agenda-ndays 7
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1360 "Number of days to include in overview display.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1361 Should be 1 or 7."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1362 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1363 :type 'number)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1364
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1365 (defcustom org-agenda-use-time-grid t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1366 "Non-nil means, show a time grid in the agenda schedule.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1367 A time grid is a set of lines for specific times (like every two hours between
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1368 8:00 and 20:00). The items scheduled for a day at specific times are
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1369 sorted in between these lines.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1370 For details about when the grid will be shown, and what it will look like, see
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1371 the variable `org-agenda-time-grid'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1372 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1373 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1374
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1375 (defcustom org-agenda-time-grid
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1376 '((daily today require-timed)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1377 "----------------"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1378 (800 1000 1200 1400 1600 1800 2000))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1379
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1380 "The settings for time grid for agenda display.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1381 This is a list of three items. The first item is again a list. It contains
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1382 symbols specifying conditions when the grid should be displayed:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1383
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1384 daily if the agenda shows a single day
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1385 weekly if the agenda shows an entire week
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1386 today show grid on current date, independent of daily/weekly display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1387 require-timed show grid only if at least on item has a time specification
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1388
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1389 The second item is a string which will be places behing the grid time.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1390
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1391 The third item is a list of integers, indicating the times that should have
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1392 a grid line."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1393 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1394 :type
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1395 '(list
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1396 (set :greedy t :tag "Grid Display Options"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1397 (const :tag "Show grid in single day agenda display" daily)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1398 (const :tag "Show grid in weekly agenda display" weekly)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1399 (const :tag "Always show grid for today" today)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1400 (const :tag "Show grid only if any timed entries are present"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1401 require-timed)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1402 (const :tag "Skip grid times already present in an entry"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1403 remove-match))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1404 (string :tag "Grid String")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1405 (repeat :tag "Grid Times" (integer :tag "Time"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1406
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1407 (defcustom org-agenda-sorting-strategy '(time-up category-keep priority-down)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1408 "Sorting structure for the agenda items of a single day.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1409 This is a list of symbols which will be used in sequence to determine
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1410 if an entry should be listed before another entry. The following
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1411 symbols are recognized:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1412
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1413 time-up Put entries with time-of-day indications first, early first
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1414 time-down Put entries with time-of-day indications first, late first
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1415 category-keep Keep the default order of categories, corresponding to the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1416 sequence in `org-agenda-files'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1417 category-up Sort alphabetically by category, A-Z.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1418 category-down Sort alphabetically by category, Z-A.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1419 priority-up Sort numerically by priority, high priority last.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1420 priority-down Sort numerically by priority, high priority first.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1421
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1422 The different possibilities will be tried in sequence, and testing stops
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1423 if one comparison returns a \"not-equal\". For example, the default
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1424 '(time-up category-keep priority-down)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1425 means: Pull out all entries having a specified time of day and sort them,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1426 in order to make a time schedule for the current day the first thing in the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1427 agenda listing for the day. Of the entries without a time indication, keep
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1428 the grouped in categories, don't sort the categories, but keep them in
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1429 the sequence given in `org-agenda-files'. Within each category sort by
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1430 priority.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1431
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1432 Leaving out `category-keep' would mean that items will be sorted across
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1433 categories by priority."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1434 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1435 :type '(repeat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1436 (choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1437 (const time-up)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1438 (const time-down)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1439 (const category-keep)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1440 (const category-up)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1441 (const category-down)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1442 (const priority-up)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1443 (const priority-down))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1444
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1445 (defcustom org-sort-agenda-notime-is-late t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1446 "Non-nil means, items without time are considered late.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1447 This is only relevant for sorting. When t, items which have no explicit
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1448 time like 15:30 will be considered as 24:01, i.e. later than any items which
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1449 do have a time. When nil, the default time is before 0:00. You can use this
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1450 option to decide if the schedule for today should come before or after timeless
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1451 agenda entries."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1452 :group 'org-agenda-display
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1453 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1454
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1455
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1456 (defgroup org-agenda-prefix nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1457 "Options concerning the entry prefix in the Org-mode agenda display."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1458 :tag "Org Agenda Prefix"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1459 :group 'org-agenda)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1460
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1461 (defcustom org-agenda-prefix-format " %-12:c%?-12t% s"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1462 "Format specification for the prefix of items in the agenda buffer.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1463 This format works similar to a printf format, with the following meaning:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1464
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1465 %c the category of the item, \"Diary\" for entries from the diary, or
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1466 as given by the CATEGORY keyword or derived from the file name.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1467 %T the first tag of the item.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1468 %t the time-of-day specification if one applies to the entry, in the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1469 format HH:MM
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1470 %s Scheduling/Deadline information, a short string
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1471
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1472 All specifiers work basically like the standard `%s' of printf, but may
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1473 contain two additional characters: A question mark just after the `%' and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1474 a whitespace/punctuation character just before the final letter.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1475
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1476 If the first character after `%' is a question mark, the entire field
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1477 will only be included if the corresponding value applies to the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1478 current entry. This is useful for fields which should have fixed
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1479 width when present, but zero width when absent. For example,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1480 \"%?-12t\" will result in a 12 character time field if a time of the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1481 day is specified, but will completely disappear in entries which do
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1482 not contain a time.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1483
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1484 If there is punctuation or whitespace character just before the final
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1485 format letter, this character will be appended to the field value if
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1486 the value is not empty. For example, the format \"%-12:c\" leads to
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1487 \"Diary: \" if the category is \"Diary\". If the category were be
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1488 empty, no additional colon would be interted.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1489
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1490 The default value of this option is \" %-12:c%?-12t% s\", meaning:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1491 - Indent the line with two space characters
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1492 - Give the category in a 12 chars wide field, padded with whitespace on
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1493 the right (because of `-'). Append a colon if there is a category
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1494 (because of `:').
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1495 - If there is a time-of-day, put it into a 12 chars wide field. If no
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1496 time, don't put in an empty field, just skip it (because of '?').
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1497 - Finally, put the scheduling information and append a whitespace.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1498
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1499 As another example, if you don't want the time-of-day of entries in
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1500 the prefix, you could use:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1501
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1502 (setq org-agenda-prefix-format \" %-11:c% s\")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1503
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1504 See also the variables `org-agenda-remove-times-when-in-prefix' and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1505 `org-agenda-remove-tags-when-in-prefix'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1506 :type 'string
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1507 :group 'org-agenda-prefix)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1508
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1509 (defcustom org-timeline-prefix-format " % s"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1510 "Like `org-agenda-prefix-format', but for the timeline of a single file."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1511 :type 'string
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1512 :group 'org-agenda-prefix)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1513
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1514 (defvar org-prefix-format-compiled nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1515 "The compiled version of the most recently used prefix format.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1516 Depending on which command was used last, this may be the compiled version
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1517 of `org-agenda-prefix-format' or `org-timeline-prefix-format'.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1518
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1519 ;; FIXME: There seem to be situations where this does no work.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1520 (defcustom org-agenda-remove-times-when-in-prefix t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1521 "Non-nil means, remove duplicate time specifications in agenda items.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1522 When the format `org-agenda-prefix-format' contains a `%t' specifier, a
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1523 time-of-day specification in a headline or diary entry is extracted and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1524 placed into the prefix. If this option is non-nil, the original specification
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1525 \(a timestamp or -range, or just a plain time(range) specification like
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1526 11:30-4pm) will be removed for agenda display. This makes the agenda less
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1527 cluttered.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1528 The option can be t or nil. It may also be the symbol `beg', indicating
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1529 that the time should only be removed what it is located at the beginning of
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1530 the headline/diary entry."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1531 :group 'org-agenda-prefix
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1532 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1533 (const :tag "Always" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1534 (const :tag "Never" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1535 (const :tag "When at beginning of entry" beg)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1536
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1537 (defcustom org-agenda-remove-tags-when-in-prefix nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1538 "Non-nil means, remove the tags from the headline copy in the agenda.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1539 When this is the symbol `prefix', only remove tags when
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1540 `org-agenda-prefix-format' contains a `%T' specifier."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1541 :group 'org-agenda-prefix
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1542 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1543 (const :tag "Always" t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1544 (const :tag "Never" nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1545 (const :tag "When prefix format contains %T" prefix)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1546
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1547 (defgroup org-export nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1548 "Options for exporting org-listings."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1549 :tag "Org Export"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1550 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1551
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1552 (defgroup org-export-general nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1553 "General options for exporting Org-mode files."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1554 :tag "Org Export General"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1555 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1556
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1557 (defcustom org-export-language-setup
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1558 '(("en" "Author" "Date" "Table of Contents")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1559 ("da" "Ophavsmand" "Dato" "Indhold")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1560 ("de" "Autor" "Datum" "Inhaltsverzeichnis")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1561 ("es" "Autor" "Fecha" "\xccndice")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1562 ("fr" "Auteur" "Date" "Table des Mati\xe8res")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1563 ("it" "Autore" "Data" "Indice")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1564 ("nl" "Auteur" "Datum" "Inhoudsopgave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1565 ("nn" "Forfattar" "Dato" "Innhold") ;; nn = Norsk (nynorsk)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1566 ("sv" "F\xf6rfattarens" "Datum" "Inneh\xe5ll"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1567 "Terms used in export text, translated to different languages.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1568 Use the variable `org-export-default-language' to set the language,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1569 or use the +OPTION lines for a per-file setting."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1570 :group 'org-export-general
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1571 :type '(repeat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1572 (list
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1573 (string :tag "HTML language tag")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1574 (string :tag "Author")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1575 (string :tag "Date")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
1576 (string :tag "Table of Contents"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1577
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1578 (defcustom org-export-default-language "en"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1579 "The default language of HTML export, as a string.
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1580 This should have an association in `org-export-language-setup'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1581 :group 'org-export-general
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1582 :type 'string)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1583
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1584 (defcustom org-export-headline-levels 3
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1585 "The last level which is still exported as a headline.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1586 Inferior levels will produce itemize lists when exported.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1587 Note that a numeric prefix argument to an exporter function overrides
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1588 this setting.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1589
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1590 This option can also be set with the +OPTIONS line, e.g. \"H:2\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1591 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1592 :type 'number)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1593
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1594 (defcustom org-export-with-section-numbers t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1595 "Non-nil means, add section numbers to headlines when exporting.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1596
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1597 This option can also be set with the +OPTIONS line, e.g. \"num:t\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1598 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1599 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1600
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1601 (defcustom org-export-with-toc t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1602 "Non-nil means, create a table of contents in exported files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1603 The TOC contains headlines with levels up to`org-export-headline-levels'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1604
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1605 Headlines which contain any TODO items will be marked with \"(*)\" in
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1606 ASCII export, and with red color in HTML output.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1607
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1608 In HTML output, the TOC will be clickable.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1609
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1610 This option can also be set with the +OPTIONS line, e.g. \"toc:nil\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1611 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1612 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1613
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1614 (defcustom org-export-mark-todo-in-toc nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1615 "Non-nil means, mark TOC lines that contain any open TODO items."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1616 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1617 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1618
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1619 (defcustom org-export-preserve-breaks nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1620 "Non-nil means, preserve all line breaks when exporting.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1621 Normally, in HTML output paragraphs will be reformatted. In ASCII
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1622 export, line breaks will always be preserved, regardless of this variable.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1623
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1624 This option can also be set with the +OPTIONS line, e.g. \"\\n:t\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1625 :group 'org-export-general
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1626 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1627
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1628 (defgroup org-export-translation nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1629 "Options for translating special ascii sequences for the export backends."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1630 :tag "Org Export Translation"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1631 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1632
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1633 (defcustom org-export-with-emphasize t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1634 "Non-nil means, interpret *word*, /word/, and _word_ as emphasized text.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1635 If the export target supports emphasizing text, the word will be
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1636 typeset in bold, italic, or underlined, respectively. Works only for
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1637 single words, but you can say: I *really* *mean* *this*.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1638 Not all export backends support this.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1639
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1640 This option can also be set with the +OPTIONS line, e.g. \"*:nil\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1641 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1642 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1643
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1644 (defcustom org-export-with-sub-superscripts t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1645 "Non-nil means, interpret \"_\" and \"^\" for export.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1646 When this option is turned on, you can use TeX-like syntax for sub- and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1647 superscripts. Several characters after \"_\" or \"^\" will be
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1648 considered as a single item - so grouping with {} is normally not
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1649 needed. For example, the following things will be parsed as single
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1650 sub- or superscripts.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1651
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1652 10^24 or 10^tau several digits will be considered 1 item.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1653 10^-12 or 10^-tau a leading sign with digits or a word
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1654 x^2-y^3 will be read as x^2 - y^3, because items are
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1655 terminated by almost any nonword/nondigit char.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1656 x_{i^2} or x^(2-i) braces or parenthesis do grouping.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1657
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1658 Still, ambiguity is possible - so when in doubt use {} to enclose the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1659 sub/superscript.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1660 Not all export backends support this, but HTML does.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1661
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1662 This option can also be set with the +OPTIONS line, e.g. \"^:nil\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1663 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1664 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1665
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1666 (defcustom org-export-with-TeX-macros t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1667 "Non-nil means, interpret simple TeX-like macros when exporting.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1668 For example, HTML export converts \\alpha to &alpha; and \\AA to &Aring;.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1669 No only real TeX macros will work here, but the standard HTML entities
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1670 for math can be used as macro names as well. For a list of supported
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1671 names in HTML export, see the constant `org-html-entities'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1672 Not all export backends support this.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1673
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1674 This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1675 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1676 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1677
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1678 (defcustom org-export-with-fixed-width t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1679 "Non-nil means, lines starting with \":\" will be in fixed width font.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1680 This can be used to have pre-formatted text, fragments of code etc. For
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1681 example:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1682 : ;; Some Lisp examples
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1683 : (while (defc cnt)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1684 : (ding))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1685 will be looking just like this in also HTML. See also the QUOTE keyword.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1686 Not all export backends support this.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1687
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1688 This option can also be set with the +OPTIONS line, e.g. \"::nil\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1689 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1690 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1691
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1692 (defcustom org-match-sexp-depth 3
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1693 "Number of stacked braces for sub/superscript matching.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1694 This has to be set before loading org.el to be effective."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1695 :group 'org-export-translation
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1696 :type 'integer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1697
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1698 (defgroup org-export-tables nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1699 "Options for exporting tables in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1700 :tag "Org Export Tables"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1701 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1702
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1703 (defcustom org-export-with-tables t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1704 "If non-nil, lines starting with \"|\" define a table.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1705 For example:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1706
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1707 | Name | Address | Birthday |
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1708 |-------------+----------+-----------|
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1709 | Arthur Dent | England | 29.2.2100 |
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1710
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1711 Not all export backends support this.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1712
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1713 This option can also be set with the +OPTIONS line, e.g. \"|:nil\"."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1714 :group 'org-export-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1715 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1716
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1717 (defcustom org-export-highlight-first-table-line t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1718 "Non-nil means, highlight the first table line.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1719 In HTML export, this means use <th> instead of <td>.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1720 In tables created with table.el, this applies to the first table line.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1721 In Org-mode tables, all lines before the first horizontal separator
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1722 line will be formatted with <th> tags."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1723 :group 'org-export-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1724 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1725
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1726 (defcustom org-export-table-remove-special-lines t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1727 "Remove special lines and marking characters in calculating tables.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1728 This removes the special marking character column from tables that are set
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1729 up for spreadsheet calculations. It also removes the entire lines
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1730 marked with `!', `_', or `^'. The lines with `$' are kept, because
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1731 the values of constants may be useful to have."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1732 :group 'org-export-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1733 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1734
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1735 (defcustom org-export-prefer-native-exporter-for-tables nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1736 "Non-nil means, always export tables created with table.el natively.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1737 Natively means, use the HTML code generator in table.el.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1738 When nil, Org-mode's own HTML generator is used when possible (i.e. if
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1739 the table does not use row- or column-spanning). This has the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1740 advantage, that the automatic HTML conversions for math symbols and
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1741 sub/superscripts can be applied. Org-mode's HTML generator is also
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1742 much faster."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1743 :group 'org-export-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1744 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1745
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1746 (defgroup org-export-ascii nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1747 "Options specific for ASCII export of Org-mode files."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1748 :tag "Org Export ASCII"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1749 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1750
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1751 (defcustom org-export-ascii-show-new-buffer t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1752 "Non-nil means, popup buffer containing the exported ASCII text.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1753 Otherwise the buffer will just be saved to a file and stay hidden."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1754 :group 'org-export-ascii
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1755 :type 'boolean)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1756
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1757 (defgroup org-export-xml nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1758 "Options specific for XML export of Org-mode files."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1759 :tag "Org Export XML"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1760 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1761
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1762 (defcustom org-export-xml-type 'xoxo ;kw, if we have only one.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1763 "The kind of XML to be produced by the XML exporter.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1764 Allowed values are:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1765 xoxo The XOXO exporter."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1766 :group 'org-export-xml
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1767 :type '(choice
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1768 (const :tag "XOXO" xoxo)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1769
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1770 (defgroup org-export-html nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1771 "Options specific for HTML export of Org-mode files."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1772 :tag "Org Export HTML"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1773 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1774
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
1775 (defcustom org-export-html-style
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1776 "<style type=\"text/css\">
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1777 html {
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1778 font-family: Times, serif;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1779 font-size: 12pt;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1780 }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1781 .title { text-align: center; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1782 .todo, .deadline { color: red; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1783 .done { color: green; }
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
1784 .target { background-color: lavender; }
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1785 pre {
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1786 border: 1pt solid #AEBDCC;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1787 background-color: #F3F5F7;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1788 padding: 5pt;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1789 font-family: courier, monospace;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1790 }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1791 table { border-collapse: collapse; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1792 td, th {
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1793 vertical-align: top;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1794 border: 1pt solid #ADB9CC;
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1795 }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1796 </style>"
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1797 "The default style specification for exported HTML files.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1798 Since there are different ways of setting style information, this variable
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1799 needs to contain the full HTML structure to provide a style, including the
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
1800 surrounding HTML tags. The style specifications should include definitions
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1801 for new classes todo, done, title, and deadline. For example, legal values
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
1802 would be:
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1803
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1804 <style type=\"text/css\">
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
1805 p { font-weight: normal; color: gray; }
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
1806 h1 { color: black; }
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1807 .title { text-align: center; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1808 .todo, .deadline { color: red; }
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1809 .done { color: green; }
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1810 </style>
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1811
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1812 or, if you want to keep the style in a file,
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1813
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1814 <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1815
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
1816 As the value of this option simply gets inserted into the HTML <head> header,
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
1817 you can \"misuse\" it to add arbitrary text to the header."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1818 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1819 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1820
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1821 (defcustom org-export-html-inline-images t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1822 "Non-nil means, inline images into exported HTML pages.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1823 The link will still be to the original location of the image file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1824 So if you are moving the page, lets say to your public HTML site,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1825 you will have to move the image and maybe change the link."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1826 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1827 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1828
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1829 (defcustom org-export-html-expand t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1830 "Non-nil means, for HTML export, treat @<...> as HTML tag.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1831 When nil, these tags will be exported as plain text and therefore
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1832 not be interpreted by a browser.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1833
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1834 This option can also be set with the +OPTIONS line, e.g. \"@:nil\"."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1835 :group 'org-export-html
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
1836 :type 'boolean)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
1837
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1838 (defcustom org-export-html-table-tag
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1839 "<table border=1 cellspacing=0 cellpadding=6>"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1840 "The HTML tag used to start a table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1841 This must be a <table> tag, but you may change the options like
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1842 borders and spacing."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1843 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1844 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1845
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1846 (defcustom org-export-html-with-timestamp nil
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
1847 "If non-nil, write `org-export-html-html-helper-timestamp'
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
1848 into the exported HTML text. Otherwise, the buffer will just be saved
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1849 to a file."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1850 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1851 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1852
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1853 (defcustom org-export-html-html-helper-timestamp
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1854 "<br><br><hr><p><!-- hhmts start --> <!-- hhmts end -->\n"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1855 "The HTML tag used as timestamp delimiter for HTML-helper-mode."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1856 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1857 :type 'string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1858
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1859 (defcustom org-export-html-show-new-buffer nil
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
1860 "Non-nil means, popup buffer containing the exported html text.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1861 Otherwise, the buffer will just be saved to a file and stay hidden."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1862 :group 'org-export-html
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1863 :type 'boolean)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1864
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1865 (defgroup org-export-icalendar nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1866 "Options specific for iCalendar export of Org-mode files."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1867 :tag "Org Export iCalendar"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1868 :group 'org-export)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1869
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1870 (defcustom org-combined-agenda-icalendar-file "~/org.ics"
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1871 "The file name for the iCalendar file covering all agenda files.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1872 This file is created with the command \\[org-export-icalendar-all-agenda-files]."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1873 :group 'org-export-icalendar
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1874 :type 'file)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1875
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1876 (defcustom org-icalendar-include-todo nil
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1877 "Non-nil means, export to iCalendar files should also cover TODO items."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1878 :group 'org-export-icalendar
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1879 :type 'boolean)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1880
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1881 (defcustom org-icalendar-combined-name "OrgMode"
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1882 "Calendar name for the combined iCalendar representing all agenda files."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1883 :group 'org-export-icalendar
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1884 :type 'string)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
1885
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1886 (defgroup org-font-lock nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1887 "Font-lock settings for highlighting in Org-mode."
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1888 :tag "Org Font Lock"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1889 :group 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1890
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1891 (defcustom org-level-color-stars-only nil
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1892 "Non-nil means fontify only the stars in each headline.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1893 When nil, the entire headline is fontified.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1894 Changing it requires restart of `font-lock-mode' to become effective
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1895 also in regions already fontified."
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1896 :group 'org-font-lock
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1897 :type 'boolean)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1898
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1899 (defcustom org-hide-leading-stars nil
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1900 "Non-nil means, hide the first N-1 stars in a headline.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1901 This works by using the face `org-hide' for these stars. This
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1902 face is white for a light background, and black for a dark
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1903 background. You may have to customize the face `org-hide' to
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1904 make this work.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1905 Changing it requires restart of `font-lock-mode' to become effective
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1906 also in regions already fontified."
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1907 :group 'org-font-lock
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1908 :type 'boolean)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1909
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1910 (defcustom org-fontify-done-headline nil
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1911 "Non-nil means, change the face of a headline if it is marked DONE.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1912 Normally, only the TODO/DONE keyword indicates the state of a headline.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1913 When this is non-nil, the headline after the keyword is set to the
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1914 `org-headline-done' as an additional indication."
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1915 :group 'org-font-lock
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1916 :type 'boolean)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1917
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1918 (defcustom org-fontify-emphasized-text t
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1919 "Non-nil means fontify *bold*, /italic/ and _underlined_ text.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1920 Changing this variable requires a restart of Emacs to take effect."
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1921 :group 'org-font-lock
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1922 :type 'boolean)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
1923
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1924 (defgroup org-faces nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1925 "Faces in Org-mode."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1926 :tag "Org Faces"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1927 :group 'org-font-lock)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1928
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
1929 (defface org-hide
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
1930 '(
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
1931 (((type tty) (class color)) (:foreground "white"))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
1932 (((class color) (background light)) (:foreground "white"))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
1933 (((class color) (background dark)) (:foreground "black"))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
1934 (t (:inverse-video nil)))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
1935 "Face used for level 1 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1936 :group 'org-faces)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
1937
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1938 (defface org-level-1 ;; font-lock-function-name-face
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1939 '((((type tty) (class color)) (:foreground "blue" :weight bold))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1940 (((class color) (background light)) (:foreground "Blue"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1941 (((class color) (background dark)) (:foreground "LightSkyBlue"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1942 (t (:inverse-video t :bold t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1943 "Face used for level 1 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1944 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1945
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1946 (defface org-level-2 ;; font-lock-variable-name-face
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1947 '((((type tty) (class color)) (:foreground "yellow" :weight light))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1948 (((class color) (background light)) (:foreground "DarkGoldenrod"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1949 (((class color) (background dark)) (:foreground "LightGoldenrod"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1950 (t (:bold t :italic t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1951 "Face used for level 2 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1952 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1953
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1954 (defface org-level-3 ;; font-lock-keyword-face
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1955 '((((type tty) (class color)) (:foreground "cyan" :weight bold))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1956 (((class color) (background light)) (:foreground "Purple"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1957 (((class color) (background dark)) (:foreground "Cyan"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1958 (t (:bold t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1959 "Face used for level 3 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1960 :group 'org-faces)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
1961
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
1962 (defface org-level-4 ;; font-lock-comment-face
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1963 '((((type tty pc) (class color) (background light)) (:foreground "red"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1964 (((type tty pc) (class color) (background dark)) (:foreground "red1"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1965 (((class color) (background light)) (:foreground "Firebrick"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1966 (((class color) (background dark)) (:foreground "chocolate1"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1967 (t (:bold t :italic t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1968 "Face used for level 4 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1969 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1970
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1971 (defface org-level-5 ;; font-lock-type-face
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1972 '((((type tty) (class color)) (:foreground "green"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1973 (((class color) (background light)) (:foreground "ForestGreen"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1974 (((class color) (background dark)) (:foreground "PaleGreen"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1975 (t (:bold t :underline t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1976 "Face used for level 5 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1977 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1978
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1979 (defface org-level-6 ;; font-lock-constant-face
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1980 '((((type tty) (class color)) (:foreground "magenta"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1981 (((class color) (background light)) (:foreground "CadetBlue"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1982 (((class color) (background dark)) (:foreground "Aquamarine"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1983 (t (:bold t :underline t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1984 "Face used for level 6 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1985 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1986
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1987 (defface org-level-7 ;; font-lock-builtin-face
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1988 '((((type tty) (class color)) (:foreground "blue" :weight light))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1989 (((class color) (background light)) (:foreground "Orchid"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1990 (((class color) (background dark)) (:foreground "LightSteelBlue"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1991 (t (:bold t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1992 "Face used for level 7 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
1993 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1994
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
1995 (defface org-level-8 ;; font-lock-string-face
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1996 '((((type tty) (class color)) (:foreground "green"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1997 (((class color) (background light)) (:foreground "RosyBrown"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1998 (((class color) (background dark)) (:foreground "LightSalmon"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1999 (t (:italic t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2000 "Face used for level 8 headlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2001 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2002
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
2003 (defface org-special-keyword ;; font-lock-string-face
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
2004 '((((type tty) (class color)) (:foreground "green"))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
2005 (((class color) (background light)) (:foreground "RosyBrown"))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
2006 (((class color) (background dark)) (:foreground "LightSalmon"))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
2007 (t (:italic t)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2008 "Face used for special keywords."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2009 :group 'org-faces)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
2010
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2011 (defface org-warning ;; font-lock-warning-face
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2012 '((((type tty) (class color)) (:foreground "red"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2013 (((class color) (background light)) (:foreground "Red" :bold t))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2014 (((class color) (background dark)) (:foreground "Red1" :bold t))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2015 ; (((class color) (background dark)) (:foreground "Pink" :bold t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2016 (t (:inverse-video t :bold t)))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2017 "Face for deadlines and TODO keywords."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2018 :group 'org-faces)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2019
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2020 (defface org-headline-done ;; font-lock-string-face
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2021 '((((type tty) (class color)) (:foreground "green"))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2022 (((class color) (background light)) (:foreground "RosyBrown"))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2023 (((class color) (background dark)) (:foreground "LightSalmon"))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2024 (t (:italic t)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2025 "Face used to indicate that a headline is DONE. See also the variable
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2026 `org-fontify-done-headline'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2027 :group 'org-faces)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2028
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2029 ;; Inheritance does not work for xemacs. So we just copy...
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2030
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2031 (defface org-deadline-announce
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2032 '((((type tty) (class color)) (:foreground "blue" :weight bold))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2033 (((class color) (background light)) (:foreground "Blue"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2034 (((class color) (background dark)) (:foreground "LightSkyBlue"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2035 (t (:inverse-video t :bold t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2036 "Face for upcoming deadlines."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2037 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2038
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2039 (defface org-scheduled-today
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2040 '((((type tty) (class color)) (:foreground "green"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2041 (((class color) (background light)) (:foreground "DarkGreen"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2042 (((class color) (background dark)) (:foreground "PaleGreen"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2043 (t (:bold t :underline t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2044 "Face for items scheduled for a certain day."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2045 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2046
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2047 (defface org-scheduled-previously
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2048 '((((type tty pc) (class color) (background light)) (:foreground "red"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2049 (((type tty pc) (class color) (background dark)) (:foreground "red1"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2050 (((class color) (background light)) (:foreground "Firebrick"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2051 (((class color) (background dark)) (:foreground "chocolate1"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2052 (t (:bold t :italic t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2053 "Face for items scheduled previously, and not yet done."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2054 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2055
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2056 (defface org-formula
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2057 '((((type tty pc) (class color) (background light)) (:foreground "red"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2058 (((type tty pc) (class color) (background dark)) (:foreground "red1"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2059 (((class color) (background light)) (:foreground "Firebrick"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2060 (((class color) (background dark)) (:foreground "chocolate1"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2061 (t (:bold t :italic t)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2062 "Face for formulas."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2063 :group 'org-faces)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2064
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
2065 (defface org-link
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2066 '((((type tty) (class color)) (:foreground "cyan" :weight bold))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2067 (((class color) (background light)) (:foreground "Purple" :underline t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2068 (((class color) (background dark)) (:foreground "Cyan" :underline t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2069 (t (:bold t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2070 "Face for links."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2071 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2072
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2073 (defface org-tag
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2074 '((((type tty) (class color)) (:weight bold))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2075 (((class color) (background light)) (:weight bold))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2076 (((class color) (background dark)) (:weight bold))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2077 (t (:bold t)))
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2078 "Face for tags."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2079 :group 'org-faces)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2080
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2081 (defface org-done ;; font-lock-type-face
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2082 '((((type tty) (class color)) (:foreground "green"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2083 (((class color) (background light)) (:foreground "ForestGreen" :bold t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2084 (((class color) (background dark)) (:foreground "PaleGreen" :bold t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2085 (t (:bold t :underline t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2086 "Face used for DONE."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2087 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2088
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2089 (defface org-table ;; font-lock-function-name-face
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2090 '((((type tty) (class color)) (:foreground "blue" :weight bold))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2091 (((class color) (background light)) (:foreground "Blue"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2092 (((class color) (background dark)) (:foreground "LightSkyBlue"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2093 (t (:inverse-video t :bold t)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2094 "Face used for tables."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2095 :group 'org-faces)
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2096
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
2097 (defface org-time-grid ;; font-lock-variable-name-face
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
2098 '((((type tty) (class color)) (:foreground "yellow" :weight light))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
2099 (((class color) (background light)) (:foreground "DarkGoldenrod"))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
2100 (((class color) (background dark)) (:foreground "LightGoldenrod"))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
2101 (t (:bold t :italic t)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2102 "Face used for time grids."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2103 :group 'org-faces)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
2104
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2105 (defvar org-level-faces
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2106 '(org-level-1 org-level-2 org-level-3 org-level-4
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2107 org-level-5 org-level-6 org-level-7 org-level-8
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2108 ))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2109 (defvar org-n-levels (length org-level-faces))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2110
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2111
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2112 ;; Variables for pre-computed regular expressions, all buffer local
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2113 (defvar org-done-string nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2114 "The last string in `org-todo-keywords', indicating an item is DONE.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2115 (make-variable-buffer-local 'org-done-string)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2116 (defvar org-todo-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2117 "Matches any of the TODO state keywords.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2118 (make-variable-buffer-local 'org-todo-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2119 (defvar org-not-done-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2120 "Matches any of the TODO state keywords except the last one.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2121 (make-variable-buffer-local 'org-not-done-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2122 (defvar org-todo-line-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2123 "Matches a headline and puts TODO state into group 2 if present.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2124 (make-variable-buffer-local 'org-todo-line-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2125 (defvar org-nl-done-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2126 "Matches newline followed by a headline with the DONE keyword.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2127 (make-variable-buffer-local 'org-nl-done-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2128 (defvar org-looking-at-done-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2129 "Matches the DONE keyword a point.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2130 (make-variable-buffer-local 'org-looking-at-done-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2131 (defvar org-todo-kwd-priority-p nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2132 "Do TODO items have priorities?")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2133 (make-variable-buffer-local 'org-todo-kwd-priority-p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2134 (defvar org-todo-kwd-max-priority nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2135 "Maximum priority of TODO items.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2136 (make-variable-buffer-local 'org-todo-kwd-max-priority)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2137 (defvar org-ds-keyword-length 12
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2138 "Maximum length of the Deadline and SCHEDULED keywords.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2139 (make-variable-buffer-local 'org-ds-keyword-length)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2140 (defvar org-deadline-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2141 "Matches the DEADLINE keyword.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2142 (make-variable-buffer-local 'org-deadline-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2143 (defvar org-deadline-time-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2144 "Matches the DEADLINE keyword together with a time stamp.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2145 (make-variable-buffer-local 'org-deadline-time-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2146 (defvar org-deadline-line-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2147 "Matches the DEADLINE keyword and the rest of the line.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2148 (make-variable-buffer-local 'org-deadline-line-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2149 (defvar org-scheduled-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2150 "Matches the SCHEDULED keyword.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2151 (make-variable-buffer-local 'org-scheduled-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2152 (defvar org-scheduled-time-regexp nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2153 "Matches the SCHEDULED keyword together with a time stamp.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2154 (make-variable-buffer-local 'org-scheduled-time-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2155
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2156 (defun org-set-regexps-and-options ()
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2157 "Precompute regular expressions for current buffer."
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2158 (when (eq major-mode 'org-mode)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2159 (let ((re (org-make-options-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2160 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2161 "STARTUP" "ARCHIVE")))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2162 (splitre "[ \t]+")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2163 kwds int key value cat arch)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2164 (save-excursion
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2165 (save-restriction
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2166 (widen)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2167 (goto-char (point-min))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2168 (while (re-search-forward re nil t)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2169 (setq key (match-string 1) value (match-string 2))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2170 (cond
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2171 ((equal key "CATEGORY")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2172 (if (string-match "[ \t]+$" value)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2173 (setq value (replace-match "" t t value)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2174 (setq cat (intern value)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2175 ((equal key "SEQ_TODO")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2176 (setq int 'sequence
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2177 kwds (append kwds (org-split-string value splitre))))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2178 ((equal key "PRI_TODO")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2179 (setq int 'priority
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2180 kwds (append kwds (org-split-string value splitre))))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2181 ((equal key "TYP_TODO")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2182 (setq int 'type
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2183 kwds (append kwds (org-split-string value splitre))))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2184 ((equal key "STARTUP")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2185 (let ((opts (org-split-string value splitre))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2186 (set '(("fold" org-startup-folded t)
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
2187 ("overview" org-startup-folded t)
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2188 ("nofold" org-startup-folded nil)
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
2189 ("showall" org-startup-folded nil)
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2190 ("content" org-startup-folded content)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2191 ("hidestars" org-hide-leading-stars t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2192 ("showstars" org-hide-leading-stars nil)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2193 ("odd" org-odd-levels-only t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2194 ("oddeven" org-odd-levels-only nil)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2195 ("align" org-startup-align-all-tables t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2196 ("noalign" org-startup-align-all-tables nil)
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2197 ("dlcheck" org-startup-with-deadline-check t)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2198 ("nodlcheck" org-startup-with-deadline-check nil)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2199 l var val)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2200 (while (setq l (assoc (pop opts) set))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2201 (setq var (nth 1 l) val (nth 2 l))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2202 (set (make-local-variable var) val))))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2203 ((equal key "ARCHIVE")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2204 (string-match " *$" value)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2205 (setq arch (replace-match "" t t value))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2206 (remove-text-properties 0 (length arch)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2207 '(face t fontified t) arch)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2208 )))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2209 (and cat (set (make-local-variable 'org-category) cat))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2210 (and kwds (set (make-local-variable 'org-todo-keywords) kwds))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2211 (and arch (set (make-local-variable 'org-archive-location) arch))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2212 (and int (set (make-local-variable 'org-todo-interpretation) int)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2213 ;; Compute the regular expressions and other local variables
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2214 (setq org-todo-kwd-priority-p (equal org-todo-interpretation 'priority)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2215 org-todo-kwd-max-priority (1- (length org-todo-keywords))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2216 org-ds-keyword-length (+ 2 (max (length org-deadline-string)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2217 (length org-scheduled-string)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2218 org-done-string
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2219 (nth (1- (length org-todo-keywords)) org-todo-keywords)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2220 org-todo-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2221 (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2222 "\\|") "\\)\\>")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2223 org-not-done-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2224 (concat "\\<\\("
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2225 (mapconcat 'regexp-quote
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2226 (nreverse (cdr (reverse org-todo-keywords)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2227 "\\|")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2228 "\\)\\>")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2229 org-todo-line-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2230 (concat "^\\(\\*+\\)[ \t]*\\("
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2231 (mapconcat 'regexp-quote org-todo-keywords "\\|")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2232 "\\)? *\\(.*\\)")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2233 org-nl-done-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2234 (concat "[\r\n]\\*+[ \t]+" org-done-string "\\>")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2235 org-looking-at-done-regexp (concat "^" org-done-string "\\>")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2236 org-deadline-regexp (concat "\\<" org-deadline-string)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2237 org-deadline-time-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2238 (concat "\\<" org-deadline-string " *<\\([^>]+\\)>")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2239 org-deadline-line-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2240 (concat "\\<\\(" org-deadline-string "\\).*")
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2241 org-scheduled-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2242 (concat "\\<" org-scheduled-string)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2243 org-scheduled-time-regexp
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2244 (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>"))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2245 (org-set-font-lock-defaults)))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
2246
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2247 ;; Tell the compiler about dynamically scoped variables,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2248 ;; and variables from other packages
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2249 (defvar zmacs-regions) ; XEmacs regions
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2250 (defvar original-date) ; dynamically scoped in calendar
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2251 (defvar org-old-auto-fill-inhibit-regexp) ; local variable used by `orgtbl-mode'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2252 (defvar orgtbl-mode-menu) ; defined when orgtbl mode get initialized
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2253 (defvar org-html-entities) ; defined later in this file
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2254 (defvar org-goto-start-pos) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2255 (defvar org-time-was-given) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2256 (defvar org-ts-what) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2257 (defvar mark-active) ; Emacs only, not available in XEmacs.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2258 (defvar timecnt) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2259 (defvar levels-open) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2260 (defvar title) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2261 (defvar author) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2262 (defvar email) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2263 (defvar text) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2264 (defvar entry) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2265 (defvar date) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2266 (defvar language) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2267 (defvar options) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2268 (defvar ans1) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2269 (defvar ans2) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2270 (defvar starting-day) ; local variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2271 (defvar include-all-loc) ; local variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2272 (defvar vm-message-pointer) ; from vm
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2273 (defvar vm-folder-directory) ; from vm
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2274 (defvar wl-summary-buffer-elmo-folder) ; from wanderlust
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2275 (defvar wl-summary-buffer-folder-name) ; from wanderlust
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2276 (defvar gnus-group-name) ; from gnus
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2277 (defvar gnus-article-current) ; from gnus
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2278 (defvar w3m-current-url) ; from w3m
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2279 (defvar mh-progs) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2280 (defvar mh-current-folder) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2281 (defvar mh-show-folder-buffer) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2282 (defvar mh-index-folder) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2283 (defvar mh-searcher) ; from MH-E
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2284 (defvar org-selected-point) ; dynamically scoped parameter
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2285 (defvar calendar-mode-map) ; from calendar.el
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2286 (defvar last-arg) ; local variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2287 (defvar remember-save-after-remembering) ; from remember.el
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2288 (defvar remember-data-file) ; from remember.el
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2289 (defvar annotation) ; from remember.el, dynamically scoped in `remember-mode'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2290 (defvar initial) ; from remember.el, dynamically scoped in `remember-mode'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2291 (defvar orgtbl-mode) ; defined later in this file
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2292 ;;; Define the mode
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2293
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2294 (defvar org-mode-map (copy-keymap outline-mode-map)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2295 "Keymap for Org-mode.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2296
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2297 (defvar org-struct-menu) ; defined later in this file
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2298 (defvar org-org-menu) ; defined later in this file
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2299 (defvar org-tbl-menu) ; defined later in this file
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2300
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2301 ;; We use a before-change function to check if a table might need
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2302 ;; an update.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2303 (defvar org-table-may-need-update t
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2304 "Indicates that a table might need an update.
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
2305 This variable is set by `org-before-change-function'.
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
2306 `org-table-align' sets it back to nil.")
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2307 (defvar org-mode-hook nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2308 (defvar org-inhibit-startup nil) ; Dynamically-scoped param.
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
2309 (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param.
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2310
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2311
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2312 ;;;###autoload
62712
b9935dc86aa4 (org-mode): Use `define-derived-mode' to define
Carsten Dominik <dominik@science.uva.nl>
parents: 62546
diff changeset
2313 (define-derived-mode org-mode outline-mode "Org"
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
2314 "Outline-based notes management and organizer, alias
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2315 \"Carsten's outline-mode for keeping track of everything.\"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2316
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2317 Org-mode develops organizational tasks around a NOTES file which
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2318 contains information about projects as plain text. Org-mode is
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2319 implemented on top of outline-mode, which is ideal to keep the content
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2320 of large files well structured. It supports ToDo items, deadlines and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2321 time stamps, which magically appear in the diary listing of the Emacs
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2322 calendar. Tables are easily created with a built-in table editor.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2323 Plain text URL-like links connect to websites, emails (VM), Usenet
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2324 messages (Gnus), BBDB entries, and any files related to the project.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2325 For printing and sharing of notes, an Org-mode file (or a part of it)
62712
b9935dc86aa4 (org-mode): Use `define-derived-mode' to define
Carsten Dominik <dominik@science.uva.nl>
parents: 62546
diff changeset
2326 can be exported as a structured ASCII or HTML file.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2327
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
2328 The following commands are available:
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2329
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2330 \\{org-mode-map}"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2331 (easy-menu-add org-org-menu)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2332 (easy-menu-add org-tbl-menu)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2333 (org-install-agenda-files-menu)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2334 (if org-descriptive-links (org-add-to-invisibility-spec '(org-link)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2335 (org-add-to-invisibility-spec '(org-cwidth))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2336 (setq outline-regexp "\\*+")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2337 ;;(setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2338 (setq outline-level 'org-outline-level)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2339 (when (and org-ellipsis (stringp org-ellipsis))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2340 (unless org-display-table
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2341 (setq org-display-table (make-display-table)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2342 (set-display-table-slot org-display-table
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2343 4 (string-to-vector org-ellipsis))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2344 (setq buffer-display-table org-display-table))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2345 (org-set-regexps-and-options)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2346 (if org-startup-truncated (setq truncate-lines t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2347 (set (make-local-variable 'font-lock-unfontify-region-function)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2348 'org-unfontify-region)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2349 ;; Activate before-change-function
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
2350 (set (make-local-variable 'org-table-may-need-update) t)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2351 (org-add-hook 'before-change-functions 'org-before-change-function nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2352 'local)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2353 ;; Paragraphs and auto-filling
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
2354 (org-set-autofill-regexps)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2355 (org-update-radio-target-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2356 ;; Settings for Calc embedded mode
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2357 (set (make-local-variable 'calc-embedded-open-formula) "|\\|\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2358 (set (make-local-variable 'calc-embedded-close-formula) "|\\|\n")
62712
b9935dc86aa4 (org-mode): Use `define-derived-mode' to define
Carsten Dominik <dominik@science.uva.nl>
parents: 62546
diff changeset
2359 (if (and org-insert-mode-line-in-empty-file
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2360 (interactive-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2361 (= (point-min) (point-max)))
62712
b9935dc86aa4 (org-mode): Use `define-derived-mode' to define
Carsten Dominik <dominik@science.uva.nl>
parents: 62546
diff changeset
2362 (insert " -*- mode: org -*-\n\n"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2363
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2364 ;; Get rid of Outline menus, they are not needed
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2365 ;; Need to do this here because define-derived-mode sets up
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2366 ;; the keymap so late.
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2367 (if (featurep 'xemacs)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2368 (progn
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2369 (delete-menu-item '("Headings"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2370 (delete-menu-item '("Show"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2371 (delete-menu-item '("Hide"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2372 (set-menubar-dirty-flag))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2373 (define-key org-mode-map [menu-bar headings] 'undefined)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2374 (define-key org-mode-map [menu-bar hide] 'undefined)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2375 (define-key org-mode-map [menu-bar show] 'undefined))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2376
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2377 (unless org-inhibit-startup
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2378 (if org-startup-align-all-tables
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2379 (org-table-map-tables 'org-table-align))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2380 (if org-startup-with-deadline-check
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2381 (call-interactively 'org-check-deadlines)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2382 (cond
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2383 ((eq org-startup-folded t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2384 (org-cycle '(4)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2385 ((eq org-startup-folded 'content)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2386 (let ((this-command 'org-cycle) (last-command 'org-cycle))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2387 (org-cycle '(4)) (org-cycle '(4))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2388
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2389 (defsubst org-current-line (&optional pos)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2390 (+ (if (bolp) 1 0) (count-lines (point-min) (or pos (point)))))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2391
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2392 (defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2393 mouse-map t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2394 "Properties to remove when a string without properties is wanted.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2395
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2396 (defsubst org-match-string-no-properties (num &optional string)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2397 (if (featurep 'xemacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2398 (let ((s (match-string num string)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2399 (remove-text-properties 0 (length s) org-rm-props s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2400 s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2401 (match-string-no-properties num string)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2402
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2403 (defun org-current-time ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2404 "Current time, possibly rounded to `org-time-stamp-rounding-minutes'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2405 (if (> org-time-stamp-rounding-minutes 0)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2406 (let ((r org-time-stamp-rounding-minutes)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2407 (time (decode-time)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2408 (apply 'encode-time
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2409 (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2410 (nthcdr 2 time))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2411 (current-time)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2412
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2413 (defun org-add-props (string plist &rest props)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2414 "Add text properties to entire string, from beginning to end.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2415 PLIST may be a list of properties, PROPS are individual properties and values
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2416 that will be added to PLIST. Returns the string that was modified."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2417 (add-text-properties
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2418 0 (length string) (if props (append plist props) plist) string)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
2419 string)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2420 (put 'org-add-props 'lisp-indent-function 2)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2421
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
2422
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2423 ;;; Font-Lock stuff
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2424
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2425 (defvar org-mouse-map (make-sparse-keymap))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
2426 (define-key org-mouse-map
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2427 (if (featurep 'xemacs) [button2] [mouse-2]) 'org-open-at-mouse)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2428 (define-key org-mouse-map
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2429 (if (featurep 'xemacs) [button3] [mouse-3]) 'org-find-file-at-mouse)
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
2430 (when org-mouse-1-follows-link
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
2431 (define-key org-mouse-map [follow-link] 'mouse-face))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2432 (when org-tab-follows-link
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2433 (define-key org-mouse-map [(tab)] 'org-open-at-point)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2434 (define-key org-mouse-map "\C-i" 'org-open-at-point))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2435 (when org-return-follows-link
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2436 (define-key org-mouse-map [(return)] 'org-open-at-point)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2437 (define-key org-mouse-map "\C-m" 'org-open-at-point))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2438
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2439 (require 'font-lock)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2440
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2441 (defconst org-non-link-chars "]\t\n\r<>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2442 (defconst org-link-types '("https?" "ftp" "mailto" "file" "news" "bbdb" "vm"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2443 "wl" "mhe" "rmail" "gnus" "shell"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2444 (defconst org-link-re-with-space
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2445 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2446 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2447 "\\([^" org-non-link-chars " ]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2448 "[^" org-non-link-chars "]*"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2449 "[^" org-non-link-chars " ]\\)>?")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2450 "Matches a link with spaces, optional angular brackets around it.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2451
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2452 (defconst org-link-re-with-space2
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2453 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2454 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2455 "\\([^" org-non-link-chars " ]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2456 "[^]\t\n\r]*"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2457 "[^" org-non-link-chars " ]\\)>?")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2458 "Matches a link with spaces, optional angular brackets around it.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2459
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2460 (defconst org-angle-link-re
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2461 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2462 "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2463 "\\([^" org-non-link-chars " ]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2464 "[^" org-non-link-chars "]*"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2465 "\\)>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2466 "Matches link with angular brackets, spaces are allowed.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2467 (defconst org-plain-link-re
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2468 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2469 "\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2470 "\\([^]\t\n\r<>,;() ]+\\)")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2471 "Matches plain link, without spaces.")
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
2472
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2473 (defconst org-bracket-link-regexp
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2474 "\\[\\[\\([^]]+\\)\\]\\(\\[\\([^]]+\\)\\]\\)?\\]"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2475 "Matches a link in double brackets.")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2476
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2477 (defconst org-bracket-link-analytic-regexp
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2478 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2479 "\\[\\["
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2480 "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2481 "\\([^]]+\\)"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2482 "\\]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2483 "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2484 "\\]"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2485 ; 1: http:
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2486 ; 2: http
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2487 ; 3: path
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2488 ; 4: [desc]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2489 ; 5: desc
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2490
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2491
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2492 (defconst org-ts-lengths
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2493 (cons (length (format-time-string (car org-time-stamp-formats)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2494 (length (format-time-string (cdr org-time-stamp-formats))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2495 "This holds the lengths of the two different time formats.")
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
2496 (defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*?\\)>"
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
2497 "Regular expression for fast time stamp matching.")
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
2498 (defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*?\\)[]>]"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2499 "Regular expression for fast time stamp matching.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2500 (defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\([^0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2501 "Regular expression matching time strings for analysis.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2502 (defconst org-ts-regexp2 (concat "<" org-ts-regexp1 ">")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2503 "Regular expression matching time stamps, with groups.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2504 (defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2505 "Regular expression matching a time stamp range.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2506 (defconst org-tsr-regexp (concat org-ts-regexp "\\(--?-?"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2507 org-ts-regexp "\\)?")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2508 "Regular expression matching a time stamp or time stamp range.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2509
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2510 (defun org-activate-plain-links (limit)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2511 "Run through the buffer and add overlays to links."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2512 (if (re-search-forward org-plain-link-re limit t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2513 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2514 (add-text-properties (match-beginning 0) (match-end 0)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2515 (list 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2516 'keymap org-mouse-map
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2517 ))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2518 t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2519
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2520 (defun org-activate-angle-links (limit)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2521 "Run through the buffer and add overlays to links."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2522 (if (re-search-forward org-angle-link-re limit t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2523 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2524 (add-text-properties (match-beginning 0) (match-end 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2525 (list 'mouse-face 'highlight
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2526 'keymap org-mouse-map
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2527 ))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2528 t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2529
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2530 (defun org-activate-bracket-links (limit)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2531 "Run through the buffer and add overlays to bracketed links."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2532 (if (re-search-forward org-bracket-link-regexp limit t)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2533 (let* ((help (concat "LINK: " (org-match-string-no-properties 1)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2534 (ip (list 'invisible 'org-link 'intangible t 'rear-nonsticky t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2535 'keymap org-mouse-map 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2536 'help-echo help))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2537 (vp (list 'rear-nonsticky t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2538 'keymap org-mouse-map 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2539 'help-echo help)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2540 ;; We need to remove the invisible property here. Table narrowing
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2541 ;; may have made some of this invisible.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2542 (remove-text-properties (match-beginning 0) (match-end 0)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2543 '(invisible nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2544 (if (match-end 3)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2545 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2546 (add-text-properties (match-beginning 0) (match-beginning 3) ip)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2547 (add-text-properties (match-beginning 3) (match-end 3) vp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2548 (add-text-properties (match-end 3) (match-end 0) ip))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2549 (add-text-properties (match-beginning 0) (match-beginning 1) ip)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2550 (add-text-properties (match-beginning 1) (match-end 1) vp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2551 (add-text-properties (match-end 1) (match-end 0) ip))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2552 t)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2553
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2554 (defun org-activate-dates (limit)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2555 "Run through the buffer and add overlays to dates."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2556 (if (re-search-forward org-tsr-regexp limit t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2557 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2558 (add-text-properties (match-beginning 0) (match-end 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2559 (list 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2560 'keymap org-mouse-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2561 t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2562
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2563 (defvar org-target-link-regexp nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2564 "Regular expression matching radio targets in plain text.")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2565 (defvar org-target-regexp "<<\\([^<>\n\r]+\\)>>"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2566 "Regular expression matching a link target.")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2567 (defvar org-radio-target-regexp "<<<\\([^<>\n\r]+\\)>>>"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2568 "Regular expression matching a link target.")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2569
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2570 (defun org-activate-target-links (limit)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2571 "Run through the buffer and add overlays to target matches."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2572 (when org-target-link-regexp
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2573 (let ((case-fold-search t))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2574 (if (re-search-forward org-target-link-regexp limit t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2575 (progn
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2576 (add-text-properties (match-beginning 0) (match-end 0)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2577 (list 'mouse-face 'highlight
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2578 'keymap org-mouse-map
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2579 'help-echo "Radio target link"
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2580 'org-linked-text t))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2581 t)))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2582
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2583 (defun org-update-radio-target-regexp ()
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2584 "Find all radio targets in this file and update the regular expression."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2585 (interactive)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2586 (when (memq 'radio org-activate-links)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2587 (setq org-target-link-regexp
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2588 (org-make-target-link-regexp (org-all-targets 'radio)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2589 (org-restart-font-lock)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2590
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2591 (defun org-hide-wide-columns (limit)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2592 (let (s e)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2593 (setq s (text-property-any (point) (or limit (point-max))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2594 'org-cwidth t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2595 (when s
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2596 (setq e (next-single-property-change s 'org-cwidth))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2597 (add-text-properties s e '(invisible org-cwidth intangible t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2598 (goto-char e)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2599 t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2600
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2601 (defun org-restart-font-lock ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2602 "Restart font-lock-mode, to force refontification."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2603 (when (and (boundp 'font-lock-mode) font-lock-mode)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2604 (font-lock-mode -1)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2605 (font-lock-mode 1)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2606
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2607 (defun org-all-targets (&optional radio)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2608 "Return a list of all targets in this file.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2609 With optional argument RADIO, only find radio targets."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2610 (let ((re (if radio org-radio-target-regexp org-target-regexp))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2611 rtn)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2612 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2613 (goto-char (point-min))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2614 (while (re-search-forward re nil t)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2615 (add-to-list 'rtn (downcase (org-match-string-no-properties 1))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2616 rtn)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2617
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2618 (defun org-make-target-link-regexp (targets)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2619 "Make regular expression matching all strings in TARGETS.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2620 The regular expression finds the targets also if there is a line break
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2621 between words."
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2622 (and targets
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2623 (concat
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2624 "\\<\\("
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2625 (mapconcat
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2626 (lambda (x)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2627 (while (string-match " +" x)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2628 (setq x (replace-match "\\s-+" t t x)))
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2629 x)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2630 targets
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2631 "\\|")
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2632 "\\)\\>")))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2633
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
2634 (defvar org-camel-regexp "\\*?\\<[A-Z]+[a-z]+[A-Z][a-zA-Z]*\\>"
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
2635 "Matches CamelCase words, possibly with a star before it.")
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2636
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2637 (defun org-activate-camels (limit)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2638 "Run through the buffer and add overlays to dates."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2639 (if (re-search-forward org-camel-regexp limit t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2640 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2641 (add-text-properties (match-beginning 0) (match-end 0)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2642 (list 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2643 'keymap org-mouse-map))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2644 t)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2645
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2646 (defun org-activate-tags (limit)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2647 (if (re-search-forward "[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \r\n]" limit t)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2648 (progn
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2649 (add-text-properties (match-beginning 1) (match-end 1)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2650 (list 'mouse-face 'highlight
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2651 'keymap org-mouse-map))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2652 t)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
2653
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2654 (defun org-font-lock-level ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2655 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2656 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2657 (- (match-end 0) (match-beginning 0))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
2658
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2659 (defun org-outline-level ()
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2660 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2661 (looking-at outline-regexp)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2662 (if (match-beginning 1)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2663 (+ (org-get-string-indentation (match-string 1)) 1000)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2664 (- (match-end 0) (match-beginning 0)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2665
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2666 (defvar org-font-lock-keywords nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2667
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2668 (defun org-set-font-lock-defaults ()
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2669 (let* ((em org-fontify-emphasized-text)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2670 (lk org-activate-links)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2671 (org-font-lock-extra-keywords
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2672 (list
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2673 '("^\\(\\**\\)\\(\\*\\)\\(.*\\)" (1 (org-get-level-face 1))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2674 (2 (org-get-level-face 2)) (3 (org-get-level-face 3)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2675 '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2676 (1 'org-table))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2677 (if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2678 (if (memq 'plain lk) '(org-activate-plain-links (0 'org-link t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2679 (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2680 (if (memq 'radio lk) '(org-activate-target-links (0 'org-link t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2681 (if (memq 'date lk) '(org-activate-dates (0 'org-link t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2682 (if (memq 'camel lk) '(org-activate-camels (0 'org-link t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2683 (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2684 (if org-table-limit-column-width
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2685 '(org-hide-wide-columns (0 nil append)))
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2686 (list (concat "^\\*+[ \t]*" org-not-done-regexp)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2687 '(1 'org-warning t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2688 (list (concat "\\[#[A-Z]\\]") '(0 'org-special-keyword t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2689 (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2690 (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2691 (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2692 (if em '("\\(\\W\\|^\\)\\(\\*\\w+\\*\\)\\(\\W\\|$\\)" 2 'bold prepend))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2693 (if em '("\\(\\W\\|^\\)\\(/\\w+/\\)\\(\\W\\|$\\)" 2 'italic prepend))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2694 (if em '("\\(\\W\\|^\\)\\(_\\w+_\\)\\(\\W\\|$\\)" 2 'underline prepend))
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2695 (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2696 "\\|" org-quote-string "\\)\\>")
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2697 '(1 'org-special-keyword t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2698 '("^#.*" (0 'font-lock-comment-face t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2699 (if org-fontify-done-headline
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2700 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>")
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2701 '(1 'org-done t) '(2 'org-headline-done t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2702 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>")
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2703 '(1 'org-done t)))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2704 '("^[ \t]*\\(:.*\\)" (1 'org-table t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2705 '("| *\\(:?=[^|\n]*\\)" (1 'org-formula t))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2706 '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2707 (if org-format-transports-properties-p
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2708 '("| *\\(<[0-9]+>\\) *|" (1 'org-formula t)))
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2709 )))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
2710 (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
2711 ;; Now set the full font-lock-keywords
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2712 (set (make-local-variable 'org-font-lock-keywords)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2713 org-font-lock-extra-keywords)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2714 (set (make-local-variable 'font-lock-defaults)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2715 '(org-font-lock-keywords t nil nil backward-paragraph))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2716 (kill-local-variable 'font-lock-keywords) nil))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
2717
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2718 (defvar org-m nil)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2719 (defvar org-l nil)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2720 (defvar org-f nil)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2721 (defun org-get-level-face (n)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2722 "Get the right face for match N in font-lock matching of healdines."
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2723 (setq org-l (- (match-end 2) (match-beginning 1)))
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2724 (if org-odd-levels-only (setq org-l (1+ (/ org-l 2))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2725 ; (setq org-f (nth (1- (% org-l org-n-levels)) org-level-faces))
69685
15d9920a3a63 (org-get-level-face): Fixed bug with level counting.
Carsten Dominik <dominik@science.uva.nl>
parents: 69620
diff changeset
2726 (setq org-f (nth (% (1- org-l) org-n-levels) org-level-faces))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2727 (cond
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2728 ((eq n 1) (if org-hide-leading-stars 'org-hide org-f))
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2729 ((eq n 2) org-f)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2730 (t (if org-level-color-stars-only nil org-f))))
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2731
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2732 (defun org-unfontify-region (beg end &optional maybe_loudly)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2733 "Remove fontification and activation overlays from links."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2734 (font-lock-default-unfontify-region beg end)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2735 (let* ((buffer-undo-list t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2736 (inhibit-read-only t) (inhibit-point-motion-hooks t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2737 (inhibit-modification-hooks t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2738 deactivate-mark buffer-file-name buffer-file-truename)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2739 (remove-text-properties beg end
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2740 '(mouse-face nil keymap nil org-linked-text nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2741 invisible nil intangible nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2742 ;;; Visibility cycling
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2743
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2744 (defvar org-cycle-global-status nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2745 (defvar org-cycle-subtree-status nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2746 (defun org-cycle (&optional arg)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2747 "Visibility cycling for Org-mode.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2748
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2749 - When this function is called with a prefix argument, rotate the entire
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2750 buffer through 3 states (global cycling)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2751 1. OVERVIEW: Show only top-level headlines.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2752 2. CONTENTS: Show all headlines of all levels, but no body text.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2753 3. SHOW ALL: Show everything.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2754
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2755 - When point is at the beginning of a headline, rotate the subtree started
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2756 by this line through 3 different states (local cycling)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2757 1. FOLDED: Only the main headline is shown.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2758 2. CHILDREN: The main headline and the direct children are shown.
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2759 From this state, you can move to one of the children
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
2760 and zoom in further.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2761 3. SUBTREE: Show the entire subtree, including body text.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2762
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2763 - When there is a numeric prefix, go up to a heading with level ARG, do
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2764 a `show-subtree' and return to the previous cursor position. If ARG
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
2765 is negative, go up that many levels.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2766
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2767 - When point is not at the beginning of a headline, execute
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2768 `indent-relative', like TAB normally does. See the option
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2769 `org-cycle-emulate-tab' for details.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2770
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2771 - Special case: if point is the the beginning of the buffer and there is
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2772 no headline in line 1, this function will act as if called with prefix arg."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2773 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2774
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2775 (if (or (and (bobp) (not (looking-at outline-regexp)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2776 (equal arg '(4)))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
2777 ;; special case: use global cycling
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2778 (setq arg t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2779
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2780 (let ((outline-regexp
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2781 (if org-cycle-include-plain-lists
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2782 "\\*+\\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) "
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2783 outline-regexp)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2784
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2785 (cond
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2786
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2787 ((org-at-table-p 'any)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2788 ;; Enter the table or move to the next field in the table
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2789 (or (org-table-recognize-table.el)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2790 (progn
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2791 (if arg (org-table-edit-field t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2792 (org-table-justify-field-maybe)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2793 (org-table-next-field)))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2794
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2795 ((eq arg t) ;; Global cycling
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2796
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2797 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2798 ((and (eq last-command this-command)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2799 (eq org-cycle-global-status 'overview))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2800 ;; We just created the overview - now do table of contents
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2801 ;; This can be slow in very large buffers, so indicate action
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2802 (message "CONTENTS...")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2803 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2804 ;; Visit all headings and show their offspring
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2805 (goto-char (point-max))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2806 (catch 'exit
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2807 (while (and (progn (condition-case nil
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2808 (outline-previous-visible-heading 1)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2809 (error (goto-char (point-min))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2810 t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2811 (looking-at outline-regexp))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2812 (show-branches)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2813 (if (bobp) (throw 'exit nil))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2814 (message "CONTENTS...done"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2815 (setq org-cycle-global-status 'contents)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2816 (run-hook-with-args 'org-cycle-hook 'contents))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2817
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2818 ((and (eq last-command this-command)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2819 (eq org-cycle-global-status 'contents))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2820 ;; We just showed the table of contents - now show everything
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2821 (show-all)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2822 (message "SHOW ALL")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2823 (setq org-cycle-global-status 'all)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2824 (run-hook-with-args 'org-cycle-hook 'all))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2825
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2826 (t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2827 ;; Default action: go to overview
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2828 (hide-sublevels 1)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2829 (message "OVERVIEW")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2830 (setq org-cycle-global-status 'overview)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2831 (run-hook-with-args 'org-cycle-hook 'overview))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2832
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2833 ((integerp arg)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2834 ;; Show-subtree, ARG levels up from here.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2835 (save-excursion
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2836 (org-back-to-heading)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2837 (outline-up-heading (if (< arg 0) (- arg)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
2838 (- (funcall outline-level) arg)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2839 (org-show-subtree)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2840
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2841 ((save-excursion (beginning-of-line 1) (looking-at outline-regexp))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2842 ;; At a heading: rotate between three different views
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2843 (org-back-to-heading)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2844 (let ((goal-column 0) eoh eol eos)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2845 ;; First, some boundaries
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2846 (save-excursion
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2847 (org-back-to-heading)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2848 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2849 (beginning-of-line 2)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2850 (while (and (not (eobp)) ;; this is like `next-line'
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2851 (get-char-property (1- (point)) 'invisible))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2852 (beginning-of-line 2)) (setq eol (point)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2853 (outline-end-of-heading) (setq eoh (point))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
2854 (org-end-of-subtree t) (setq eos (point))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2855 (outline-next-heading))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2856 ;; Find out what to do next and set `this-command'
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2857 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2858 ((= eos eoh)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2859 ;; Nothing is hidden behind this heading
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2860 (message "EMPTY ENTRY")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2861 (setq org-cycle-subtree-status nil))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2862 ((>= eol eos)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2863 ;; Entire subtree is hidden in one line: open it
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2864 (org-show-entry)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2865 (show-children)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2866 (message "CHILDREN")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2867 (setq org-cycle-subtree-status 'children)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2868 (run-hook-with-args 'org-cycle-hook 'children))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2869 ((and (eq last-command this-command)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2870 (eq org-cycle-subtree-status 'children))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2871 ;; We just showed the children, now show everything.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2872 (org-show-subtree)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2873 (message "SUBTREE")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2874 (setq org-cycle-subtree-status 'subtree)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2875 (run-hook-with-args 'org-cycle-hook 'subtree))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2876 (t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2877 ;; Default action: hide the subtree.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2878 (hide-subtree)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2879 (message "FOLDED")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2880 (setq org-cycle-subtree-status 'folded)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2881 (run-hook-with-args 'org-cycle-hook 'folded)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2882
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2883 ;; TAB emulation
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2884 (buffer-read-only (org-back-to-heading))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2885 ((if (and (eq org-cycle-emulate-tab 'white)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2886 (save-excursion (beginning-of-line 1) (looking-at "[ \t]+$")))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2887 t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2888 (eq org-cycle-emulate-tab t))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2889 (if (and (looking-at "[ \n\r\t]")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2890 (string-match "^[ \t]*$" (buffer-substring
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2891 (point-at-bol) (point))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2892 (progn
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2893 (beginning-of-line 1)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2894 (and (looking-at "[ \t]+") (replace-match ""))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2895 (indent-relative))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2896
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2897 (t (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2898 (org-back-to-heading)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
2899 (org-cycle))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2900
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2901 (defun org-optimize-window-after-visibility-change (state)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2902 "Adjust the window after a change in outline visibility.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2903 This function is the default value of the hook `org-cycle-hook'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2904 (when (get-buffer-window (current-buffer))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2905 (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2906 ((eq state 'overview) (org-first-headline-recenter 1))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2907 ((eq state 'content) nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2908 ((eq state 'all) nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2909 ((eq state 'folded) nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2910 ((eq state 'children) (or (org-subtree-end-visible-p) (recenter 1)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
2911 ((eq state 'subtree) (or (org-subtree-end-visible-p) (recenter 1))))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2912
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2913 (defun org-subtree-end-visible-p ()
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2914 "Is the end of the current subtree visible?"
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2915 (pos-visible-in-window-p
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
2916 (save-excursion (org-end-of-subtree t) (point))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2917
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2918 (defun org-first-headline-recenter (&optional N)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2919 "Move cursor to the first headline and recenter the headline.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2920 Optional argument N means, put the headline into the Nth line of the window."
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2921 (goto-char (point-min))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2922 (when (re-search-forward (concat "^" outline-regexp) nil t)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2923 (beginning-of-line)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
2924 (recenter (prefix-numeric-value N))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2925
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2926 (defvar org-goto-window-configuration nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2927 (defvar org-goto-marker nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2928 (defvar org-goto-map (make-sparse-keymap))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2929 (let ((cmds '(isearch-forward isearch-backward)) cmd)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2930 (while (setq cmd (pop cmds))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2931 (substitute-key-definition cmd cmd org-goto-map global-map)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
2932 (define-key org-goto-map "\C-m" 'org-goto-ret)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2933 (define-key org-goto-map [(left)] 'org-goto-left)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2934 (define-key org-goto-map [(right)] 'org-goto-right)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2935 (define-key org-goto-map [(?q)] 'org-goto-quit)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2936 (define-key org-goto-map [(control ?g)] 'org-goto-quit)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
2937 (define-key org-goto-map "\C-i" 'org-cycle)
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
2938 (define-key org-goto-map [(tab)] 'org-cycle)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2939 (define-key org-goto-map [(down)] 'outline-next-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2940 (define-key org-goto-map [(up)] 'outline-previous-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2941 (define-key org-goto-map "n" 'outline-next-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2942 (define-key org-goto-map "p" 'outline-previous-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2943 (define-key org-goto-map "f" 'outline-forward-same-level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2944 (define-key org-goto-map "b" 'outline-backward-same-level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2945 (define-key org-goto-map "u" 'outline-up-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2946 (define-key org-goto-map "\C-c\C-n" 'outline-next-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2947 (define-key org-goto-map "\C-c\C-p" 'outline-previous-visible-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2948 (define-key org-goto-map "\C-c\C-f" 'outline-forward-same-level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2949 (define-key org-goto-map "\C-c\C-b" 'outline-backward-same-level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2950 (define-key org-goto-map "\C-c\C-u" 'outline-up-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2951 (let ((l '(1 2 3 4 5 6 7 8 9 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2952 (while l (define-key org-goto-map (int-to-string (pop l)) 'digit-argument)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2953
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2954 (defconst org-goto-help
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2955 "Select a location to jump to, press RET
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2956 \[Up]/[Down]=next/prev headline TAB=cycle visibility RET=select [Q]uit")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2957
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2958 (defun org-goto ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2959 "Go to a different location of the document, keeping current visibility.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2960
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2961 When you want to go to a different location in a document, the fastest way
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2962 is often to fold the entire buffer and then dive into the tree. This
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2963 method has the disadvantage, that the previous location will be folded,
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
2964 which may not be what you want.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2965
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2966 This command works around this by showing a copy of the current buffer in
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2967 overview mode. You can dive into the tree in that copy, to find the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2968 location you want to reach. When pressing RET, the command returns to the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2969 original buffer in which the visibility is still unchanged. It then jumps
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2970 to the new location, making it and the headline hierarchy above it visible."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2971 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2972 (let* ((org-goto-start-pos (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2973 (selected-point
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2974 (org-get-location (current-buffer) org-goto-help)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2975 (if selected-point
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2976 (progn
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2977 (org-mark-ring-push org-goto-start-pos)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2978 (goto-char selected-point)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2979 (if (or (org-invisible-p) (org-invisible-p2))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
2980 (org-show-hierarchy-above)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2981 (error "Quit"))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2982
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2983 (defun org-get-location (buf help)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2984 "Let the user select a location in the Org-mode buffer BUF.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2985 This function uses a recursive edit. It returns the selected position
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2986 or nil."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2987 (let (org-selected-point)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2988 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2989 (save-window-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2990 (delete-other-windows)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2991 (switch-to-buffer (get-buffer-create "*org-goto*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2992 (with-output-to-temp-buffer "*Help*"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2993 (princ help))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2994 (shrink-window-if-larger-than-buffer (get-buffer-window "*Help*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2995 (setq buffer-read-only nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2996 (erase-buffer)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
2997 (insert-buffer-substring buf)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2998 (let ((org-startup-truncated t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
2999 (org-startup-folded t)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3000 (org-startup-align-all-tables nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3001 (org-startup-with-deadline-check nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3002 (org-mode))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3003 (setq buffer-read-only t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3004 (if (boundp 'org-goto-start-pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3005 (goto-char org-goto-start-pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3006 (goto-char (point-min)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3007 (org-beginning-of-line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3008 (message "Select location and press RET")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3009 ;; now we make sure that during selection, ony very few keys work
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3010 ;; and that it is impossible to switch to another window.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3011 (let ((gm (current-global-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3012 (overriding-local-map org-goto-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3013 (unwind-protect
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3014 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3015 (use-global-map org-goto-map)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3016 (recursive-edit))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3017 (use-global-map gm)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3018 (kill-buffer "*org-goto*")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3019 org-selected-point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3020
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3021 ;; FIXME: It may not be a good idea to temper with the prefix argument...
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3022 (defun org-goto-ret (&optional arg)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3023 "Finish `org-goto' by going to the new location."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3024 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3025 (setq org-selected-point (point)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3026 current-prefix-arg arg)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3027 (throw 'exit nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3028
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3029 (defun org-goto-left ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3030 "Finish `org-goto' by going to the new location."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3031 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3032 (if (org-on-heading-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3033 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3034 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3035 (setq org-selected-point (point)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3036 current-prefix-arg (- (match-end 0) (match-beginning 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3037 (throw 'exit nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3038 (error "Not on a heading")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3039
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3040 (defun org-goto-right ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3041 "Finish `org-goto' by going to the new location."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3042 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3043 (if (org-on-heading-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3044 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3045 (outline-end-of-subtree)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3046 (or (eobp) (forward-char 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3047 (setq org-selected-point (point)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3048 current-prefix-arg (- (match-end 0) (match-beginning 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3049 (throw 'exit nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3050 (error "Not on a heading")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3051
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3052 (defun org-goto-quit ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3053 "Finish `org-goto' without cursor motion."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3054 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3055 (setq org-selected-point nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3056 (throw 'exit nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3057
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3058 ;;; Promotion, Demotion, Inserting new headlines
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3059
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3060 (defvar org-ignore-region nil
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3061 "To temporarily disable the active region.")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3062
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3063 (defun org-insert-heading (&optional force-heading)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3064 "Insert a new heading or item with same depth at point."
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3065 (interactive "P")
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3066 (when (or force-heading (not (org-insert-item)))
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3067 (let* ((head (save-excursion
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3068 (condition-case nil
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3069 (org-back-to-heading)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3070 (error (outline-next-heading)))
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3071 (prog1 (match-string 0)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3072 (funcall outline-level)))))
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3073 (unless (bolp) (newline))
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3074 (insert head)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3075 (if (looking-at "[ \t]*")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3076 (replace-match " "))
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3077 (run-hooks 'org-insert-heading-hook))))
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3078
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3079 (defun org-insert-item ()
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3080 "Insert a new item at the current level.
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
3081 Return t when things worked, nil when we are not in an item."
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3082 (when (save-excursion
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3083 (condition-case nil
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3084 (progn
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3085 (org-beginning-of-item)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3086 (org-at-item-p)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3087 t)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3088 (error nil)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3089 (unless (bolp) (newline))
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3090 (insert (match-string 0))
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3091 (org-maybe-renumber-ordered-list)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3092 t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3093
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3094 (defun org-insert-todo-heading (arg)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3095 "Insert a new heading with the same level and TODO state as current heading.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3096 If the heading has no TODO state, or if the state is DONE, use the first
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3097 state (TODO by default). Also with prefix arg, force first state."
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3098 (interactive "P")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3099 (org-insert-heading)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3100 (save-excursion
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3101 (org-back-to-heading)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3102 (outline-previous-heading)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3103 (looking-at org-todo-line-regexp))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3104 (if (or arg
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3105 (not (match-beginning 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3106 (equal (match-string 2) org-done-string))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3107 (insert (car org-todo-keywords) " ")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3108 (insert (match-string 2) " ")))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3109
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3110 (defun org-promote-subtree ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3111 "Promote the entire subtree.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3112 See also `org-promote'."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3113 (interactive)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3114 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3115 (org-map-tree 'org-promote)))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3116
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3117 (defun org-demote-subtree ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3118 "Demote the entire subtree. See `org-demote'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3119 See also `org-promote'."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3120 (interactive)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3121 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3122 (org-map-tree 'org-demote)))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3123
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3124 (defun org-do-promote ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3125 "Promote the current heading higher up the tree.
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
3126 If the region is active in `transient-mark-mode', promote all headings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3127 in the region."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3128 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3129 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3130 (if (org-region-active-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3131 (org-map-region 'org-promote (region-beginning) (region-end))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3132 (org-promote)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3133 (org-fix-position-after-promote))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3134
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3135 (defun org-do-demote ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3136 "Demote the current heading lower down the tree.
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3137 If the region is active in `transient-mark-mode', demote all headings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3138 in the region."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3139 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3140 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3141 (if (org-region-active-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3142 (org-map-region 'org-demote (region-beginning) (region-end))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3143 (org-demote)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3144 (org-fix-position-after-promote))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3145
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3146 (defun org-fix-position-after-promote ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3147 "Make sure that after pro/demotion cursor position is right."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3148 (and (equal (char-after) ?\ )
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3149 (equal (char-before) ?*)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3150 (forward-char 1)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3151
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3152 (defun org-get-legal-level (level change)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3153 "Rectify a level change under the influence of `org-odd-levels-only'
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3154 LEVEL is a current level, CHANGE is by how much the level should be
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3155 modified. Even if CHANGE is nil, LEVEL may be returned modified because
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3156 even level numbers will become the next higher odd number."
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3157 (if org-odd-levels-only
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3158 (cond ((not change) (1+ (* 2 (/ level 2))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3159 ((> change 0) (1+ (* 2 (/ (+ level (* 2 change)) 2))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3160 ((< change 0) (max 1 (1+ (* 2 (/ (+ level (* 2 change)) 2))))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3161 (max 1 (+ level change))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3162
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3163 (defun org-promote ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3164 "Promote the current heading higher up the tree.
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3165 If the region is active in `transient-mark-mode', promote all headings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3166 in the region."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3167 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3168 (let* ((level (save-match-data (funcall outline-level)))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3169 (up-head (make-string (org-get-legal-level level -1) ?*))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3170 (diff (abs (- level (length up-head)))))
63431
fd4b70bc23a4 (org-promote, org-evaluate-time-range, org-agenda-next-date-line,
Juanma Barranquero <lekktu@gmail.com>
parents: 63367
diff changeset
3171 (if (= level 1) (error "Cannot promote to level 0. UNDO to recover"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3172 (replace-match up-head nil t)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3173 ;; Fixup tag positioning
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3174 (and org-auto-align-tags (org-set-tags nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3175 (if org-adapt-indentation
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3176 (org-fixup-indentation (if (> diff 1) "^ " "^ ") ""
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3177 (if (> diff 1) "^ ? ?\\S-" "^ ?\\S-")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3178
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3179 (defun org-demote ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3180 "Demote the current heading lower down the tree.
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3181 If the region is active in `transient-mark-mode', demote all headings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3182 in the region."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3183 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3184 (let* ((level (save-match-data (funcall outline-level)))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3185 (down-head (make-string (org-get-legal-level level 1) ?*))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3186 (diff (abs (- level (length down-head)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3187 (replace-match down-head nil t)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3188 ;; Fixup tag positioning
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3189 (and org-auto-align-tags (org-set-tags nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3190 (if org-adapt-indentation
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3191 (org-fixup-indentation "^ " (if (> diff 1) " " " ") "^\\S-"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3192
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3193 (defun org-map-tree (fun)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3194 "Call FUN for every heading underneath the current one."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3195 (org-back-to-heading)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3196 (let ((level (funcall outline-level)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3197 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3198 (funcall fun)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3199 (while (and (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3200 (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3201 (> (funcall outline-level) level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3202 (not (eobp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3203 (funcall fun)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3204
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3205 (defun org-map-region (fun beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3206 "Call FUN for every heading between BEG and END."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3207 (let ((org-ignore-region t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3208 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3209 (setq end (copy-marker end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3210 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3211 (if (and (re-search-forward (concat "^" outline-regexp) nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3212 (< (point) end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3213 (funcall fun))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3214 (while (and (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3215 (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3216 (< (point) end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3217 (not (eobp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3218 (funcall fun)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3219
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3220 (defun org-fixup-indentation (from to prohibit)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3221 "Change the indentation in the current entry by re-replacing FROM with TO.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3222 However, if the regexp PROHIBIT matches at all, don't do anything.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3223 This is being used to change indentation along with the length of the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3224 heading marker. But if there are any lines which are not indented, nothing
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3225 is changed at all."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3226 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3227 (let ((end (save-excursion (outline-next-heading)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3228 (point-marker))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3229 (unless (save-excursion (re-search-forward prohibit end t))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3230 (while (re-search-forward from end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3231 (replace-match to)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3232 (beginning-of-line 2)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3233 (move-marker end nil))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3234
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3235 ;;; Vertical tree motion, cutting and pasting of subtrees
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3236
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3237 (defun org-move-subtree-up (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3238 "Move the current subtree up past ARG headlines of the same level."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3239 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3240 (org-move-subtree-down (- (prefix-numeric-value arg))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3241
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3242 (defun org-move-subtree-down (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3243 "Move the current subtree down past ARG headlines of the same level."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3244 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3245 (setq arg (prefix-numeric-value arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3246 (let ((movfunc (if (> arg 0) 'outline-get-next-sibling
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3247 'outline-get-last-sibling))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3248 (ins-point (make-marker))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3249 (cnt (abs arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3250 beg end txt folded)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3251 ;; Select the tree
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3252 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3253 (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3254 (save-match-data
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3255 (save-excursion (outline-end-of-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3256 (setq folded (org-invisible-p)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3257 (outline-end-of-subtree))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
3258 (outline-next-heading)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3259 (setq end (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3260 ;; Find insertion point, with error handling
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3261 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3262 (while (> cnt 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3263 (or (and (funcall movfunc) (looking-at outline-regexp))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3264 (progn (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3265 (error "Cannot move past superior level or buffer limit")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3266 (setq cnt (1- cnt)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3267 (if (> arg 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3268 ;; Moving forward - still need to move over subtree
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3269 (progn (outline-end-of-subtree)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3270 (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3271 (if (not (or (looking-at (concat "^" outline-regexp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3272 (bolp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3273 (newline))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3274 (move-marker ins-point (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3275 (setq txt (buffer-substring beg end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3276 (delete-region beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3277 (insert txt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3278 (goto-char ins-point)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3279 (if folded (hide-subtree))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3280 (move-marker ins-point nil)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3281
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3282 (defvar org-subtree-clip ""
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3283 "Clipboard for cut and paste of subtrees.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
3284 This is actually only a copy of the kill, because we use the normal kill
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3285 ring. We need it to check if the kill was created by `org-copy-subtree'.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3286
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3287 (defvar org-subtree-clip-folded nil
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3288 "Was the last copied subtree folded?
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3289 This is used to fold the tree back after pasting.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3290
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3291 (defun org-cut-subtree ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3292 "Cut the current subtree into the clipboard.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3293 This is a short-hand for marking the subtree and then cutting it."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3294 (interactive)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3295 (org-copy-subtree 'cut))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3296
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3297 (defun org-copy-subtree (&optional cut)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3298 "Cut the current subtree into the clipboard.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3299 This is a short-hand for marking the subtree and then copying it.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3300 If CUT is non nil, actually cut the subtree."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
3301 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3302 (let (beg end folded)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3303 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3304 (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3305 (save-match-data
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3306 (save-excursion (outline-end-of-heading)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3307 (setq folded (org-invisible-p)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3308 (outline-end-of-subtree))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3309 (if (equal (char-after) ?\n) (forward-char 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3310 (setq end (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3311 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3312 (when (> end beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3313 (setq org-subtree-clip-folded folded)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3314 (if cut (kill-region beg end) (copy-region-as-kill beg end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3315 (setq org-subtree-clip (current-kill 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3316 (message "%s: Subtree with %d characters"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3317 (if cut "Cut" "Copied")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3318 (length org-subtree-clip)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3319
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3320 (defun org-paste-subtree (&optional level tree)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3321 "Paste the clipboard as a subtree, with modification of headline level.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3322 The entire subtree is promoted or demoted in order to match a new headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3323 level. By default, the new level is derived from the visible headings
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3324 before and after the insertion point, and taken to be the inferior headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3325 level of the two. So if the previous visible heading is level 3 and the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3326 next is level 4 (or vice versa), level 4 will be used for insertion.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3327 This makes sure that the subtree remains an independent subtree and does
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3328 not swallow low level entries.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3329
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3330 You can also force a different level, either by using a numeric prefix
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3331 argument, or by inserting the heading marker by hand. For example, if the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3332 cursor is after \"*****\", then the tree will be shifted to level 5.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3333
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3334 If you want to insert the tree as is, just use \\[yank].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3335
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3336 If optional TREE is given, use this text instead of the kill ring."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3337 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3338 (unless (org-kill-is-subtree-p tree)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3339 (error
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3340 (substitute-command-keys
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3341 "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3342 (let* ((txt (or tree (current-kill 0)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3343 (^re (concat "^\\(" outline-regexp "\\)"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3344 (re (concat "\\(" outline-regexp "\\)"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3345 (^re_ (concat "\\(" outline-regexp "\\)[ \t]*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3346
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3347 (old-level (if (string-match ^re txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3348 (- (match-end 0) (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3349 -1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3350 (force-level (cond (level (prefix-numeric-value level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3351 ((string-match
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3352 ^re_ (buffer-substring (point-at-bol) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3353 (- (match-end 0) (match-beginning 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3354 (t nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3355 (previous-level (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3356 (condition-case nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3357 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3358 (outline-previous-visible-heading 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3359 (if (looking-at re)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3360 (- (match-end 0) (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3361 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3362 (error 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3363 (next-level (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3364 (condition-case nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3365 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3366 (outline-next-visible-heading 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3367 (if (looking-at re)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3368 (- (match-end 0) (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3369 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3370 (error 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3371 (new-level (or force-level (max previous-level next-level)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3372 (shift (if (or (= old-level -1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3373 (= new-level -1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3374 (= old-level new-level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3375 0
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3376 (- new-level old-level)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3377 (shift1 shift)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3378 (delta (if (> shift 0) -1 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3379 (func (if (> shift 0) 'org-demote 'org-promote))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
3380 (org-odd-levels-only nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3381 beg end)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3382 ;; Remove the forces level indicator
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3383 (if force-level
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3384 (delete-region (point-at-bol) (point)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3385 ;; Make sure we start at the beginning of an empty line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3386 (if (not (bolp)) (insert "\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3387 (if (not (looking-at "[ \t]*$"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3388 (progn (insert "\n") (backward-char 1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3389 ;; Paste
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3390 (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3391 (insert txt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3392 (setq end (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3393 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3394 ;; Shift if necessary
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3395 (if (= shift 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3396 (message "Pasted at level %d, without shift" new-level)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3397 (save-restriction
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3398 (narrow-to-region beg end)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3399 (while (not (= shift 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3400 (org-map-region func (point-min) (point-max))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3401 (setq shift (+ delta shift)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3402 (goto-char (point-min))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3403 (message "Pasted at level %d, with shift by %d levels"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3404 new-level shift1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3405 (if (and (eq org-subtree-clip (current-kill 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3406 org-subtree-clip-folded)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3407 ;; The tree was folded before it was killed/copied
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3408 (hide-subtree))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3409
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3410 (defun org-kill-is-subtree-p (&optional txt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3411 "Check if the current kill is an outline subtree, or a set of trees.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3412 Returns nil if kill does not start with a headline, or if the first
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3413 headline level is not the largest headline level in the tree.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3414 So this will actually accept several entries of equal levels as well,
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3415 which is OK for `org-paste-subtree'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3416 If optional TXT is given, check this string instead of the current kill."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3417 (let* ((kill (or txt (current-kill 0) ""))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3418 (start-level (and (string-match (concat "\\`" outline-regexp) kill)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3419 (- (match-end 0) (match-beginning 0))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3420 (re (concat "^" outline-regexp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3421 (start 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3422 (if (not start-level)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3423 nil ;; does not even start with a heading
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3424 (catch 'exit
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3425 (while (setq start (string-match re kill (1+ start)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3426 (if (< (- (match-end 0) (match-beginning 0)) start-level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3427 (throw 'exit nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3428 t))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3429
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3430 ;;; Plain list items
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3431
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3432 (defun org-at-item-p ()
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3433 "Is point in a line starting a hand-formatted item?"
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3434 (let ((llt org-plain-list-ordered-item-terminator))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3435 (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3436 (goto-char (point-at-bol))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3437 (looking-at
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3438 (cond
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3439 ((eq llt t) "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3440 ((= llt ?.) "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3441 ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3442 (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3443
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3444 (defun org-get-indentation ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3445 "Get the indentation of the current line, interpreting tabs."
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3446 (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3447 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3448 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3449 (current-column)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3450
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3451 (defun org-beginning-of-item ()
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3452 "Go to the beginning of the current hand-formatted item.
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3453 If the cursor is not in an item, throw an error."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3454 (let ((pos (point))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3455 (limit (save-excursion (org-back-to-heading)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3456 (beginning-of-line 2) (point)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3457 ind ind1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3458 (if (org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3459 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3460 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3461 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3462 (setq ind (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3463 (if (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3464 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3465 (beginning-of-line 0)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3466 (if (< (point) limit) (throw 'exit nil))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3467 (unless (looking-at " \t]*$")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3468 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3469 (setq ind1 (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3470 (if (< ind1 ind)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3471 (throw 'exit (org-at-item-p))))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3472 nil
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3473 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3474 (error "Not in an item")))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3475
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3476 (defun org-end-of-item ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3477 "Go to the end of the current hand-formatted item.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3478 If the cursor is not in an item, throw an error."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3479 (let ((pos (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3480 (limit (save-excursion (outline-next-heading) (point)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3481 (ind (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3482 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3483 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3484 (current-column)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3485 ind1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3486 (if (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3487 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3488 (beginning-of-line 2)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3489 (if (>= (point) limit) (throw 'exit t))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3490 (unless (looking-at "[ \t]*$")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3491 (skip-chars-forward " \t")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3492 (setq ind1 (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3493 (if (<= ind1 ind) (throw 'exit t)))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3494 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3495 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3496 (error "Not in an item"))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3497
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3498 (defun org-move-item-down (arg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3499 "Move the plain list item at point down, i.e. swap with following item.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3500 Subitems (items with larger indentation) are considered part of the item,
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3501 so this really moves item trees."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3502 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3503 (let (beg end ind ind1 (pos (point)) txt)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3504 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3505 (setq beg (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3506 (setq ind (org-get-indentation))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3507 (org-end-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3508 (setq end (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3509 (setq ind1 (org-get-indentation))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3510 (if (and (org-at-item-p) (= ind ind1))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3511 (progn
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3512 (org-end-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3513 (setq txt (buffer-substring beg end))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3514 (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3515 (delete-region beg end))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3516 (setq pos (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3517 (insert txt)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3518 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3519 (org-maybe-renumber-ordered-list))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3520 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3521 (error "Cannot move this item further down"))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3522
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3523 (defun org-move-item-up (arg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3524 "Move the plain list item at point up, i.e. swap with previous item.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3525 Subitems (items with larger indentation) are considered part of the item,
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3526 so this really moves item trees."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3527 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3528 (let (beg end ind ind1 (pos (point)) txt)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3529 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3530 (setq beg (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3531 (setq ind (org-get-indentation))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3532 (org-end-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3533 (setq end (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3534 (goto-char beg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3535 (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3536 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3537 (beginning-of-line 0)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3538 (if (looking-at "[ \t]*$")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3539 nil
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3540 (if (<= (setq ind1 (org-get-indentation)) ind)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3541 (throw 'exit t)))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3542 (condition-case nil
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3543 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3544 (error (goto-char beg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3545 (error "Cannot move this item further up")))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3546 (setq ind1 (org-get-indentation))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3547 (if (and (org-at-item-p) (= ind ind1))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3548 (progn
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3549 (setq txt (buffer-substring beg end))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3550 (save-excursion
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3551 (delete-region beg end))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3552 (setq pos (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3553 (insert txt)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3554 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3555 (org-maybe-renumber-ordered-list))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3556 (goto-char pos)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3557 (error "Cannot move this item further up"))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3558
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3559 (defun org-maybe-renumber-ordered-list ()
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3560 "Renumber the ordered list at point if setup allows it.
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3561 This tests the user option `org-auto-renumber-ordered-lists' before
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3562 doing the renumbering."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3563 (and org-auto-renumber-ordered-lists
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3564 (org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3565 (match-beginning 3)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3566 (org-renumber-ordered-list 1)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3567
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3568 (defun org-get-string-indentation (s)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3569 "What indentation has S due to SPACE and TAB at the beginning of the string?"
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3570 (let ((n -1) (i 0) (w tab-width) c)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3571 (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3572 (while (< (setq n (1+ n)) (length s))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3573 (setq c (aref s n))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3574 (cond ((= c ?\ ) (setq i (1+ i)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3575 ((= c ?\t) (setq i (* (/ (+ w i) w) w)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3576 (t (throw 'exit t)))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3577 i))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3578
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3579 (defun org-renumber-ordered-list (arg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3580 "Renumber an ordered plain list.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3581 Cursor next to be in the first line of an item, the line that starts
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3582 with something like \"1.\" or \"2)\"."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3583 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3584 (unless (and (org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3585 (match-beginning 3))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3586 (error "This is not an ordered list"))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3587 (let ((line (org-current-line))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3588 (col (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3589 (ind (org-get-string-indentation
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3590 (buffer-substring (point-at-bol) (match-beginning 3))))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3591 ;; (term (substring (match-string 3) -1))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3592 ind1 (n (1- arg)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3593 ;; find where this list begins
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3594 (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3595 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3596 (catch 'next
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3597 (beginning-of-line 0)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3598 (if (looking-at "[ \t]*$") (throw 'next t))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3599 (skip-chars-forward " \t") (setq ind1 (current-column))
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3600 (if (or (< ind1 ind)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3601 (and (= ind1 ind)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3602 (not (org-at-item-p))))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3603 (throw 'exit t)))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3604 ;; Walk forward and replace these numbers
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3605 (catch 'exit
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3606 (while t
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3607 (catch 'next
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3608 (beginning-of-line 2)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3609 (if (eobp) (throw 'exit nil))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3610 (if (looking-at "[ \t]*$") (throw 'next nil))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3611 (skip-chars-forward " \t") (setq ind1 (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3612 (if (> ind1 ind) (throw 'next t))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3613 (if (< ind1 ind) (throw 'exit t))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3614 (if (not (org-at-item-p)) (throw 'exit nil))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3615 (if (not (match-beginning 3))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3616 (error "unordered bullet in ordered list. Press \\[undo] to recover"))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3617 (delete-region (match-beginning 3) (1- (match-end 3)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3618 (goto-char (match-beginning 3))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3619 (insert (format "%d" (setq n (1+ n)))))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3620 (goto-line line)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3621 (move-to-column col)))
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
3622
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3623 (defvar org-last-indent-begin-marker (make-marker))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3624 (defvar org-last-indent-end-marker (make-marker))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3625
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3626 (defun org-outdent-item (arg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3627 "Outdent a local list item."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3628 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3629 (org-indent-item (- arg)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3630
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3631 (defun org-indent-item (arg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3632 "Indent a local list item."
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3633 (interactive "p")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3634 (unless (org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3635 (error "Not on an item"))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3636 (let (beg end ind ind1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3637 (if (memq last-command '(org-shiftmetaright org-shiftmetaleft))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3638 (setq beg org-last-indent-begin-marker
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3639 end org-last-indent-end-marker)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3640 (org-beginning-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3641 (setq beg (move-marker org-last-indent-begin-marker (point)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3642 (org-end-of-item)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3643 (setq end (move-marker org-last-indent-end-marker (point))))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3644 (goto-char beg)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3645 (skip-chars-forward " \t") (setq ind (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3646 (if (< (+ arg ind) 0) (error "Cannot outdent beyond margin"))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3647 (while (< (point) end)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3648 (beginning-of-line 1)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3649 (skip-chars-forward " \t") (setq ind1 (current-column))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3650 (delete-region (point-at-bol) (point))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3651 (indent-to-column (+ ind1 arg))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3652 (beginning-of-line 2))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3653 (goto-char beg)))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3654
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3655 ;;; Archiving
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
3656
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3657 (defun org-archive-subtree ()
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3658 "Move the current subtree to the archive.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3659 The archive can be a certain top-level heading in the current file, or in
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3660 a different file. The tree will be moved to that location, the subtree
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3661 heading be marked DONE, and the current time will be added."
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3662 (interactive)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3663 ;; Save all relevant TODO keyword-relatex variables
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3664 (let ((tr-org-todo-line-regexp org-todo-line-regexp) ; keep despite compiler
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3665 (tr-org-todo-keywords org-todo-keywords)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3666 (tr-org-todo-interpretation org-todo-interpretation)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3667 (tr-org-done-string org-done-string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3668 (tr-org-todo-regexp org-todo-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3669 (tr-org-todo-line-regexp org-todo-line-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3670 (this-buffer (current-buffer))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3671 file heading buffer level newfile-p)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3672 (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3673 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3674 (setq file (format (match-string 1 org-archive-location)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3675 (file-name-nondirectory buffer-file-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3676 heading (match-string 2 org-archive-location)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3677 (error "Invalid `org-archive-location'"))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3678 (if (> (length file) 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3679 (setq newfile-p (not (file-exists-p file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3680 buffer (find-file-noselect file))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3681 (setq buffer (current-buffer)))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3682 (unless buffer
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3683 (error "Cannot access file \"%s\"" file))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3684 (if (and (> (length heading) 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3685 (string-match "^\\*+" heading))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3686 (setq level (match-end 0))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3687 (setq heading nil level 0))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3688 (save-excursion
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
3689 ;; We first only copy, in case something goes wrong
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
3690 ;; we need to protect this-command, to avoid kill-region sets it,
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
3691 ;; which would lead to duplication of subtrees
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
3692 (let (this-command) (org-copy-subtree))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3693 (set-buffer buffer)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3694 ;; Enforce org-mode for the archive buffer
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3695 (if (not (eq major-mode 'org-mode))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3696 ;; Force the mode for future visits.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3697 (let ((org-insert-mode-line-in-empty-file t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3698 (call-interactively 'org-mode)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3699 (when newfile-p
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3700 (goto-char (point-max))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3701 (insert (format "\nArchived entries from file %s\n\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3702 (buffer-file-name this-buffer))))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3703 ;; Force the TODO keywords of the original buffer
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3704 (let ((org-todo-line-regexp tr-org-todo-line-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3705 (org-todo-keywords tr-org-todo-keywords)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3706 (org-todo-interpretation tr-org-todo-interpretation)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3707 (org-done-string tr-org-done-string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3708 (org-todo-regexp tr-org-todo-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3709 (org-todo-line-regexp tr-org-todo-line-regexp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3710 (goto-char (point-min))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3711 (if heading
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3712 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3713 (if (re-search-forward
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3714 (concat "\\(^\\|\r\\)"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3715 (regexp-quote heading) "[ \t]*\\($\\|\r\\)")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3716 nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3717 (goto-char (match-end 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3718 ;; Heading not found, just insert it at the end
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3719 (goto-char (point-max))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3720 (or (bolp) (insert "\n"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3721 (insert "\n" heading "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3722 (end-of-line 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3723 ;; Make the heading visible, and the following as well
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3724 (let ((org-show-following-heading t)) (org-show-hierarchy-above))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3725 (if (re-search-forward
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3726 (concat "^" (regexp-quote (make-string level ?*)) "[ \t]")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3727 nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3728 (progn (goto-char (match-beginning 0)) (insert "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3729 (beginning-of-line 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3730 (goto-char (point-max)) (insert "\n")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3731 (goto-char (point-max)) (insert "\n"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3732 ;; Paste
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3733 (org-paste-subtree (1+ level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3734 ;; Mark the entry as done, i.e. set to last work in org-todo-keywords
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3735 (if org-archive-mark-done
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3736 (org-todo (length org-todo-keywords)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3737 ;; Move cursor to right after the TODO keyword
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3738 (when org-archive-stamp-time
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3739 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3740 (looking-at org-todo-line-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3741 (goto-char (or (match-end 2) (match-beginning 3)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3742 (insert "(" (format-time-string (cdr org-time-stamp-formats)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3743 (org-current-time))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3744 ")"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3745 ;; Save the buffer, if it is not the same buffer.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3746 (if (not (eq this-buffer buffer)) (save-buffer))))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3747 ;; Here we are back in the original buffer. Everything seems to have
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3748 ;; worked. So now cut the tree and finish up.
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
3749 (let (this-command) (org-cut-subtree))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3750 (if (looking-at "[ \t]*$") (kill-line))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3751 (message "Subtree archived %s"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3752 (if (eq this-buffer buffer)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3753 (concat "under heading: " heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3754 (concat "in file: " (abbreviate-file-name file))))))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
3755
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3756 ;;; Completion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3757
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3758 (defun org-complete (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3759 "Perform completion on word at point.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3760 At the beginning of a headline, this completes TODO keywords as given in
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3761 `org-todo-keywords'.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3762 If the current word is preceded by a backslash, completes the TeX symbols
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3763 that are supported for HTML support.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3764 If the current word is preceded by \"#+\", completes special words for
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3765 setting file options.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3766 At all other locations, this simply calls `ispell-complete-word'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3767 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3768 (catch 'exit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3769 (let* ((end (point))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3770 (beg1 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3771 (if (equal (char-before (point)) ?\ ) (backward-char 1))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3772 (skip-chars-backward "a-zA-Z_@0-9")
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3773 (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3774 (beg (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3775 (if (equal (char-before (point)) ?\ ) (backward-char 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3776 (skip-chars-backward "a-zA-Z0-9_:$")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3777 (point)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3778 (camel (equal (char-before beg) ?*))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3779 (tag (equal (char-before beg1) ?:))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3780 (texp (equal (char-before beg) ?\\))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3781 (opt (equal (buffer-substring (max (point-at-bol) (- beg 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3782 beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3783 "#+"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3784 (completion-ignore-case opt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3785 (type nil)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3786 (tbl nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3787 (table (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3788 (opt
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3789 (setq type :opt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3790 (mapcar (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3791 (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3792 (cons (match-string 2 x) (match-string 1 x)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3793 (org-split-string (org-get-current-options) "\n")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3794 (texp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3795 (setq type :tex)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3796 org-html-entities)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3797 ((string-match "\\`\\*+[ \t]*\\'"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3798 (buffer-substring (point-at-bol) beg))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3799 (setq type :todo)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3800 (mapcar 'list org-todo-keywords))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3801 (camel
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3802 (setq type :camel)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3803 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3804 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3805 (while (re-search-forward org-todo-line-regexp nil t)
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
3806 (push (list
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3807 (if org-file-link-context-use-camel-case
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3808 (org-make-org-heading-camel (match-string 3) t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3809 (org-make-org-heading-search-string
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
3810 (match-string 3) t)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3811 tbl)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3812 tbl)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3813 (tag (setq type :tag beg beg1)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3814 (org-get-buffer-tags))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3815 (t (progn (ispell-complete-word arg) (throw 'exit nil)))))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3816 (pattern (buffer-substring-no-properties beg end))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3817 (completion (try-completion pattern table)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3818 (cond ((eq completion t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3819 (if (equal type :opt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3820 (insert (substring (cdr (assoc (upcase pattern) table))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3821 (length pattern)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3822 ((null completion)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3823 (message "Can't find completion for \"%s\"" pattern)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3824 (ding))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3825 ((not (string= pattern completion))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3826 (delete-region beg end)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3827 (if (string-match " +$" completion)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3828 (setq completion (replace-match "" t t completion)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3829 (insert completion)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3830 (if (get-buffer-window "*Completions*")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3831 (delete-window (get-buffer-window "*Completions*")))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3832 (if (assoc completion table)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3833 (if (eq type :todo) (insert " ")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
3834 (if (eq type :tag) (insert ":"))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3835 (if (and (equal type :opt) (assoc completion table))
65583
703495630901 Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents: 65264
diff changeset
3836 (message "%s" (substitute-command-keys
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
3837 "Press \\[org-complete] again to insert example settings"))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3838 (t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3839 (message "Making completion list...")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3840 (let ((list (sort (all-completions pattern table) 'string<)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3841 (with-output-to-temp-buffer "*Completions*"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3842 (condition-case nil
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3843 ;; Protection needed for XEmacs and emacs 21
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3844 (display-completion-list list pattern)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
3845 (error (display-completion-list list)))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3846 (message "Making completion list...%s" "done"))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3847
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3848 ;;; Comments, TODO and DEADLINE
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3849
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3850 (defun org-toggle-comment ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3851 "Change the COMMENT state of an entry."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3852 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3853 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3854 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3855 (if (looking-at (concat outline-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3856 "\\( +\\<" org-comment-string "\\>\\)"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3857 (replace-match "" t t nil 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3858 (if (looking-at outline-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3859 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3860 (goto-char (match-end 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3861 (insert " " org-comment-string))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3862
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3863 (defvar org-last-todo-state-is-todo nil
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3864 "This is non-nil when the last TODO state change led to a TODO state.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3865 If the last change removed the TODO tag or switched to DONE, then
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3866 this is nil.")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3867
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3868 (defun org-todo (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3869 "Change the TODO state of an item.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3870 The state of an item is given by a keyword at the start of the heading,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3871 like
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3872 *** TODO Write paper
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3873 *** DONE Call mom
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3874
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3875 The different keywords are specified in the variable `org-todo-keywords'.
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3876 By default the available states are \"TODO\" and \"DONE\".
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3877 So for this example: when the item starts with TODO, it is changed to DONE.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3878 When it starts with DONE, the DONE is removed. And when neither TODO nor
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3879 DONE are present, add TODO at the beginning of the heading.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3880
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3881 With prefix arg, use completion to determine the new state. With numeric
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3882 prefix arg, switch to that state."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3883 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3884 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3885 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3886 (if (looking-at outline-regexp) (goto-char (match-end 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3887 (or (looking-at (concat " +" org-todo-regexp " *"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3888 (looking-at " *"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3889 (let* ((this (match-string 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3890 (completion-ignore-case t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3891 (member (member this org-todo-keywords))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3892 (tail (cdr member))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3893 (state (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3894 ((equal arg '(4))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3895 ;; Read a state with completion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3896 (completing-read "State: " (mapcar (lambda(x) (list x))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3897 org-todo-keywords)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3898 nil t))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3899 ((eq arg 'right)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3900 (if this
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3901 (if tail (car tail) nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3902 (car org-todo-keywords)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3903 ((eq arg 'left)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3904 (if (equal member org-todo-keywords)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3905 nil
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3906 (if this
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3907 (nth (- (length org-todo-keywords) (length tail) 2)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3908 org-todo-keywords)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3909 org-done-string)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3910 (arg
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3911 ;; user requests a specific state
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3912 (nth (1- (prefix-numeric-value arg))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3913 org-todo-keywords))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3914 ((null member) (car org-todo-keywords))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3915 ((null tail) nil) ;; -> first entry
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3916 ((eq org-todo-interpretation 'sequence)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3917 (car tail))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3918 ((memq org-todo-interpretation '(type priority))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3919 (if (eq this-command last-command)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3920 (car tail)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3921 (if (> (length tail) 0) org-done-string nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3922 (t nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3923 (next (if state (concat " " state " ") " ")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3924 (replace-match next t t)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
3925 (setq org-last-todo-state-is-todo
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3926 (not (equal state org-done-string)))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3927 (when org-log-done
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3928 (if (equal state org-done-string)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3929 (org-log-done)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3930 (if (not this)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3931 (org-log-done t))))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3932 ;; Fixup tag positioning
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
3933 (and org-auto-align-tags (org-set-tags nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3934 (run-hooks 'org-after-todo-state-change-hook)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3935 ;; Fixup cursor location if close to the keyword
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3936 (if (and (outline-on-heading-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3937 (not (bolp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3938 (save-excursion (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3939 (looking-at org-todo-line-regexp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3940 (< (point) (+ 2 (or (match-end 2) (match-end 1)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3941 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3942 (goto-char (or (match-end 2) (match-end 1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3943 (just-one-space))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3944
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3945 (defun org-log-done (&optional undone)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3946 "Add a time stamp logging that a TODO entry has been closed.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3947 When UNDONE is non-nil, remove such a time stamp again."
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3948 (interactive)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3949 (let (beg end col)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3950 (save-excursion
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3951 (org-back-to-heading t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3952 (setq beg (point))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3953 (looking-at (concat outline-regexp " *"))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3954 (goto-char (match-end 0))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3955 (setq col (current-column))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3956 (outline-next-heading)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3957 (setq end (point))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3958 (goto-char beg)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3959 (when (re-search-forward (concat
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3960 "[\r\n]\\([ \t]*"
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3961 (regexp-quote org-closed-string)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3962 " *\\[.*?\\][^\n\r]*[\n\r]?\\)") end t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3963 (delete-region (match-beginning 1) (match-end 1)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3964 (unless undone
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3965 (org-back-to-heading t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3966 (skip-chars-forward "^\n\r")
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3967 (goto-char (min (1+ (point)) (point-max)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3968 (when (not (member (char-before) '(?\r ?\n)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3969 (insert "\n"))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3970 (indent-to col)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3971 (insert org-closed-string " "
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3972 (format-time-string
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3973 (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
3974 (org-current-time))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
3975 "\n")))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
3976
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3977 (defun org-show-todo-tree (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3978 "Make a compact tree which shows all headlines marked with TODO.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3979 The tree will show the lines where the regexp matches, and all higher
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3980 headlines above the match.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3981 With \\[universal-argument] prefix, also show the DONE entries.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3982 With a numeric prefix N, construct a sparse tree for the Nth element
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3983 of `org-todo-keywords'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3984 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3985 (let ((case-fold-search nil)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3986 (kwd-re
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3987 (cond ((null arg) org-not-done-regexp)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3988 ((equal arg '(4)) org-todo-regexp)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3989 ((<= (prefix-numeric-value arg) (length org-todo-keywords))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3990 (regexp-quote (nth (1- (prefix-numeric-value arg))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3991 org-todo-keywords)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
3992 (t (error "Invalid prefix argument: %s" arg)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3993 (message "%d TODO entries found"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
3994 (org-occur (concat "^" outline-regexp " +" kwd-re )))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3995
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3996 (defun org-deadline ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3997 "Insert the DEADLINE: string to make a deadline.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3998 A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3999 to modify it to the correct date."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4000 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4001 (insert
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4002 org-deadline-string " "
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4003 (format-time-string (car org-time-stamp-formats)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4004 (org-read-date nil 'to-time)))
65583
703495630901 Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents: 65264
diff changeset
4005 (message "%s" (substitute-command-keys
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4006 "Use \\[org-timestamp-up-day] and \\[org-timestamp-down-day] to change the date.")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4007
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4008 (defun org-schedule ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4009 "Insert the SCHEDULED: string to schedule a TODO item.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4010 A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4011 to modify it to the correct date."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4012 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4013 (insert
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4014 org-scheduled-string " "
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4015 (format-time-string (car org-time-stamp-formats)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4016 (org-read-date nil 'to-time)))
65583
703495630901 Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents: 65264
diff changeset
4017 (message "%s" (substitute-command-keys
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4018 "Use \\[org-timestamp-up-day] and \\[org-timestamp-down-day] to change the date.")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4019
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4020
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4021 (defun org-occur (regexp &optional callback)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4022 "Make a compact tree which shows all matches of REGEXP.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4023 The tree will show the lines where the regexp matches, and all higher
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4024 headlines above the match. It will also show the heading after the match,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4025 to make sure editing the matching entry is easy.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4026 If CALLBACK is non-nil, it is a function which is called to confirm
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4027 that the match should indeed be shown."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4028 (interactive "sRegexp: ")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4029 (org-remove-occur-highlights nil nil t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4030 (setq regexp (org-check-occur-regexp regexp))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4031 (let ((cnt 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4032 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4033 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4034 (hide-sublevels 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4035 (while (re-search-forward regexp nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4036 (when (or (not callback)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4037 (save-match-data (funcall callback)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4038 (setq cnt (1+ cnt))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4039 (org-highlight-new-match (match-beginning 0) (match-end 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4040 (org-show-hierarchy-above))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4041 (org-add-hook 'before-change-functions 'org-remove-occur-highlights
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4042 nil 'local)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4043 (run-hooks 'org-occur-hook)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4044 (if (interactive-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4045 (message "%d match(es) for regexp %s" cnt regexp))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4046 cnt))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4047
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4048 (defun org-show-hierarchy-above ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4049 "Make sure point and the headings hierarchy above is visible."
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4050 (catch 'exit
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4051 (if (org-on-heading-p t)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4052 (org-flag-heading nil) ; only show the heading
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4053 (and (or (org-invisible-p) (org-invisible-p2))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4054 (org-show-hidden-entry))) ; show entire entry
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4055 (save-excursion
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4056 (and org-show-following-heading
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4057 (outline-next-heading)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4058 (org-flag-heading nil))) ; show the next heading
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4059 (when org-show-hierarchy-above
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4060 (save-excursion ; show all higher headings
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4061 (while (and (condition-case nil
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4062 (progn (org-up-heading-all 1) t)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4063 (error nil))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4064 (not (bobp)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4065 (org-flag-heading nil))))))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4066
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4067 ;; Overlay compatibility functions
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4068 (defun org-make-overlay (beg end &optional buffer)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4069 (if (featurep 'xemacs)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4070 (make-extent beg end buffer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4071 (make-overlay beg end buffer)))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4072 (defun org-delete-overlay (ovl)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4073 (if (featurep 'xemacs) (delete-extent ovl) (delete-overlay ovl)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4074 (defun org-detatch-overlay (ovl)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4075 (if (featurep 'xemacs) (detach-extent ovl) (delete-overlay ovl)))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4076 (defun org-move-overlay (ovl beg end &optional buffer)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4077 (if (featurep 'xemacs)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4078 (set-extent-endpoints ovl beg end buffer)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4079 (move-overlay ovl beg end buffer)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4080 (defun org-overlay-put (ovl prop value)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4081 (if (featurep 'xemacs)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4082 (set-extent-property ovl prop value)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4083 (overlay-put ovl prop value)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4084
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4085 (defvar org-occur-highlights nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4086 (defun org-highlight-new-match (beg end)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4087 "Highlight from BEG to END and mark the highlight is an occur headline."
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4088 (let ((ov (org-make-overlay beg end)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4089 (org-overlay-put ov 'face 'secondary-selection)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4090 (push ov org-occur-highlights)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4091
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4092 (defun org-remove-occur-highlights (&optional beg end noremove)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4093 "Remove the occur highlights from the buffer.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4094 BEG and END are ignored. If NOREMOVE is nil, remove this function
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4095 from the `before-change-functions' in the current buffer."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4096 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4097 (mapc 'org-delete-overlay org-occur-highlights)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4098 (setq org-occur-highlights nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4099 (unless noremove
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4100 (remove-hook 'before-change-functions
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4101 'org-remove-occur-highlights 'local)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4102
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4103 ;;; Priorities
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4104
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4105 (defvar org-priority-regexp ".*?\\(\\[#\\([A-Z]\\)\\] ?\\)"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4106 "Regular expression matching the priority indicator.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4107
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4108 (defvar org-remove-priority-next-time nil)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4109
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4110 (defun org-priority-up ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4111 "Increase the priority of the current item."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4112 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4113 (org-priority 'up))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4114
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4115 (defun org-priority-down ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4116 "Decrease the priority of the current item."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4117 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4118 (org-priority 'down))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4119
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4120 (defun org-priority (&optional action)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4121 "Change the priority of an item by ARG.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4122 ACTION can be set, up, or down."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4123 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4124 (setq action (or action 'set))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4125 (let (current new news have remove)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4126 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4127 (org-back-to-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4128 (if (looking-at org-priority-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4129 (setq current (string-to-char (match-string 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4130 have t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4131 (setq current org-default-priority))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4132 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4133 ((eq action 'set)
65583
703495630901 Message format spec fixes (2)
Deepak Goel <deego@gnufans.org>
parents: 65264
diff changeset
4134 (message "Priority A-%c, SPC to remove: " org-lowest-priority)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4135 (setq new (read-char-exclusive))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4136 (cond ((equal new ?\ ) (setq remove t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4137 ((or (< (upcase new) ?A) (> (upcase new) org-lowest-priority))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4138 (error "Priority must be between `%c' and `%c'"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4139 ?A org-lowest-priority))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4140 ((eq action 'up)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4141 (setq new (1- current)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4142 ((eq action 'down)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4143 (setq new (1+ current)))
60918
58a53f588384 * textmodes/refbib.el, textmodes/refer.el, textmodes/reftex-cite.el,
Werner LEMBERG <wl@gnu.org>
parents: 59596
diff changeset
4144 (t (error "Invalid action")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4145 (setq new (min (max ?A (upcase new)) org-lowest-priority))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4146 (setq news (format "%c" new))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4147 (if have
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4148 (if remove
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4149 (replace-match "" t t nil 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4150 (replace-match news t t nil 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4151 (if remove
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4152 (error "No priority cookie found in line")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4153 (looking-at org-todo-line-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4154 (if (match-end 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4155 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4156 (goto-char (match-end 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4157 (insert " [#" news "]"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4158 (goto-char (match-beginning 3))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4159 (insert "[#" news "] ")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4160 (if remove
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4161 (message "Priority removed")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4162 (message "Priority of current item set to %s" news))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4163
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4164
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4165 (defun org-get-priority (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4166 "Find priority cookie and return priority."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4167 (save-match-data
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4168 (if (not (string-match org-priority-regexp s))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4169 (* 1000 (- org-lowest-priority org-default-priority))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
4170 (* 1000 (- org-lowest-priority
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4171 (string-to-char (match-string 2 s)))))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
4172
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4173 ;;; Timestamps
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4174
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4175 (defvar org-last-changed-timestamp nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4176
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4177 (defun org-time-stamp (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4178 "Prompt for a date/time and insert a time stamp.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4179 If the user specifies a time like HH:MM, or if this command is called
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4180 with a prefix argument, the time stamp will contain date and time.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4181 Otherwise, only the date will be included. All parts of a date not
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4182 specified by the user will be filled in from the current date/time.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4183 So if you press just return without typing anything, the time stamp
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4184 will represent the current date/time. If there is already a timestamp
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
4185 at the cursor, it will be modified."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4186 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4187 (let ((fmt (if arg (cdr org-time-stamp-formats)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4188 (car org-time-stamp-formats)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4189 (org-time-was-given nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4190 time)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4191 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4192 ((and (org-at-timestamp-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4193 (eq last-command 'org-time-stamp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4194 (eq this-command 'org-time-stamp))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4195 (insert "--")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4196 (setq time (let ((this-command this-command))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4197 (org-read-date arg 'totime)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4198 (if org-time-was-given (setq fmt (cdr org-time-stamp-formats)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4199 (insert (format-time-string fmt time)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4200 ((org-at-timestamp-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4201 (setq time (let ((this-command this-command))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4202 (org-read-date arg 'totime)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4203 (and (org-at-timestamp-p) (replace-match
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4204 (setq org-last-changed-timestamp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4205 (format-time-string fmt time))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4206 t t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4207 (message "Timestamp updated"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4208 (t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4209 (setq time (let ((this-command this-command))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4210 (org-read-date arg 'totime)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4211 (if org-time-was-given (setq fmt (cdr org-time-stamp-formats)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4212 (insert (format-time-string fmt time))))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4213
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4214 (defun org-time-stamp-inactive (&optional arg)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4215 "Insert an inactive time stamp.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4216 An inactive time stamp is enclosed in square brackets instead of angle
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4217 brackets. It is inactive in the sense that it does not trigger agenda entries,
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4218 does not link to the calendar and cannot be changed with the S-cursor keys.
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4219 So these are more for recording a certain time/date."
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4220 (interactive "P")
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4221 (let ((fmt (if arg (cdr org-time-stamp-formats)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4222 (car org-time-stamp-formats)))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4223 (org-time-was-given nil)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4224 time)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4225 (setq time (org-read-date arg 'totime))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4226 (if org-time-was-given (setq fmt (cdr org-time-stamp-formats)))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4227 (setq fmt (concat "[" (substring fmt 1 -1) "]"))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4228 (insert (format-time-string fmt time))))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4229
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4230 (defvar org-date-ovl (org-make-overlay 1 1))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4231 (org-overlay-put org-date-ovl 'face 'org-warning)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4232 (org-detatch-overlay org-date-ovl)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4233
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4234 (defun org-read-date (&optional with-time to-time)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4235 "Read a date and make things smooth for the user.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4236 The prompt will suggest to enter an ISO date, but you can also enter anything
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4237 which will at least partially be understood by `parse-time-string'.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4238 Unrecognized parts of the date will default to the current day, month, year,
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4239 hour and minute. For example,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4240 3-2-5 --> 2003-02-05
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4241 feb 15 --> currentyear-02-15
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4242 sep 12 9 --> 2009-09-12
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4243 12:45 --> today 12:45
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4244 22 sept 0:34 --> currentyear-09-22 0:34
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4245 12 --> currentyear-currentmonth-12
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4246 Fri --> nearest Friday (today or later)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4247 etc.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4248 The function understands only English month and weekday abbreviations,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4249 but this can be configured with the variables `parse-time-months' and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4250 `parse-time-weekdays'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4251
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4252 While prompting, a calendar is popped up - you can also select the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4253 date with the mouse (button 1). The calendar shows a period of three
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4254 months. To scroll it to other months, use the keys `>' and `<'.
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
4255 If you don't like the calendar, turn it off with
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4256 \(setq org-popup-calendar-for-date-prompt nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4257
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4258 With optional argument TO-TIME, the date will immediately be converted
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4259 to an internal time.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4260 With an optional argument WITH-TIME, the prompt will suggest to also
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4261 insert a time. Note that when WITH-TIME is not set, you can still
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4262 enter a time, and this function will inform the calling routine about
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4263 this change. The calling routine may then choose to change the format
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4264 used to insert the time stamp into the buffer to include the time."
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
4265 (require 'parse-time)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4266 (let* ((org-time-stamp-rounding-minutes
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4267 (if (equal with-time '(16)) 0 org-time-stamp-rounding-minutes))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4268 (ct (org-current-time))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4269 (default-time
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4270 ;; Default time is either today, or, when entering a range,
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4271 ;; the range start.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4272 (if (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4273 (re-search-backward
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
4274 (concat org-ts-regexp "--\\=") ; FIXME: exactly two minuses?
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4275 (- (point) 20) t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4276 (apply
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4277 'encode-time
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4278 (mapcar (lambda(x) (or x 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4279 (parse-time-string (match-string 1))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4280 ct))
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4281 (calendar-move-hook nil)
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4282 (view-diary-entries-initially nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4283 (timestr (format-time-string
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4284 (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4285 (prompt (format "YYYY-MM-DD [%s]: " timestr))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4286 ans ans1 ans2
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4287 second minute hour day month year tl wday wday1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4288
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4289 (if org-popup-calendar-for-date-prompt
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4290 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4291 (save-window-excursion
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4292 (calendar)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4293 (calendar-forward-day (- (time-to-days default-time)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4294 (calendar-absolute-from-gregorian
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4295 (calendar-current-date))))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4296 (org-eval-in-calendar nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4297 (let* ((old-map (current-local-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4298 (map (copy-keymap calendar-mode-map))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4299 (minibuffer-local-map (copy-keymap minibuffer-local-map)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4300 (define-key map (kbd "RET") 'org-calendar-select)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4301 (define-key map (if (featurep 'xemacs) [button1] [mouse-1])
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4302 'org-calendar-select-mouse)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4303 (define-key map (if (featurep 'xemacs) [button2] [mouse-2])
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4304 'org-calendar-select-mouse)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4305 (define-key minibuffer-local-map [(meta shift left)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4306 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4307 (org-eval-in-calendar '(calendar-backward-month 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4308 (define-key minibuffer-local-map [(meta shift right)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4309 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4310 (org-eval-in-calendar '(calendar-forward-month 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4311 (define-key minibuffer-local-map [(shift up)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4312 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4313 (org-eval-in-calendar '(calendar-backward-week 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4314 (define-key minibuffer-local-map [(shift down)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4315 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4316 (org-eval-in-calendar '(calendar-forward-week 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4317 (define-key minibuffer-local-map [(shift left)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4318 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4319 (org-eval-in-calendar '(calendar-backward-day 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4320 (define-key minibuffer-local-map [(shift right)]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4321 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4322 (org-eval-in-calendar '(calendar-forward-day 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4323 (define-key minibuffer-local-map ">"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4324 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4325 (org-eval-in-calendar '(scroll-calendar-left 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4326 (define-key minibuffer-local-map "<"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4327 (lambda () (interactive)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4328 (org-eval-in-calendar '(scroll-calendar-right 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4329 (unwind-protect
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4330 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4331 (use-local-map map)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4332 (setq ans (read-string prompt "" nil nil))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4333 (if (not (string-match "\\S-" ans)) (setq ans nil))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4334 (setq ans (or ans1 ans ans2)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4335 (use-local-map old-map)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4336 ;; Naked prompt only
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4337 (setq ans (read-string prompt "" nil timestr)))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4338 (org-detatch-overlay org-date-ovl)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4339
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4340 (if (string-match
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4341 "^ *\\(\\([0-9]+\\)-\\)?\\([0-1]?[0-9]\\)-\\([0-3]?[0-9]\\)\\([^-0-9]\\|$\\)" ans)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4342 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4343 (setq year (if (match-end 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4344 (string-to-number (match-string 2 ans))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4345 (string-to-number (format-time-string "%Y")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4346 month (string-to-number (match-string 3 ans))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4347 day (string-to-number (match-string 4 ans)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4348 (if (< year 100) (setq year (+ 2000 year)))
69531
b1e915361a06 (org-read-date): Include subgroup 5 into
Carsten Dominik <dominik@science.uva.nl>
parents: 69482
diff changeset
4349 (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
b1e915361a06 (org-read-date): Include subgroup 5 into
Carsten Dominik <dominik@science.uva.nl>
parents: 69482
diff changeset
4350 t nil ans))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4351 (setq tl (parse-time-string ans)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4352 year (or (nth 5 tl) (string-to-number (format-time-string "%Y" ct)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4353 month (or (nth 4 tl) (string-to-number (format-time-string "%m" ct)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4354 day (or (nth 3 tl) (string-to-number (format-time-string "%d" ct)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4355 hour (or (nth 2 tl) (string-to-number (format-time-string "%H" ct)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4356 minute (or (nth 1 tl) (string-to-number (format-time-string "%M" ct)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4357 second (or (nth 0 tl) 0)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4358 wday (nth 6 tl))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4359 (when (and wday (not (nth 3 tl)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4360 ;; Weekday was given, but no day, so pick that day in the week
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4361 ;; on or after the derived date.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4362 (setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4363 (unless (equal wday wday1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4364 (setq day (+ day (% (- wday wday1 -7) 7)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4365 (if (and (boundp 'org-time-was-given)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4366 (nth 2 tl))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4367 (setq org-time-was-given t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4368 (if (< year 100) (setq year (+ 2000 year)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4369 (if to-time
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4370 (encode-time second minute hour day month year)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4371 (if (or (nth 1 tl) (nth 2 tl))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4372 (format "%04d-%02d-%02d %02d:%02d" year month day hour minute)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4373 (format "%04d-%02d-%02d" year month day)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4374
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4375 (defun org-eval-in-calendar (form)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4376 "Eval FORM in the calendar window and return to current window.
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4377 Also, store the cursor date in variable ans2."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4378 (let ((sw (selected-window)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4379 (select-window (get-buffer-window "*Calendar*"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4380 (eval form)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4381 (when (calendar-cursor-to-date)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4382 (let* ((date (calendar-cursor-to-date))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4383 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4384 (setq ans2 (format-time-string "%Y-%m-%d" time))))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4385 (org-move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4386 (select-window sw)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4387
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4388 (defun org-calendar-select ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4389 "Return to `org-read-date' with the date currently selected.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4390 This is used by `org-read-date' in a temporary keymap for the calendar buffer."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4391 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4392 (when (calendar-cursor-to-date)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4393 (let* ((date (calendar-cursor-to-date))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4394 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4395 (setq ans1 (format-time-string "%Y-%m-%d" time)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4396 (if (active-minibuffer-window) (exit-minibuffer))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
4397
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4398 (defun org-calendar-select-mouse (ev)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4399 "Return to `org-read-date' with the date currently selected.
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4400 This is used by `org-read-date' in a temporary keymap for the calendar buffer."
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4401 (interactive "e")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4402 (mouse-set-point ev)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4403 (when (calendar-cursor-to-date)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4404 (let* ((date (calendar-cursor-to-date))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4405 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4406 (setq ans1 (format-time-string "%Y-%m-%d" time)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4407 (if (active-minibuffer-window) (exit-minibuffer))))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4408
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4409 (defun org-check-deadlines (ndays)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4410 "Check if there are any deadlines due or past due.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4411 A deadline is considered due if it happens within `org-deadline-warning-days'
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4412 days from today's date. If the deadline appears in an entry marked DONE,
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4413 it is not shown. The prefix arg NDAYS can be used to test that many
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4414 days. If the prefix is a raw \\[universal-argument] prefix, all deadlines are shown."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4415 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4416 (let* ((org-warn-days
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4417 (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4418 ((equal ndays '(4)) 100000)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4419 (ndays (prefix-numeric-value ndays))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4420 (t org-deadline-warning-days)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4421 (case-fold-search nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4422 (regexp (concat "\\<" org-deadline-string " *<\\([^>]+\\)>"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4423 (callback
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4424 (lambda ()
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4425 (and (let ((d1 (time-to-days (current-time)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4426 (d2 (time-to-days
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4427 (org-time-string-to-time (match-string 1)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4428 (< (- d2 d1) org-warn-days))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4429 (not (org-entry-is-done-p))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4430 (message "%d deadlines past-due or due within %d days"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4431 (org-occur regexp callback)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4432 org-warn-days)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4433
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4434 (defun org-evaluate-time-range (&optional to-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4435 "Evaluate a time range by computing the difference between start and end.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4436 Normally the result is just printed in the echo area, but with prefix arg
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4437 TO-BUFFER, the result is inserted just after the date stamp into the buffer.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4438 If the time range is actually in a table, the result is inserted into the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4439 next column.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4440 For time difference computation, a year is assumed to be exactly 365
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4441 days in order to avoid rounding problems."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4442 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4443 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4444 (unless (org-at-date-range-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4445 (goto-char (point-at-bol))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4446 (re-search-forward org-tr-regexp (point-at-eol) t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4447 (if (not (org-at-date-range-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4448 (error "Not at a time-stamp range, and none found in current line")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4449 (let* ((ts1 (match-string 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4450 (ts2 (match-string 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4451 (havetime (or (> (length ts1) 15) (> (length ts2) 15)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4452 (match-end (match-end 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4453 (time1 (org-time-string-to-time ts1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4454 (time2 (org-time-string-to-time ts2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4455 (t1 (time-to-seconds time1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4456 (t2 (time-to-seconds time2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4457 (diff (abs (- t2 t1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4458 (negative (< (- t2 t1) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4459 ;; (ys (floor (* 365 24 60 60)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4460 (ds (* 24 60 60))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4461 (hs (* 60 60))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4462 (fy "%dy %dd %02d:%02d")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4463 (fy1 "%dy %dd")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4464 (fd "%dd %02d:%02d")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4465 (fd1 "%dd")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4466 (fh "%02d:%02d")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4467 y d h m align)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4468 (if havetime
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4469 (setq ; y (floor (/ diff ys)) diff (mod diff ys)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4470 y 0
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4471 d (floor (/ diff ds)) diff (mod diff ds)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4472 h (floor (/ diff hs)) diff (mod diff hs)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4473 m (floor (/ diff 60)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4474 (setq ; y (floor (/ diff ys)) diff (mod diff ys)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4475 y 0
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4476 d (floor (+ (/ diff ds) 0.5))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4477 h 0 m 0))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4478 (if (not to-buffer)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4479 (message (org-make-tdiff-string y d h m))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4480 (when (org-at-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4481 (goto-char match-end)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4482 (setq align t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4483 (and (looking-at " *|") (goto-char (match-end 0))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4484 (if (looking-at
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4485 "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4486 (replace-match ""))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4487 (if negative (insert " -"))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4488 (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4489 (if (> d 0) (insert " " (format (if havetime fd fd1) d h m))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4490 (insert " " (format fh h m))))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4491 (if align (org-table-align))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4492 (message "Time difference inserted"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4493
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4494 (defun org-make-tdiff-string (y d h m)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4495 (let ((fmt "")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4496 (l nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4497 (if (> y 0) (setq fmt (concat fmt "%d year" (if (> y 1) "s" "") " ")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4498 l (push y l)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4499 (if (> d 0) (setq fmt (concat fmt "%d day" (if (> d 1) "s" "") " ")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4500 l (push d l)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4501 (if (> h 0) (setq fmt (concat fmt "%d hour" (if (> h 1) "s" "") " ")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4502 l (push h l)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4503 (if (> m 0) (setq fmt (concat fmt "%d minute" (if (> m 1) "s" "") " ")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4504 l (push m l)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4505 (apply 'format fmt (nreverse l))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4506
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4507 (defun org-time-string-to-time (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4508 (apply 'encode-time (org-parse-time-string s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4509
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
4510 (defun org-parse-time-string (s &optional nodefault)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4511 "Parse the standard Org-mode time string.
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
4512 This should be a lot faster than the normal `parse-time-string'.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
4513 If time is not given, defaults to 0:00. However, with optional NODEFAULT,
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
4514 hour and minute fields will be nil if not given."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4515 (if (string-match org-ts-regexp1 s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4516 (list 0
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4517 (if (or (match-beginning 8) (not nodefault))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4518 (string-to-number (or (match-string 8 s) "0")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4519 (if (or (match-beginning 7) (not nodefault))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4520 (string-to-number (or (match-string 7 s) "0")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4521 (string-to-number (match-string 4 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4522 (string-to-number (match-string 3 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4523 (string-to-number (match-string 2 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4524 nil nil nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4525 (make-list 9 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4526
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4527 (defun org-timestamp-up (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4528 "Increase the date item at the cursor by one.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4529 If the cursor is on the year, change the year. If it is on the month or
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4530 the day, change that.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4531 With prefix ARG, change by that many units."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4532 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4533 (org-timestamp-change (prefix-numeric-value arg)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4534
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4535 (defun org-timestamp-down (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4536 "Decrease the date item at the cursor by one.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4537 If the cursor is on the year, change the year. If it is on the month or
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4538 the day, change that.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4539 With prefix ARG, change by that many units."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4540 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4541 (org-timestamp-change (- (prefix-numeric-value arg))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4542
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4543 (defun org-timestamp-up-day (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4544 "Increase the date in the time stamp by one day.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4545 With prefix ARG, change that many days."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4546 (interactive "p")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4547 (if (and (not (org-at-timestamp-p))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4548 (org-on-heading-p))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4549 (org-todo 'up)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4550 (org-timestamp-change (prefix-numeric-value arg) 'day)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4551
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4552 (defun org-timestamp-down-day (&optional arg)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4553 "Decrease the date in the time stamp by one day.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4554 With prefix ARG, change that many days."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4555 (interactive "p")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4556 (if (and (not (org-at-timestamp-p))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4557 (org-on-heading-p))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4558 (org-todo 'down)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4559 (org-timestamp-change (- (prefix-numeric-value arg)) 'day)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4560
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4561 (defsubst org-pos-in-match-range (pos n)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4562 (and (match-beginning n)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4563 (<= (match-beginning n) pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4564 (>= (match-end n) pos)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4565
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4566 (defun org-at-timestamp-p ()
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
4567 "Determine if the cursor is in or at a timestamp."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4568 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4569 (let* ((tsr org-ts-regexp2)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4570 (pos (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4571 (ans (or (looking-at tsr)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4572 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4573 (skip-chars-backward "^<\n\r\t")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4574 (if (> (point) 1) (backward-char 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4575 (and (looking-at tsr)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4576 (> (- (match-end 0) pos) -1))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4577 (and (boundp 'org-ts-what)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4578 (setq org-ts-what
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4579 (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4580 ((org-pos-in-match-range pos 2) 'year)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4581 ((org-pos-in-match-range pos 3) 'month)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4582 ((org-pos-in-match-range pos 7) 'hour)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4583 ((org-pos-in-match-range pos 8) 'minute)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4584 ((or (org-pos-in-match-range pos 4)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4585 (org-pos-in-match-range pos 5)) 'day)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4586 (t 'day))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4587 ans))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4588
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4589 (defun org-timestamp-change (n &optional what)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4590 "Change the date in the time stamp at point.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4591 The date will be changed by N times WHAT. WHAT can be `day', `month',
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4592 `year', `minute', `second'. If WHAT is not given, the cursor position
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4593 in the timestamp determines what will be changed."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4594 (let ((fmt (car org-time-stamp-formats))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4595 org-ts-what
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4596 (pos (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4597 ts time time0)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4598 (if (not (org-at-timestamp-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4599 (error "Not at a timestamp"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4600 (setq org-ts-what (or what org-ts-what))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4601 (setq fmt (if (<= (abs (- (cdr org-ts-lengths)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4602 (- (match-end 0) (match-beginning 0))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4603 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4604 (cdr org-time-stamp-formats)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4605 (car org-time-stamp-formats)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4606 (setq ts (match-string 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4607 (replace-match "")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4608 (setq time0 (org-parse-time-string ts))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4609 (setq time
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4610 (apply 'encode-time
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4611 (append
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4612 (list (or (car time0) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4613 (list (+ (if (eq org-ts-what 'minute) n 0) (nth 1 time0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4614 (list (+ (if (eq org-ts-what 'hour) n 0) (nth 2 time0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4615 (list (+ (if (eq org-ts-what 'day) n 0) (nth 3 time0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4616 (list (+ (if (eq org-ts-what 'month) n 0) (nth 4 time0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4617 (list (+ (if (eq org-ts-what 'year) n 0) (nth 5 time0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4618 (nthcdr 6 time0))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4619 (if (eq what 'calendar)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4620 (let ((cal-date
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
4621 (save-excursion
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
4622 (save-match-data
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
4623 (set-buffer "*Calendar*")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4624 (calendar-cursor-to-date)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4625 (setcar (nthcdr 4 time0) (nth 0 cal-date)) ; month
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4626 (setcar (nthcdr 3 time0) (nth 1 cal-date)) ; day
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4627 (setcar (nthcdr 5 time0) (nth 2 cal-date)) ; year
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4628 (setcar time0 (or (car time0) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4629 (setcar (nthcdr 1 time0) (or (nth 1 time0) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4630 (setcar (nthcdr 2 time0) (or (nth 1 time0) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4631 (setq time (apply 'encode-time time0))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4632 (insert (setq org-last-changed-timestamp (format-time-string fmt time)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4633 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4634 ;; Try to recenter the calendar window, if any
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4635 (if (and org-calendar-follow-timestamp-change
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4636 (get-buffer-window "*Calendar*" t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4637 (memq org-ts-what '(day month year)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4638 (org-recenter-calendar (time-to-days time)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4639
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4640 (defun org-recenter-calendar (date)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4641 "If the calendar is visible, recenter it to DATE."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4642 (let* ((win (selected-window))
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4643 (cwin (get-buffer-window "*Calendar*" t))
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4644 (calendar-move-hook nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4645 (when cwin
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4646 (select-window cwin)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4647 (calendar-goto-date (if (listp date) date
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4648 (calendar-gregorian-from-absolute date)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4649 (select-window win))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4650
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4651 (defun org-goto-calendar (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4652 "Go to the Emacs calendar at the current date.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4653 If there is a time stamp in the current line, go to that date.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4654 A prefix ARG can be used to force the current date."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4655 (interactive "P")
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4656 (let ((tsr org-ts-regexp) diff
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4657 (calendar-move-hook nil)
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4658 (view-diary-entries-initially nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4659 (if (or (org-at-timestamp-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4660 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4661 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4662 (looking-at (concat ".*" tsr))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4663 (let ((d1 (time-to-days (current-time)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4664 (d2 (time-to-days
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4665 (org-time-string-to-time (match-string 1)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4666 (setq diff (- d2 d1))))
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
4667 (calendar)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4668 (calendar-goto-today)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4669 (if (and diff (not arg)) (calendar-forward-day diff))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4670
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4671 (defun org-date-from-calendar ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4672 "Insert time stamp corresponding to cursor date in *Calendar* buffer.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4673 If there is already a time stamp at the cursor position, update it."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4674 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4675 (org-timestamp-change 0 'calendar))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4676
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4677 ;;; Agenda, and Diary Integration
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4678
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4679 ;;; Define the mode
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4680
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4681 (defvar org-agenda-mode-map (make-sparse-keymap)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
4682 "Keymap for `org-agenda-mode'.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4683
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4684 (defvar org-agenda-menu) ; defined later in this file.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4685 (defvar org-agenda-follow-mode nil)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4686 (defvar org-agenda-show-log nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4687 (defvar org-agenda-buffer-name "*Org Agenda*")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4688 (defvar org-agenda-redo-command nil)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4689 (defvar org-agenda-mode-hook nil)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4690 (defvar org-agenda-type nil)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4691 (defvar org-agenda-force-single-file nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4692
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4693 ;;;###autoload
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4694 (defun org-agenda-mode ()
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
4695 "Mode for time-sorted view on action items in Org-mode files.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
4696
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
4697 The following commands are available:
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
4698
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
4699 \\{org-agenda-mode-map}"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4700 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4701 (kill-all-local-variables)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4702 (setq major-mode 'org-agenda-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4703 (setq mode-name "Org-Agenda")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4704 (use-local-map org-agenda-mode-map)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4705 (easy-menu-add org-agenda-menu)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4706 (if org-startup-truncated (setq truncate-lines t))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4707 (org-add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
4708 (org-add-hook 'pre-command-hook 'org-unhighlight nil 'local)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4709 (unless org-agenda-keep-modes
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4710 (setq org-agenda-follow-mode nil
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4711 org-agenda-show-log nil))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
4712 (easy-menu-change
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4713 '("Agenda") "Agenda Files"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4714 (append
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
4715 (list
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4716 (vector
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4717 (if (get 'org-agenda-files 'org-restrict)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4718 "Restricted to single file"
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4719 "Edit File List")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4720 '(org-edit-agenda-file-list)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4721 (not (get 'org-agenda-files 'org-restrict)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4722 "--")
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4723 (mapcar 'org-file-menu-entry (org-agenda-files))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4724 (org-agenda-set-mode-name)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4725 (apply
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4726 (if (fboundp 'run-mode-hooks) 'run-mode-hooks 'run-hooks)
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
4727 (list 'org-agenda-mode-hook)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4728
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4729 (define-key org-agenda-mode-map "\C-i" 'org-agenda-goto)
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
4730 (define-key org-agenda-mode-map [(tab)] 'org-agenda-goto)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4731 (define-key org-agenda-mode-map "\C-m" 'org-agenda-switch-to)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4732 (define-key org-agenda-mode-map " " 'org-agenda-show)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4733 (define-key org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4734 (define-key org-agenda-mode-map "o" 'delete-other-windows)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4735 (define-key org-agenda-mode-map "L" 'org-agenda-recenter)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4736 (define-key org-agenda-mode-map "t" 'org-agenda-todo)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4737 (define-key org-agenda-mode-map ":" 'org-agenda-set-tags)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4738 (define-key org-agenda-mode-map "." 'org-agenda-goto-today)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
4739 (define-key org-agenda-mode-map "d" 'org-agenda-day-view)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
4740 (define-key org-agenda-mode-map "w" 'org-agenda-week-view)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4741 (define-key org-agenda-mode-map (org-key 'S-right) 'org-agenda-date-later)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4742 (define-key org-agenda-mode-map (org-key 'S-left) 'org-agenda-date-earlier)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4743 (define-key org-agenda-mode-map [?\C-c ?\C-x (right)] 'org-agenda-date-later)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4744 (define-key org-agenda-mode-map [?\C-c ?\C-x (left)] 'org-agenda-date-earlier)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4745
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4746 (define-key org-agenda-mode-map ">" 'org-agenda-date-prompt)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4747 (let ((l '(1 2 3 4 5 6 7 8 9 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4748 (while l (define-key org-agenda-mode-map
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
4749 (int-to-string (pop l)) 'digit-argument)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4750
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4751 (define-key org-agenda-mode-map "f" 'org-agenda-follow-mode)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4752 (define-key org-agenda-mode-map "l" 'org-agenda-log-mode)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
4753 (define-key org-agenda-mode-map "D" 'org-agenda-toggle-diary)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
4754 (define-key org-agenda-mode-map "g" 'org-agenda-toggle-time-grid)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4755 (define-key org-agenda-mode-map "r" 'org-agenda-redo)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4756 (define-key org-agenda-mode-map "q" 'org-agenda-quit)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4757 (define-key org-agenda-mode-map "x" 'org-agenda-exit)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4758 (define-key org-agenda-mode-map "P" 'org-agenda-show-priority)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
4759 (define-key org-agenda-mode-map "T" 'org-agenda-show-tags)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4760 (define-key org-agenda-mode-map "n" 'next-line)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4761 (define-key org-agenda-mode-map "p" 'previous-line)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4762 (define-key org-agenda-mode-map "\C-n" 'org-agenda-next-date-line)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4763 (define-key org-agenda-mode-map "\C-p" 'org-agenda-previous-date-line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4764 (define-key org-agenda-mode-map "," 'org-agenda-priority)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4765 (define-key org-agenda-mode-map "\C-c," 'org-agenda-priority)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4766 (define-key org-agenda-mode-map "i" 'org-agenda-diary-entry)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
4767 (define-key org-agenda-mode-map "c" 'org-agenda-goto-calendar)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4768 (eval-after-load "calendar"
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4769 '(define-key calendar-mode-map org-calendar-to-agenda-key
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4770 'org-calendar-goto-agenda))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
4771 (define-key org-agenda-mode-map "C" 'org-agenda-convert-date)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
4772 (define-key org-agenda-mode-map "m" 'org-agenda-phases-of-moon)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
4773 (define-key org-agenda-mode-map "M" 'org-agenda-phases-of-moon)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
4774 (define-key org-agenda-mode-map "s" 'org-agenda-sunrise-sunset)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
4775 (define-key org-agenda-mode-map "S" 'org-agenda-sunrise-sunset)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
4776 (define-key org-agenda-mode-map "h" 'org-agenda-holidays)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
4777 (define-key org-agenda-mode-map "H" 'org-agenda-holidays)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4778 (define-key org-agenda-mode-map "+" 'org-agenda-priority-up)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4779 (define-key org-agenda-mode-map "-" 'org-agenda-priority-down)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4780 (define-key org-agenda-mode-map (org-key 'S-up) 'org-agenda-priority-up)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
4781 (define-key org-agenda-mode-map (org-key 'S-down) 'org-agenda-priority-down)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4782 (define-key org-agenda-mode-map [?\C-c ?\C-x (up)] 'org-agenda-priority-up)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
4783 (define-key org-agenda-mode-map [?\C-c ?\C-x (down)] 'org-agenda-priority-down)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4784 (define-key org-agenda-mode-map [(right)] 'org-agenda-later)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4785 (define-key org-agenda-mode-map [(left)] 'org-agenda-earlier)
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
4786 (define-key org-agenda-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4787 (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4788 "Local keymap for agenda entries from Org-mode.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4789
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
4790 (define-key org-agenda-keymap
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4791 (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4792 (define-key org-agenda-keymap
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4793 (if (featurep 'xemacs) [(button3)] [(mouse-3)]) 'org-agenda-show-mouse)
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
4794 (when org-agenda-mouse-1-follows-link
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
4795 (define-key org-agenda-keymap [follow-link] 'mouse-face))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4796 (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4797 '("Agenda"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4798 ("Agenda Files")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4799 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4800 ["Show" org-agenda-show t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4801 ["Go To (other window)" org-agenda-goto t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4802 ["Go To (one window)" org-agenda-switch-to t]
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
4803 ["Follow Mode" org-agenda-follow-mode
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4804 :style toggle :selected org-agenda-follow-mode :active t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4805 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4806 ["Cycle TODO" org-agenda-todo t]
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
4807 ("Tags"
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
4808 ["Show all Tags" org-agenda-show-tags t]
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
4809 ["Set Tags" org-agenda-set-tags t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4810 ("Reschedule"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4811 ["Reschedule +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4812 ["Reschedule -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda 'timeline)]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4813 "--"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4814 ["Reschedule to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4815 ("Priority"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4816 ["Set Priority" org-agenda-priority t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4817 ["Increase Priority" org-agenda-priority-up t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4818 ["Decrease Priority" org-agenda-priority-down t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4819 ["Show Priority" org-agenda-show-priority t])
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4820 "--"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4821 ;; ["New agenda command" org-agenda t]
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
4822 ["Rebuild buffer" org-agenda-redo t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4823 "--"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4824 ["Goto Today" org-agenda-goto-today (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4825 ["Next Dates" org-agenda-later (org-agenda-check-type nil 'agenda)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4826 ["Previous Dates" org-agenda-earlier (org-agenda-check-type nil 'agenda)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4827 "--"
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4828 ["Day View" org-agenda-day-view :active (org-agenda-check-type nil 'agenda)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
4829 :style radio :selected (equal org-agenda-ndays 1)]
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4830 ["Week View" org-agenda-week-view :active (org-agenda-check-type nil 'agenda)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
4831 :style radio :selected (equal org-agenda-ndays 7)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
4832 "--"
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
4833 ["Show Logbook entries" org-agenda-log-mode
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4834 :style toggle :selected org-agenda-show-log :active (org-agenda-check-type nil 'agenda 'timeline)]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4835 ["Include Diary" org-agenda-toggle-diary
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4836 :style toggle :selected org-agenda-include-diary :active (org-agenda-check-type nil 'agenda)]
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
4837 ["Use Time Grid" org-agenda-toggle-time-grid
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4838 :style toggle :selected org-agenda-use-time-grid :active (org-agenda-check-type nil 'agenda)]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4839 "--"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4840 ["New Diary Entry" org-agenda-diary-entry (org-agenda-check-type nil 'agenda 'timeline)]
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
4841 ("Calendar Commands"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4842 ["Goto Calendar" org-agenda-goto-calendar (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4843 ["Phases of the Moon" org-agenda-phases-of-moon (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4844 ["Sunrise/Sunset" org-agenda-sunrise-sunset (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4845 ["Holidays" org-agenda-holidays (org-agenda-check-type nil 'agenda 'timeline)]
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4846 ["Convert" org-agenda-convert-date (org-agenda-check-type nil 'agenda 'timeline)])
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
4847 ["Create iCalendar file" org-export-icalendar-combine-agenda-files t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4848 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4849 ["Quit" org-agenda-quit t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4850 ["Exit and Release Buffers" org-agenda-exit t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4851 ))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4852
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4853 ;;;###autoload
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4854 (defun org-agenda (arg)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4855 "Dispatch agenda commands to collect entries to the agenda buffer.
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4856 Prompts for a character to select a command. Any prefix arg will be passed
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4857 on to the selected command. The default selections are:
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4858
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4859 a Call `org-agenda' to display the agenda for the current day or week.
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4860 t Call `org-todo-list' to display the global todo list.
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4861 T Call `org-todo-list' to display the global todo list, select only
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4862 entries with a specific TODO keyword (the user gets a prompt).
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4863 m Call `org-tags-view' to display headlines with tags matching
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4864 a condition (the user is prompted for the condition).
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4865 M Like `m', but select only TODO entries, no ordinary headlines.
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4866
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4867 More commands can be added by configuring the variable
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4868 `org-agenda-custom-commands'. In particular, specific tags and TODO keyword
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4869 searches can be pre-defined in this way.
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4870
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4871 If the current buffer is in Org-mode and visiting a file, you can also
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4872 first press `1' to indicate that the agenda should be temporarily (until the
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4873 next use of \\[org-agenda]) restricted to the current file."
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4874 (interactive "P")
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4875 (catch 'exit
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
4876 (let ((restrict-ok (and buffer-file-name (eq major-mode 'org-mode)))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4877 (custom org-agenda-custom-commands)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4878 c entry key type string)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4879 (put 'org-agenda-files 'org-restrict nil)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4880 (save-window-excursion
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4881 (delete-other-windows)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4882 (switch-to-buffer-other-window " *Agenda Commands*")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4883 (erase-buffer)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4884 (insert
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4885 "Press key for an agenda command:
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4886 --------------------------------
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4887 a Agenda for current week or day
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4888 t List of all TODO entries T Entries with special TODO kwd
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
4889 m Match a TAGS query M Like m, but only TODO entries
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4890 C Configure your own agenda commands")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4891 (while (setq entry (pop custom))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4892 (setq key (car entry) type (nth 1 entry) string (nth 2 entry))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4893 (insert (format "\n%-4s%-14s: %s"
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4894 key
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4895 (cond
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4896 ((eq type 'tags) "Tags query")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4897 ((eq type 'todo) "TODO keyword")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4898 ((eq type 'tags-tree) "Tags tree")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4899 ((eq type 'todo-tree) "TODO kwd tree")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4900 ((eq type 'occur-tree) "Occur tree")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4901 (t "???"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4902 (org-add-props string nil 'face 'org-warning))))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4903 (goto-char (point-min))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4904 (if (fboundp 'fit-window-to-buffer) (fit-window-to-buffer))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4905 (message "Press key for agenda command%s"
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4906 (if restrict-ok ", or [1] to restrict to current file" ""))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4907 (setq c (read-char-exclusive))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4908 (message "")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4909 (when (equal c ?1)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4910 (if restrict-ok
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
4911 (put 'org-agenda-files 'org-restrict (list buffer-file-name))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4912 (error "Cannot restrict agenda to current buffer"))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4913 (message "Press key for agenda command%s"
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4914 (if restrict-ok " (restricted to current file)" ""))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4915 (setq c (read-char-exclusive))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4916 (message "")))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4917 (require 'calendar) ; FIXME: can we avoid this for some commands?
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4918 ;; For example the todo list should not need it (but does...)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4919 (cond
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4920 ((equal c ?C) (customize-variable 'org-agenda-custom-commands))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4921 ((equal c ?a) (call-interactively 'org-agenda-list))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4922 ((equal c ?t) (call-interactively 'org-todo-list))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4923 ((equal c ?T)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4924 (setq current-prefix-arg (or arg '(4)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4925 (call-interactively 'org-todo-list))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4926 ((equal c ?m) (call-interactively 'org-tags-view))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4927 ((equal c ?M)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4928 (setq current-prefix-arg (or arg '(4)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4929 (call-interactively 'org-tags-view))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4930 ((setq entry (assoc (char-to-string c) org-agenda-custom-commands))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4931 (setq type (nth 1 entry) string (nth 2 entry))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4932 (cond
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4933 ((eq type 'tags)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4934 (org-tags-view current-prefix-arg string))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4935 ((eq type 'todo)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4936 (org-todo-list string))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4937 ((eq type 'tags-tree)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4938 (org-check-for-org-mode)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4939 (org-tags-sparse-tree current-prefix-arg string))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4940 ((eq type 'todo-tree)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4941 (org-check-for-org-mode)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4942 (org-occur (concat "^" outline-regexp "[ \t]*"
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4943 (regexp-quote string) "\\>")))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4944 ((eq type 'occur-tree)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4945 (org-check-for-org-mode)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4946 (org-occur string))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4947 (t (error "Invalid custom agenda command type %s" type))))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
4948 (t (error "Invalid key"))))))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4949
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4950 (defun org-check-for-org-mode ()
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4951 "Make sure current buffer is in org-mode. Error if not."
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4952 (or (eq major-mode 'org-mode)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4953 (error "Cannot execute org-mode agenda command on buffer in %s."
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4954 major-mode)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
4955
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4956 (defun org-fit-agenda-window ()
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4957 "Fit the window to the buffer size."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4958 (and org-fit-agenda-window
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4959 (fboundp 'fit-window-to-buffer)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4960 (fit-window-to-buffer nil (/ (* (frame-height) 3) 4)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4961 (/ (frame-height) 2))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
4962
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4963 (defun org-agenda-files (&optional unrestricted)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4964 "Get the list of agenda files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4965 Optional UNRESTRICTED means return the full list even if a restriction
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4966 is currently in place."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4967 (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4968 ((and (not unrestricted) (get 'org-agenda-files 'org-restrict)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4969 ((stringp org-agenda-files) (org-read-agenda-file-list))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4970 ((listp org-agenda-files) org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4971 (t (error "Invalid value of `org-agenda-files'"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4972
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4973 (defvar org-window-configuration)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4974
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4975 (defun org-edit-agenda-file-list ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4976 "Edit the list of agenda files.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4977 Depending on setup, this either uses customize to edit the variable
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4978 `org-agenda-files', or it visits the file that is holding the list. In the
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4979 latter case, the buffer is set up in a way that saving it automatically kills
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4980 the buffer and restores the previous window configuration."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4981 (interactive)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4982 (if (stringp org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4983 (let ((cw (current-window-configuration)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4984 (find-file org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4985 (set (make-local-variable 'org-window-configuration) cw)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4986 (org-add-hook 'after-save-hook
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4987 (lambda ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4988 (set-window-configuration
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4989 (prog1 org-window-configuration
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4990 (kill-buffer (current-buffer))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4991 (org-install-agenda-files-menu)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4992 (message "New agenda file list installed"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4993 nil 'local)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4994 (message (substitute-command-keys
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4995 "Edit list and finish with \\[save-buffer]")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4996 (customize-variable 'org-agenda-files)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4997
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4998 (defun org-store-new-agenda-file-list (list)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
4999 "Set new value for the agenda file list and save it correcly."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5000 (if (stringp org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5001 (let ((f org-agenda-files) b)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5002 (while (setq b (find-buffer-visiting f)) (kill-buffer b))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5003 (with-temp-file f
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5004 (insert (mapconcat 'identity list "\n") "\n")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5005 (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5006 (setq org-agenda-files list)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5007 (customize-save-variable 'org-agenda-files org-agenda-files))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5008
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5009 (defun org-read-agenda-file-list ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5010 "Read the list of agenda files from a file."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5011 (when (stringp org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5012 (with-temp-buffer
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5013 (insert-file-contents org-agenda-files)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5014 (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*"))))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5015
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5016 (defvar org-agenda-markers nil
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5017 "List of all currently active markers created by `org-agenda'.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5018 (defvar org-agenda-last-marker-time (time-to-seconds (current-time))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5019 "Creation time of the last agenda marker.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5020
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5021 (defun org-agenda-new-marker (&optional pos)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5022 "Return a new agenda marker.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5023 Org-mode keeps a list of these markers and resets them when they are
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5024 no longer in use."
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5025 (let ((m (copy-marker (or pos (point)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5026 (setq org-agenda-last-marker-time (time-to-seconds (current-time)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5027 (push m org-agenda-markers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5028 m))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5029
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5030 (defun org-agenda-maybe-reset-markers (&optional force)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5031 "Reset markers created by `org-agenda'. But only if they are old enough."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5032 (if (or force
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5033 (> (- (time-to-seconds (current-time))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5034 org-agenda-last-marker-time)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5035 5))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5036 (while org-agenda-markers
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5037 (move-marker (pop org-agenda-markers) nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5038
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5039 (defvar org-agenda-new-buffers nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5040 "Buffers created to visit agenda files.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5041
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5042 (defun org-get-agenda-file-buffer (file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5043 "Get a buffer visiting FILE. If the buffer needs to be created, add
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5044 it to the list of buffers which might be released later."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5045 (let ((buf (find-buffer-visiting file)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5046 (if buf
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5047 buf ; just return it
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5048 ;; Make a new buffer and remember it
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5049 (setq buf (find-file-noselect file))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5050 (if buf (push buf org-agenda-new-buffers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5051 buf)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5052
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5053 (defun org-release-buffers (blist)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5054 "Release all buffers in list, asking the user for confirmation when needed.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5055 When a buffer is unmodified, it is just killed. When modified, it is saved
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5056 \(if the user agrees) and then killed."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5057 (let (buf file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5058 (while (setq buf (pop blist))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5059 (setq file (buffer-file-name buf))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5060 (when (and (buffer-modified-p buf)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5061 file
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5062 (y-or-n-p (format "Save file %s? " file)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5063 (with-current-buffer buf (save-buffer)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5064 (kill-buffer buf))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5065
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5066 (defvar org-respect-restriction nil) ; Dynamically-scoped param.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5067
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5068 (defun org-timeline (&optional include-all keep-modes)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5069 "Show a time-sorted view of the entries in the current org file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5070 Only entries with a time stamp of today or later will be listed. With
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5071 \\[universal-argument] prefix, all unfinished TODO items will also be shown,
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5072 under the current date.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5073 If the buffer contains an active region, only check the region for
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5074 dates."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5075 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5076 (require 'calendar)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5077 (org-agenda-maybe-reset-markers 'force)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5078 (org-compile-prefix-format org-timeline-prefix-format)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5079 (let* ((dopast t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5080 (dotodo include-all)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5081 (doclosed org-agenda-show-log)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5082 (org-agenda-keep-modes keep-modes)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5083 (entry buffer-file-name)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5084 (org-agenda-files (list buffer-file-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5085 (date (calendar-current-date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5086 (win (selected-window))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5087 (pos1 (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5088 (beg (if (org-region-active-p) (region-beginning) (point-min)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5089 (end (if (org-region-active-p) (region-end) (point-max)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5090 (day-numbers (org-get-all-dates beg end 'no-ranges
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5091 t doclosed)) ; always include today
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5092 (today (time-to-days (current-time)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5093 (org-respect-restriction t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5094 (past t)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5095 args
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5096 s e rtn d)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
5097 (setq org-agenda-redo-command
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5098 (list 'progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5099 (list 'switch-to-buffer-other-window (current-buffer))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5100 (list 'org-timeline (list 'quote include-all) t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5101 (if (not dopast)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5102 ;; Remove past dates from the list of dates.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5103 (setq day-numbers (delq nil (mapcar (lambda(x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5104 (if (>= x today) x nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5105 day-numbers))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
5106 (switch-to-buffer-other-window
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5107 (get-buffer-create org-agenda-buffer-name))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5108 (setq buffer-read-only nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5109 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5110 (org-agenda-mode) (setq buffer-read-only nil)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5111 (set (make-local-variable 'org-agenda-type) 'timeline)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5112 (if doclosed (push :closed args))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5113 (push :timestamp args)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5114 (if dotodo (push :todo args))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5115 (while (setq d (pop day-numbers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5116 (if (and (>= d today)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5117 dopast
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5118 past)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5119 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5120 (setq past nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5121 (insert (make-string 79 ?-) "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5122 (setq date (calendar-gregorian-from-absolute d))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5123 (setq s (point))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5124 (setq rtn (apply 'org-agenda-get-day-entries
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5125 entry date args))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5126 (if (or rtn (equal d today))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5127 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5128 (insert (calendar-day-name date) " "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5129 (number-to-string (extract-calendar-day date)) " "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5130 (calendar-month-name (extract-calendar-month date)) " "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5131 (number-to-string (extract-calendar-year date)) "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5132 (put-text-property s (1- (point)) 'face
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5133 'org-level-3)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5134 (if (equal d today)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5135 (put-text-property s (1- (point)) 'org-today t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5136 (insert (org-finalize-agenda-entries rtn) "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5137 (put-text-property s (1- (point)) 'day d))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5138 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5139 (setq buffer-read-only t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5140 (goto-char (or (text-property-any (point-min) (point-max) 'org-today t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5141 (point-min)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5142 (when (not org-select-timeline-window)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5143 (select-window win)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5144 (goto-char pos1))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5145
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5146 ;;;###autoload
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5147 (defun org-agenda-list (&optional include-all start-day ndays keep-modes)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5148 "Produce a weekly view from all files in variable `org-agenda-files'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5149 The view will be for the current week, but from the overview buffer you
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5150 will be able to go to other weeks.
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5151 With one \\[universal-argument] prefix argument INCLUDE-ALL, all unfinished TODO items will
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5152 also be shown, under the current date.
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5153 With two \\[universal-argument] prefix argument INCLUDE-ALL, all TODO entries marked DONE
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5154 on the days are also shown. See the variable `org-log-done' for how
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5155 to turn on logging.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5156 START-DAY defaults to TODAY, or to the most recent match for the weekday
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5157 given in `org-agenda-start-on-weekday'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5158 NDAYS defaults to `org-agenda-ndays'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5159 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5160 (org-agenda-maybe-reset-markers 'force)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5161 (org-compile-prefix-format org-agenda-prefix-format)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5162 (require 'calendar)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5163 (let* ((org-agenda-start-on-weekday
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5164 (if (or (equal ndays 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5165 (and (null ndays) (equal 1 org-agenda-ndays)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5166 nil org-agenda-start-on-weekday))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5167 (org-agenda-keep-modes keep-modes)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5168 (thefiles (org-agenda-files))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5169 (files thefiles)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5170 (win (selected-window))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5171 (today (time-to-days (current-time)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5172 (sd (or start-day today))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5173 (start (if (or (null org-agenda-start-on-weekday)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5174 (< org-agenda-ndays 7))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5175 sd
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5176 (let* ((nt (calendar-day-of-week
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5177 (calendar-gregorian-from-absolute sd)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5178 (n1 org-agenda-start-on-weekday)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5179 (d (- nt n1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5180 (- sd (+ (if (< d 0) 7 0) d)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5181 (day-numbers (list start))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5182 ;FIXME (inhibit-redisplay t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5183 s e rtn rtnall file date d start-pos end-pos todayp nd)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
5184 (setq org-agenda-redo-command
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5185 (list 'org-agenda-list (list 'quote include-all) start-day ndays t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5186 ;; Make the list of days
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5187 (setq ndays (or ndays org-agenda-ndays)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5188 nd ndays)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5189 (while (> ndays 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5190 (push (1+ (car day-numbers)) day-numbers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5191 (setq ndays (1- ndays)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5192 (setq day-numbers (nreverse day-numbers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5193 (if (not (equal (current-buffer) (get-buffer org-agenda-buffer-name)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5194 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5195 (delete-other-windows)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5196 (switch-to-buffer-other-window
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5197 (get-buffer-create org-agenda-buffer-name))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5198 (setq buffer-read-only nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5199 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5200 (org-agenda-mode) (setq buffer-read-only nil)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5201 (set (make-local-variable 'org-agenda-type) 'agenda)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5202 (set (make-local-variable 'starting-day) (car day-numbers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5203 (set (make-local-variable 'include-all-loc) include-all)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5204 (when (and (or include-all org-agenda-include-all-todo)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5205 (member today day-numbers))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5206 (setq files thefiles
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5207 rtnall nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5208 (while (setq file (pop files))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5209 (catch 'nextfile
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5210 (org-check-agenda-file file)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5211 (setq date (calendar-gregorian-from-absolute today)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5212 rtn (org-agenda-get-day-entries
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5213 file date :todo))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5214 (setq rtnall (append rtnall rtn))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
5215 (when rtnall
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5216 (insert "ALL CURRENTLY OPEN TODO ITEMS:\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5217 (add-text-properties (point-min) (1- (point))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5218 (list 'face 'org-level-3))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5219 (insert (org-finalize-agenda-entries rtnall) "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5220 (while (setq d (pop day-numbers))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5221 (setq date (calendar-gregorian-from-absolute d)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5222 s (point))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5223 (if (or (setq todayp (= d today))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5224 (and (not start-pos) (= d sd)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5225 (setq start-pos (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5226 (if (and start-pos (not end-pos))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5227 (setq end-pos (point))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5228 (setq files thefiles
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5229 rtnall nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5230 (while (setq file (pop files))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5231 (catch 'nextfile
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5232 (org-check-agenda-file file)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5233 (if org-agenda-show-log
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5234 (setq rtn (org-agenda-get-day-entries
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5235 file date
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5236 :deadline :scheduled :timestamp :closed))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5237 (setq rtn (org-agenda-get-day-entries
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5238 file date
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5239 :deadline :scheduled :timestamp)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5240 (setq rtnall (append rtnall rtn))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5241 (if org-agenda-include-diary
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5242 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5243 (require 'diary-lib)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5244 (setq rtn (org-get-entries-from-diary date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5245 (setq rtnall (append rtnall rtn))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5246 (if (or rtnall org-agenda-show-all-dates)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5247 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5248 (insert (format "%-9s %2d %s %4d\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5249 (calendar-day-name date)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5250 (extract-calendar-day date)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5251 (calendar-month-name (extract-calendar-month date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5252 (extract-calendar-year date)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5253 (put-text-property s (1- (point)) 'face
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5254 'org-level-3)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5255 (if rtnall (insert
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5256 (org-finalize-agenda-entries
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5257 (org-agenda-add-time-grid-maybe
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5258 rtnall nd todayp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5259 "\n"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5260 (put-text-property s (1- (point)) 'day d))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5261 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5262 (setq buffer-read-only t)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5263 (org-fit-agenda-window)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5264 (unless (and (pos-visible-in-window-p (point-min))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5265 (pos-visible-in-window-p (point-max)))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5266 (goto-char (1- (point-max)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5267 (recenter -1)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5268 (if (not (pos-visible-in-window-p (or start-pos 1)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5269 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5270 (goto-char (or start-pos 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5271 (recenter 1))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5272 (goto-char (or start-pos 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5273 (if (not org-select-agenda-window) (select-window win))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5274 (message "")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5275
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5276 (defvar org-select-this-todo-keyword nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5277
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5278 ;;;###autoload
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5279 (defun org-todo-list (arg &optional keep-modes)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5280 "Show all TODO entries from all agenda file in a single list.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5281 The prefix arg can be used to select a specific TODO keyword and limit
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5282 the list to these. When using \\[universal-argument], you will be prompted
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5283 for a keyword. A numeric prefix directly selects the Nth keyword in
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5284 `org-todo-keywords'."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5285 (interactive "P")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5286 (org-agenda-maybe-reset-markers 'force)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5287 (org-compile-prefix-format org-agenda-prefix-format)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5288 (let* ((org-agenda-keep-modes keep-modes)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5289 (today (time-to-days (current-time)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5290 (date (calendar-gregorian-from-absolute today))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5291 (win (selected-window))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5292 (kwds org-todo-keywords)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5293 (completion-ignore-case t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5294 (org-select-this-todo-keyword
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
5295 (if (stringp arg) arg
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
5296 (and arg (integerp arg) (nth (1- arg) org-todo-keywords))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5297 rtn rtnall files file pos)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5298 (when (equal arg '(4))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5299 (setq org-select-this-todo-keyword
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5300 (completing-read "Keyword: " (mapcar 'list org-todo-keywords)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5301 nil t)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5302 (and (equal 0 arg) (setq org-select-this-todo-keyword nil))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5303 (if (not (equal (current-buffer) (get-buffer org-agenda-buffer-name)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5304 (progn
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5305 (delete-other-windows)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5306 (switch-to-buffer-other-window
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5307 (get-buffer-create org-agenda-buffer-name))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5308 (setq buffer-read-only nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5309 (erase-buffer)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5310 (org-agenda-mode) (setq buffer-read-only nil)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5311 (set (make-local-variable 'org-agenda-type) 'todo)
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5312 (set (make-local-variable 'last-arg) arg)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5313 (set (make-local-variable 'org-todo-keywords) kwds)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5314 (set (make-local-variable 'org-agenda-redo-command)
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5315 '(org-todo-list (or current-prefix-arg last-arg) t))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5316 (setq files (org-agenda-files)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5317 rtnall nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5318 (while (setq file (pop files))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5319 (catch 'nextfile
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5320 (org-check-agenda-file file)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5321 (setq rtn (org-agenda-get-day-entries file date :todo))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5322 (setq rtnall (append rtnall rtn))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5323 (insert "Global list of TODO items of type: ")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5324 (add-text-properties (point-min) (1- (point))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5325 (list 'face 'org-level-3))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5326 (setq pos (point))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5327 (insert (or org-select-this-todo-keyword "ALL") "\n")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5328 (add-text-properties pos (1- (point)) (list 'face 'org-warning))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5329 (setq pos (point))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5330 (insert
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5331 "Available with `N r': (0)ALL "
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5332 (let ((n 0))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5333 (mapconcat (lambda (x)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5334 (format "(%d)%s" (setq n (1+ n)) x))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5335 org-todo-keywords " "))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5336 "\n")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5337 (add-text-properties pos (1- (point)) (list 'face 'org-level-3))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5338 (when rtnall
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5339 (insert (org-finalize-agenda-entries rtnall) "\n"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5340 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5341 (setq buffer-read-only t)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5342 (org-fit-agenda-window)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5343 (if (not org-select-agenda-window) (select-window win))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5344
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5345 (defun org-check-agenda-file (file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5346 "Make sure FILE exists. If not, ask user what to do."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5347 (when (not (file-exists-p file))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5348 (message "non-existent file %s. [R]emove from list or [A]bort?"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5349 (abbreviate-file-name file))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5350 (let ((r (downcase (read-char-exclusive))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5351 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5352 ((equal r ?r)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5353 (org-remove-file file)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5354 (throw 'nextfile t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5355 (t (error "Abort"))))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5356
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5357 (defun org-agenda-check-type (error &rest types)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5358 "Check if agenda buffer is of allowed type.
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5359 If ERROR is non-nil, throw an error, otherwise just return nil."
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5360 (if (memq org-agenda-type types)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5361 t
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5362 (if error
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5363 (error "Now allowed in %s-type agenda buffers" org-agenda-type)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5364 nil)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5365
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5366 (defun org-agenda-quit ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5367 "Exit agenda by removing the window or the buffer."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5368 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5369 (let ((buf (current-buffer)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5370 (if (not (one-window-p)) (delete-window))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5371 (kill-buffer buf)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5372 (org-agenda-maybe-reset-markers 'force)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5373
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5374 (defun org-agenda-exit ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5375 "Exit agenda by removing the window or the buffer.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5376 Also kill all Org-mode buffers which have been loaded by `org-agenda'.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5377 Org-mode buffers visited directly by the user will not be touched."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5378 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5379 (org-release-buffers org-agenda-new-buffers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5380 (setq org-agenda-new-buffers nil)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5381 (org-agenda-quit))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5382
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5383 (defun org-agenda-redo ()
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5384 "Rebuild Agenda.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5385 When this is the global TODO list, a prefix argument will be interpreted."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5386 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5387 (message "Rebuilding agenda buffer...")
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5388 (eval org-agenda-redo-command)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5389 (message "Rebuilding agenda buffer...done"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5390
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5391 (defun org-agenda-goto-today ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5392 "Go to today."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5393 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5394 (org-agenda-check-type t 'timeline 'agenda)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5395 (if (boundp 'starting-day)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5396 (let ((cmd (car org-agenda-redo-command))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5397 (iall (nth 1 org-agenda-redo-command))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5398 (nday (nth 3 org-agenda-redo-command))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5399 (keep (nth 4 org-agenda-redo-command)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5400 (eval (list cmd iall nil nday keep)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5401 (goto-char (or (text-property-any (point-min) (point-max) 'org-today t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5402 (point-min)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5403
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5404 (defun org-agenda-later (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5405 "Go forward in time by `org-agenda-ndays' days.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5406 With prefix ARG, go forward that many times `org-agenda-ndays'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5407 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5408 (org-agenda-check-type t 'agenda)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5409 (org-agenda-list (if (boundp 'include-all-loc) include-all-loc nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5410 (+ starting-day (* arg org-agenda-ndays)) nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5411
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5412 (defun org-agenda-earlier (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5413 "Go back in time by `org-agenda-ndays' days.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5414 With prefix ARG, go back that many times `org-agenda-ndays'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5415 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5416 (org-agenda-check-type t 'agenda)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5417 (org-agenda-list (if (boundp 'include-all-loc) include-all-loc nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5418 (- starting-day (* arg org-agenda-ndays)) nil t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5419
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5420 (defun org-agenda-week-view ()
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5421 "Switch to weekly view for agenda."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5422 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5423 (org-agenda-check-type t 'agenda)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5424 (setq org-agenda-ndays 7)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5425 (org-agenda-list include-all-loc
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5426 (or (get-text-property (point) 'day)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5427 starting-day)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5428 nil t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5429 (org-agenda-set-mode-name)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5430 (message "Switched to week view"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5431
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5432 (defun org-agenda-day-view ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5433 "Switch to daily view for agenda."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5434 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5435 (org-agenda-check-type t 'agenda)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5436 (setq org-agenda-ndays 1)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5437 (org-agenda-list include-all-loc
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5438 (or (get-text-property (point) 'day)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5439 starting-day)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
5440 nil t)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5441 (org-agenda-set-mode-name)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5442 (message "Switched to day view"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5443
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5444 (defun org-agenda-next-date-line (&optional arg)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5445 "Jump to the next line indicating a date in agenda buffer."
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5446 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5447 (org-agenda-check-type t 'agenda 'timeline)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5448 (beginning-of-line 1)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5449 (if (looking-at "^\\S-") (forward-char 1))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5450 (if (not (re-search-forward "^\\S-" nil t arg))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5451 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5452 (backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5453 (error "No next date after this line in this buffer")))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5454 (goto-char (match-beginning 0)))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5455
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5456 (defun org-agenda-previous-date-line (&optional arg)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5457 "Jump to the previous line indicating a date in agenda buffer."
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5458 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5459 (org-agenda-check-type t 'agenda 'timeline)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5460 (beginning-of-line 1)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5461 (if (not (re-search-backward "^\\S-" nil t arg))
63431
fd4b70bc23a4 (org-promote, org-evaluate-time-range, org-agenda-next-date-line,
Juanma Barranquero <lekktu@gmail.com>
parents: 63367
diff changeset
5462 (error "No previous date before this line in this buffer")))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5463
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5464 ;; Initialize the highlight
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5465 (defvar org-hl (org-make-overlay 1 1))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5466 (org-overlay-put org-hl 'face 'highlight)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5467
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5468 (defun org-highlight (begin end &optional buffer)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5469 "Highlight a region with overlay."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5470 (funcall (if (featurep 'xemacs) 'set-extent-endpoints 'move-overlay)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5471 org-hl begin end (or buffer (current-buffer))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5472
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5473 (defun org-unhighlight ()
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5474 "Detach overlay INDEX."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5475 (funcall (if (featurep 'xemacs) 'detach-extent 'delete-overlay) org-hl))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5476
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5477
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5478 (defun org-agenda-follow-mode ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5479 "Toggle follow mode in an agenda buffer."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5480 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5481 (setq org-agenda-follow-mode (not org-agenda-follow-mode))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5482 (org-agenda-set-mode-name)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5483 (message "Follow mode is %s"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5484 (if org-agenda-follow-mode "on" "off")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5485
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5486 (defun org-agenda-log-mode ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5487 "Toggle log mode in an agenda buffer."
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5488 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5489 (org-agenda-check-type t 'agenda 'timeline)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5490 (setq org-agenda-show-log (not org-agenda-show-log))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5491 (org-agenda-set-mode-name)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5492 (org-agenda-redo)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5493 (message "Log mode is %s"
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5494 (if org-agenda-show-log "on" "off")))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5495
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5496 (defun org-agenda-toggle-diary ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5497 "Toggle diary inclusion in an agenda buffer."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5498 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5499 (org-agenda-check-type t 'agenda)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5500 (setq org-agenda-include-diary (not org-agenda-include-diary))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5501 (org-agenda-redo)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5502 (org-agenda-set-mode-name)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5503 (message "Diary inclusion turned %s"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5504 (if org-agenda-include-diary "on" "off")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5505
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5506 (defun org-agenda-toggle-time-grid ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5507 "Toggle time grid in an agenda buffer."
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5508 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5509 (org-agenda-check-type t 'agenda)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5510 (setq org-agenda-use-time-grid (not org-agenda-use-time-grid))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5511 (org-agenda-redo)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5512 (org-agenda-set-mode-name)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5513 (message "Time-grid turned %s"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5514 (if org-agenda-use-time-grid "on" "off")))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
5515
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5516 (defun org-agenda-set-mode-name ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5517 "Set the mode name to indicate all the small mode settings."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5518 (setq mode-name
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5519 (concat "Org-Agenda"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5520 (if (equal org-agenda-ndays 1) " Day" "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5521 (if (equal org-agenda-ndays 7) " Week" "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5522 (if org-agenda-follow-mode " Follow" "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5523 (if org-agenda-include-diary " Diary" "")
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5524 (if org-agenda-use-time-grid " Grid" "")
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5525 (if org-agenda-show-log " Log" "")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5526 (force-mode-line-update))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5527
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5528 (defun org-agenda-post-command-hook ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5529 (and (eolp) (not (bolp)) (backward-char 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5530 (if (and org-agenda-follow-mode
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5531 (get-text-property (point) 'org-marker))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5532 (org-agenda-show)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5533
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5534 (defvar org-disable-agenda-to-diary nil) ;Dynamically-scoped param.
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5535
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5536 (defun org-get-entries-from-diary (date)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5537 "Get the (Emacs Calendar) diary entries for DATE."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5538 (let* ((fancy-diary-buffer "*temporary-fancy-diary-buffer*")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5539 (diary-display-hook '(fancy-diary-display))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5540 (list-diary-entries-hook
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5541 (cons 'org-diary-default-entry list-diary-entries-hook))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5542 (diary-file-name-prefix-function nil) ; turn this feature off
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5543 (diary-modify-entry-list-string-function 'org-modify-diary-entry-string)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5544 entries
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5545 (org-disable-agenda-to-diary t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5546 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5547 (save-window-excursion
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
5548 (list-diary-entries date 1))) ;; Keep this name for now, compatibility
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5549 (if (not (get-buffer fancy-diary-buffer))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5550 (setq entries nil)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5551 (with-current-buffer fancy-diary-buffer
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5552 (setq buffer-read-only nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5553 (if (= (point-max) 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5554 ;; No entries
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5555 (setq entries nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5556 ;; Omit the date and other unnecessary stuff
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5557 (org-agenda-cleanup-fancy-diary)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5558 ;; Add prefix to each line and extend the text properties
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5559 (if (= (point-max) 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5560 (setq entries nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5561 (setq entries (buffer-substring (point-min) (- (point-max) 1)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5562 (set-buffer-modified-p nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5563 (kill-buffer fancy-diary-buffer)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5564 (when entries
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5565 (setq entries (org-split-string entries "\n"))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
5566 (setq entries
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5567 (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5568 (lambda (x)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
5569 (setq x (org-format-agenda-item "" x "Diary" nil 'time))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5570 ;; Extend the text properties to the beginning of the line
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5571 (org-add-props x (text-properties-at (1- (length x)) x)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5572 entries)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5573
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5574 (defun org-agenda-cleanup-fancy-diary ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5575 "Remove unwanted stuff in buffer created by `fancy-diary-display'.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5576 This gets rid of the date, the underline under the date, and
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5577 the dummy entry installed by `org-mode' to ensure non-empty diary for each
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5578 date. It also removes lines that contain only whitespace."
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5579 (goto-char (point-min))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5580 (if (looking-at ".*?:[ \t]*")
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5581 (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5582 (replace-match "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5583 (re-search-forward "\n=+$" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5584 (replace-match "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5585 (while (re-search-backward "^ +\n?" nil t) (replace-match "")))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5586 (re-search-forward "\n=+$" nil t)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5587 (delete-region (point-min) (min (point-max) (1+ (match-end 0)))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5588 (goto-char (point-min))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5589 (while (re-search-forward "^ +\n" nil t)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5590 (replace-match ""))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5591 (goto-char (point-min))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5592 (if (re-search-forward "^Org-mode dummy\n?" nil t)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5593 (replace-match "")))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5594
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5595 ;; Make sure entries from the diary have the right text properties.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5596 (eval-after-load "diary-lib"
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5597 '(if (boundp 'diary-modify-entry-list-string-function)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5598 ;; We can rely on the hook, nothing to do
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5599 nil
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5600 ;; Hook not avaiable, must use advice to make this work
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5601 (defadvice add-to-diary-list (before org-mark-diary-entry activate)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5602 "Make the position visible."
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5603 (if (and org-disable-agenda-to-diary ;; called from org-agenda
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5604 (stringp string)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5605 buffer-file-name)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5606 (setq string (org-modify-diary-entry-string string))))))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5607
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5608 (defun org-modify-diary-entry-string (string)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5609 "Add text properties to string, allowing org-mode to act on it."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5610 (org-add-props string nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5611 'mouse-face 'highlight
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5612 'keymap org-agenda-keymap
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5613 'help-echo (format "mouse-2 or RET jump to diary file %s"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5614 (abbreviate-file-name buffer-file-name))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5615 'org-agenda-diary-link t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5616 'org-marker (org-agenda-new-marker (point-at-bol))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5617
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5618 (defun org-diary-default-entry ()
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5619 "Add a dummy entry to the diary.
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5620 Needed to avoid empty dates which mess up holiday display."
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5621 ;; Catch the error if dealing with the new add-to-diary-alist
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5622 (when org-disable-agenda-to-diary
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5623 (condition-case nil
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5624 (add-to-diary-list original-date "Org-mode dummy" "")
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5625 (error
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5626 (add-to-diary-list original-date "Org-mode dummy" "" nil)))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
5627
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5628 (defun org-cycle-agenda-files ()
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5629 "Cycle through the files in `org-agenda-files'.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5630 If the current buffer visits an agenda file, find the next one in the list.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5631 If the current buffer does not, find the first agenda file."
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5632 (interactive)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5633 (let* ((fs (org-agenda-files t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5634 (files (append fs (list (car fs))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5635 (tcf (if buffer-file-name (file-truename buffer-file-name)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5636 file)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5637 (unless files (error "No agenda files"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5638 (catch 'exit
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5639 (while (setq file (pop files))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5640 (if (equal (file-truename file) tcf)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5641 (when (car files)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5642 (find-file (car files))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5643 (throw 'exit t))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5644 (find-file (car fs)))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5645
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5646 (defun org-agenda-file-to-end ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5647 "Move/add the current file to the end of the agenda file list.
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5648 If the file is not present in the list, it is appended to the list. If it is
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5649 present, it is moved there."
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5650 (interactive)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5651 (org-agenda-file-to-front 'to-end))
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5652
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5653 (defun org-agenda-file-to-front (&optional to-end)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5654 "Move/add the current file to the top of the agenda file list.
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5655 If the file is not present in the list, it is added to the front. If it is
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5656 present, it is moved there. With optional argument TO-END, add/move to the
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5657 end of the list."
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5658 (interactive "P")
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5659 (let ((file-alist (mapcar (lambda (x)
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5660 (cons (file-truename x) x))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5661 (org-agenda-files t)))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5662 (ctf (file-truename buffer-file-name))
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5663 x had)
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5664 (setq x (assoc ctf file-alist) had x)
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5665
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5666 (if (not x) (setq x (cons ctf (abbreviate-file-name buffer-file-name))))
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5667 (if to-end
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5668 (setq file-alist (append (delq x file-alist) (list x)))
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
5669 (setq file-alist (cons x (delq x file-alist))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5670 (org-store-new-agenda-file-list (mapcar 'cdr file-alist))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5671 (org-install-agenda-files-menu)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5672 (message "File %s to %s of agenda file list"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
5673 (if had "moved" "added") (if to-end "end" "front"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5674
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5675 (defun org-remove-file (&optional file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5676 "Remove current file from the list of files in variable `org-agenda-files'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5677 These are the files which are being checked for agenda entries.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5678 Optional argument FILE means, use this file instead of the current."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5679 (interactive)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5680 (let* ((file (or file buffer-file-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5681 (true-file (file-truename file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5682 (afile (abbreviate-file-name file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5683 (files (delq nil (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5684 (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5685 (if (equal true-file
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5686 (file-truename x))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5687 nil x))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5688 (org-agenda-files t)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5689 (if (not (= (length files) (length (org-agenda-files t))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5690 (progn
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5691 (org-store-new-agenda-file-list files)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5692 (org-install-agenda-files-menu)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5693 (message "Removed file: %s" afile))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5694 (message "File was not in list: %s" afile))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5695
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5696 (defun org-file-menu-entry (file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5697 (vector file (list 'find-file file) t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5698
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5699 (defun org-get-all-dates (beg end &optional no-ranges force-today inactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5700 "Return a list of all relevant day numbers from BEG to END buffer positions.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5701 If NO-RANGES is non-nil, include only the start and end dates of a range,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5702 not every single day in the range. If FORCE-TODAY is non-nil, make
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5703 sure that TODAY is included in the list. If INACTIVE is non-nil, also
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5704 inactive time stamps (those in square brackets) are included."
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5705 (let ((re (if inactive org-ts-regexp-both org-ts-regexp))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5706 dates date day day1 day2 ts1 ts2)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5707 (if force-today
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5708 (setq dates (list (time-to-days (current-time)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5709 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5710 (goto-char beg)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5711 (while (re-search-forward re end t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5712 (setq day (time-to-days (org-time-string-to-time
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5713 (substring (match-string 1) 0 10))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5714 (or (memq day dates) (push day dates)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5715 (unless no-ranges
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5716 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5717 (while (re-search-forward org-tr-regexp end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5718 (setq ts1 (substring (match-string 1) 0 10)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5719 ts2 (substring (match-string 2) 0 10)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5720 day1 (time-to-days (org-time-string-to-time ts1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5721 day2 (time-to-days (org-time-string-to-time ts2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5722 (while (< (setq day1 (1+ day1)) day2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5723 (or (memq day1 dates) (push day1 dates)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5724 (sort dates '<))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5725
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5726 ;;;###autoload
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5727 (defun org-diary (&rest args)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5728 "Return diary information from org-files.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5729 This function can be used in a \"sexp\" diary entry in the Emacs calendar.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5730 It accesses org files and extracts information from those files to be
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5731 listed in the diary. The function accepts arguments specifying what
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5732 items should be listed. The following arguments are allowed:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5733
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5734 :timestamp List the headlines of items containing a date stamp or
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5735 date range matching the selected date. Deadlines will
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5736 also be listed, on the expiration day.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5737
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5738 :deadline List any deadlines past due, or due within
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5739 `org-deadline-warning-days'. The listing occurs only
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5740 in the diary for *today*, not at any other date. If
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5741 an entry is marked DONE, it is no longer listed.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5742
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5743 :scheduled List all items which are scheduled for the given date.
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5744 The diary for *today* also contains items which were
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5745 scheduled earlier and are not yet marked DONE.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5746
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5747 :todo List all TODO items from the org-file. This may be a
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5748 long list - so this is not turned on by default.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5749 Like deadlines, these entries only show up in the
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5750 diary for *today*, not at any other date.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5751
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5752 The call in the diary file should look like this:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5753
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5754 &%%(org-diary) ~/path/to/some/orgfile.org
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5755
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5756 Use a separate line for each org file to check. Or, if you omit the file name,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5757 all files listed in `org-agenda-files' will be checked automatically:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5758
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5759 &%%(org-diary)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5760
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5761 If you don't give any arguments (as in the example above), the default
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5762 arguments (:deadline :scheduled :timestamp) are used. So the example above may
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5763 also be written as
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5764
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5765 &%%(org-diary :deadline :timestamp :scheduled)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5766
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5767 The function expects the lisp variables `entry' and `date' to be provided
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5768 by the caller, because this is how the calendar works. Don't use this
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
5769 function from a program - use `org-agenda-get-day-entries' instead."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5770 (org-agenda-maybe-reset-markers)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
5771 (org-compile-prefix-format org-agenda-prefix-format)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5772 (setq args (or args '(:deadline :scheduled :timestamp)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5773 (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5774 (list entry)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5775 (org-agenda-files t)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5776 file rtn results)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5777 ;; If this is called during org-agenda, don't return any entries to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5778 ;; the calendar. Org Agenda will list these entries itself.
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5779 (if org-disable-agenda-to-diary (setq files nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5780 (while (setq file (pop files))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5781 (setq rtn (apply 'org-agenda-get-day-entries file date args))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5782 (setq results (append results rtn)))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5783 (if results
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
5784 (concat (org-finalize-agenda-entries results) "\n"))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5785 (defvar org-category-table nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5786 (defun org-get-category-table ()
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5787 "Get the table of categories and positions in current buffer."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5788 (let (tbl)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5789 (save-excursion
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5790 (goto-char (point-min))
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
5791 (while (re-search-forward "\\(^\\|\r\\)#\\+CATEGORY:[ \t]*\\(.*\\)" nil t)
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
5792 (push (cons (point) (org-trim (match-string 2))) tbl)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5793 tbl))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5794 (defun org-get-category (&optional pos)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5795 "Get the category applying to position POS."
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5796 (if (not org-category-table)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5797 (cond
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5798 ((null org-category)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5799 (setq org-category
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5800 (if buffer-file-name
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5801 (file-name-sans-extension
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5802 (file-name-nondirectory buffer-file-name))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5803 "???")))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5804 ((symbolp org-category) (symbol-name org-category))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5805 (t org-category))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5806 (let ((tbl org-category-table)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5807 (pos (or pos (point))))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5808 (while (and tbl (> (caar tbl) pos))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5809 (pop tbl))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5810 (or (cdar tbl) (cdr (nth (1- (length org-category-table))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5811 org-category-table))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5812
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5813 (defun org-agenda-get-day-entries (file date &rest args)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5814 "Does the work for `org-diary' and `org-agenda'.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5815 FILE is the path to a file to be checked for entries. DATE is date like
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5816 the one returned by `calendar-current-date'. ARGS are symbols indicating
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5817 which kind of entries should be extracted. For details about these, see
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5818 the documentation of `org-diary'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5819 (setq args (or args '(:deadline :scheduled :timestamp)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5820 (let* ((org-startup-with-deadline-check nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5821 (org-startup-folded nil)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5822 (org-startup-align-all-tables nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5823 (buffer (if (file-exists-p file)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5824 (org-get-agenda-file-buffer file)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5825 (error "No such file %s" file)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5826 arg results rtn)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5827 (if (not buffer)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5828 ;; If file does not exist, make sure an error message ends up in diary
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5829 (list (format "ORG-AGENDA-ERROR: No such org-file %s" file))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
5830 (with-current-buffer buffer
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5831 (unless (eq major-mode 'org-mode)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5832 (error "Agenda file %s is not in `org-mode'" file))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5833 (setq org-category-table (org-get-category-table))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5834 (let ((case-fold-search nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5835 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5836 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5837 (if org-respect-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5838 (if (org-region-active-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5839 ;; Respect a region to restrict search
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5840 (narrow-to-region (region-beginning) (region-end)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5841 ;; If we work for the calendar or many files,
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5842 ;; get rid of any restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5843 (widen))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5844 ;; The way we repeatedly append to `results' makes it O(n^2) :-(
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5845 (while (setq arg (pop args))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5846 (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5847 ((and (eq arg :todo)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5848 (equal date (calendar-current-date)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5849 (setq rtn (org-agenda-get-todos))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5850 (setq results (append results rtn)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5851 ((eq arg :timestamp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5852 (setq rtn (org-agenda-get-blocks))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5853 (setq results (append results rtn))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5854 (setq rtn (org-agenda-get-timestamps))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5855 (setq results (append results rtn)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5856 ((eq arg :scheduled)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5857 (setq rtn (org-agenda-get-scheduled))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5858 (setq results (append results rtn)))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5859 ((eq arg :closed)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5860 (setq rtn (org-agenda-get-closed))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5861 (setq results (append results rtn)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5862 ((and (eq arg :deadline)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5863 (equal date (calendar-current-date)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5864 (setq rtn (org-agenda-get-deadlines))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5865 (setq results (append results rtn))))))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5866 results))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5867
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5868 (defun org-entry-is-done-p ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5869 "Is the current entry marked DONE?"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5870 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5871 (and (re-search-backward "[\r\n]\\*" nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5872 (looking-at org-nl-done-regexp))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5873
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5874 (defun org-at-date-range-p ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
5875 "Is the cursor inside a date range?"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5876 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5877 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5878 (catch 'exit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5879 (let ((pos (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5880 (skip-chars-backward "^<\r\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5881 (skip-chars-backward "<")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5882 (and (looking-at org-tr-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5883 (>= (match-end 0) pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5884 (throw 'exit t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5885 (skip-chars-backward "^<\r\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5886 (skip-chars-backward "<")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5887 (and (looking-at org-tr-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5888 (>= (match-end 0) pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5889 (throw 'exit t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5890 nil)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5891
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5892 (defun org-agenda-get-todos ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5893 "Return the TODO information for agenda display."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5894 (let* ((props (list 'face nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5895 'done-face 'org-done
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5896 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5897 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5898 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5899 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5900 (abbreviate-file-name buffer-file-name))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5901 (regexp (concat "[\n\r]\\*+ *\\("
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5902 (if org-select-this-todo-keyword
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5903 (concat "\\<\\(" org-select-this-todo-keyword
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5904 "\\)\\>")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5905 org-not-done-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5906 "[^\n\r]*\\)"))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
5907 marker priority category tags
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5908 ee txt)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5909 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5910 (while (re-search-forward regexp nil t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5911 (goto-char (match-beginning 1))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5912 (setq marker (org-agenda-new-marker (1+ (match-beginning 0)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5913 category (org-get-category)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
5914 tags (org-get-tags-at (point))
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
5915 txt (org-format-agenda-item "" (match-string 1) category tags)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5916 priority
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5917 (+ (org-get-priority txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5918 (if org-todo-kwd-priority-p
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5919 (- org-todo-kwd-max-priority -2
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5920 (length
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5921 (member (match-string 2) org-todo-keywords)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
5922 1)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5923 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5924 'org-marker marker 'org-hd-marker marker
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5925 'priority priority 'category category)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5926 (push txt ee)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5927 (goto-char (match-end 1)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5928 (nreverse ee)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5929
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5930 (defconst org-agenda-no-heading-message
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5931 "No heading for this item in buffer or region.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5932
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5933 (defun org-agenda-get-timestamps ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5934 "Return the date stamp information for agenda display."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5935 (let* ((props (list 'face nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5936 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5937 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5938 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5939 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
5940 (abbreviate-file-name buffer-file-name))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5941 (regexp (regexp-quote
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5942 (substring
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5943 (format-time-string
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5944 (car org-time-stamp-formats)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5945 (apply 'encode-time ; DATE bound by calendar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5946 (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5947 0 11)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5948 marker hdmarker deadlinep scheduledp donep tmp priority category
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
5949 ee txt timestr tags)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5950 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5951 (while (re-search-forward regexp nil t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5952 (if (not (save-match-data (org-at-date-range-p)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5953 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5954 (setq marker (org-agenda-new-marker (match-beginning 0))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
5955 category (org-get-category (match-beginning 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5956 tmp (buffer-substring (max (point-min)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5957 (- (match-beginning 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5958 org-ds-keyword-length))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5959 (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5960 timestr (buffer-substring (match-beginning 0) (point-at-eol))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5961 deadlinep (string-match org-deadline-regexp tmp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5962 scheduledp (string-match org-scheduled-regexp tmp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5963 donep (org-entry-is-done-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5964 (if (string-match ">" timestr)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5965 ;; substring should only run to end of time stamp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5966 (setq timestr (substring timestr 0 (match-end 0))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5967 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5968 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5969 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5970 (goto-char (match-end 1))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
5971 (setq hdmarker (org-agenda-new-marker)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
5972 tags (org-get-tags-at))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5973 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5974 (setq txt (org-format-agenda-item
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5975 (format "%s%s"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5976 (if deadlinep "Deadline: " "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5977 (if scheduledp "Scheduled: " ""))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
5978 (match-string 1) category tags timestr)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5979 (setq txt org-agenda-no-heading-message))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5980 (setq priority (org-get-priority txt))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5981 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5982 'org-marker marker 'org-hd-marker hdmarker)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5983 (if deadlinep
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5984 (org-add-props txt nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5985 'face (if donep 'org-done 'org-warning)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5986 'undone-face 'org-warning 'done-face 'org-done
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5987 'category category 'priority (+ 100 priority))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5988 (if scheduledp
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5989 (org-add-props txt nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5990 'face 'org-scheduled-today
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5991 'undone-face 'org-scheduled-today 'done-face 'org-done
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
5992 'category category 'priority (+ 99 priority))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
5993 (org-add-props txt nil 'priority priority 'category category)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5994 (push txt ee))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
5995 (outline-next-heading))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5996 (nreverse ee)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5997
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
5998 (defun org-agenda-get-closed ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
5999 "Return the logged TODO entries for agenda display."
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6000 (let* ((props (list 'mouse-face 'highlight
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6001 'keymap org-agenda-keymap
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6002 'help-echo
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6003 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
6004 (abbreviate-file-name buffer-file-name))))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6005 (regexp (concat
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6006 "\\<" org-closed-string " *\\["
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6007 (regexp-quote
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6008 (substring
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6009 (format-time-string
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6010 (car org-time-stamp-formats)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6011 (apply 'encode-time ; DATE bound by calendar
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6012 (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6013 1 11))))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6014 marker hdmarker priority category tags
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6015 ee txt timestr)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6016 (goto-char (point-min))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6017 (while (re-search-forward regexp nil t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6018 (if (not (save-match-data (org-at-date-range-p)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6019 (progn
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6020 (setq marker (org-agenda-new-marker (match-beginning 0))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6021 category (org-get-category (match-beginning 0))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6022 timestr (buffer-substring (match-beginning 0) (point-at-eol))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6023 ;; donep (org-entry-is-done-p)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6024 )
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6025 (if (string-match "\\]" timestr)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6026 ;; substring should only run to end of time stamp
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6027 (setq timestr (substring timestr 0 (match-end 0))))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6028 (save-excursion
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6029 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6030 (progn
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6031 (goto-char (match-end 1))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6032 (setq hdmarker (org-agenda-new-marker)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6033 tags (org-get-tags-at))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6034 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6035 (setq txt (org-format-agenda-item
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6036 "Closed: "
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6037 (match-string 1) category tags timestr)))
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6038 (setq txt org-agenda-no-heading-message))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6039 (setq priority 100000)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6040 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6041 'org-marker marker 'org-hd-marker hdmarker 'face 'org-done
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6042 'priority priority 'category category
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6043 'undone-face 'org-warning 'done-face 'org-done)
67534
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6044 (push txt ee))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6045 (outline-next-heading))))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6046 (nreverse ee)))
8f1580a14224 *** empty log message ***
Carsten Dominik <dominik@science.uva.nl>
parents: 67380
diff changeset
6047
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6048 (defun org-agenda-get-deadlines ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6049 "Return the deadline information for agenda display."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6050 (let* ((wdays org-deadline-warning-days)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6051 (props (list 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6052 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6053 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6054 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
6055 (abbreviate-file-name buffer-file-name))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6056 (regexp org-deadline-time-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6057 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6058 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6059 d2 diff pos pos1 category tags
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6060 ee txt head)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6061 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6062 (while (re-search-forward regexp nil t)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6063 (setq pos (1- (match-beginning 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6064 d2 (time-to-days
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6065 (org-time-string-to-time (match-string 1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6066 diff (- d2 d1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6067 ;; When to show a deadline in the calendar:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6068 ;; If the expiration is within wdays warning time.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6069 ;; Past-due deadlines are only shown on the current date
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6070 (if (and (< diff wdays) todayp (not (= diff 0)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6071 (save-excursion
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6072 (setq category (org-get-category))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6073 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6074 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6075 (goto-char (match-end 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6076 (setq pos1 (match-end 1))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6077 (setq tags (org-get-tags-at pos1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6078 (setq head (buffer-substring-no-properties
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6079 (point)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6080 (progn (skip-chars-forward "^\r\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6081 (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6082 (if (string-match org-looking-at-done-regexp head)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6083 (setq txt nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6084 (setq txt (org-format-agenda-item
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6085 (format "In %3d d.: " diff) head category tags))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6086 (setq txt org-agenda-no-heading-message))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6087 (when txt
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6088 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6089 'org-marker (org-agenda-new-marker pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6090 'org-hd-marker (org-agenda-new-marker pos1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6091 'priority (+ (- 10 diff) (org-get-priority txt))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6092 'category category
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6093 'face (cond ((<= diff 0) 'org-warning)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6094 ((<= diff 5) 'org-scheduled-previously)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6095 (t nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6096 'undone-face (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6097 ((<= diff 0) 'org-warning)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6098 ((<= diff 5) 'org-scheduled-previously)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6099 (t nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6100 'done-face 'org-done)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6101 (push txt ee)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6102 ee))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6103
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6104 (defun org-agenda-get-scheduled ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6105 "Return the scheduled information for agenda display."
63225
7660591a3c92 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Miles Bader <miles@gnu.org>
parents: 63110
diff changeset
6106 (let* ((props (list 'face 'org-scheduled-previously
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6107 'undone-face 'org-scheduled-previously
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6108 'done-face 'org-done
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6109 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6110 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6111 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6112 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
6113 (abbreviate-file-name buffer-file-name))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6114 (regexp org-scheduled-time-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6115 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6116 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6117 d2 diff pos pos1 category tags
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6118 ee txt head)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6119 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6120 (while (re-search-forward regexp nil t)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6121 (setq pos (1- (match-beginning 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6122 d2 (time-to-days
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6123 (org-time-string-to-time (match-string 1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6124 diff (- d2 d1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6125 ;; When to show a scheduled item in the calendar:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6126 ;; If it is on or past the date.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6127 (if (and (< diff 0) todayp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6128 (save-excursion
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6129 (setq category (org-get-category))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6130 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6131 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6132 (goto-char (match-end 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6133 (setq pos1 (match-end 1))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6134 (setq tags (org-get-tags-at))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6135 (setq head (buffer-substring-no-properties
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6136 (point)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6137 (progn (skip-chars-forward "^\r\n") (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6138 (if (string-match org-looking-at-done-regexp head)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6139 (setq txt nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6140 (setq txt (org-format-agenda-item
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6141 (format "Sched.%2dx: " (- 1 diff)) head
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6142 category tags))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6143 (setq txt org-agenda-no-heading-message))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6144 (when txt
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6145 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6146 'org-marker (org-agenda-new-marker pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6147 'org-hd-marker (org-agenda-new-marker pos1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6148 'priority (+ (- 5 diff) (org-get-priority txt))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6149 'category category)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6150 (push txt ee)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6151 ee))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6152
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6153 (defun org-agenda-get-blocks ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6154 "Return the date-range information for agenda display."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6155 (let* ((props (list 'face nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6156 'mouse-face 'highlight
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6157 'keymap org-agenda-keymap
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6158 'help-echo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6159 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
6160 (abbreviate-file-name buffer-file-name))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6161 (regexp org-tr-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6162 (d0 (calendar-absolute-from-gregorian date))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6163 marker hdmarker ee txt d1 d2 s1 s2 timestr category tags)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6164 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6165 (while (re-search-forward regexp nil t)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6166 (setq timestr (match-string 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6167 s1 (match-string 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6168 s2 (match-string 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6169 d1 (time-to-days (org-time-string-to-time s1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6170 d2 (time-to-days (org-time-string-to-time s2)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6171 (if (and (> (- d0 d1) -1) (> (- d2 d0) -1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6172 ;; Only allow days between the limits, because the normal
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6173 ;; date stamps will catch the limits.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6174 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6175 (setq marker (org-agenda-new-marker (point)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6176 (setq category (org-get-category))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6177 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6178 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6179 (setq hdmarker (org-agenda-new-marker (match-end 1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6180 (goto-char (match-end 1))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6181 (setq tags (org-get-tags-at))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6182 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6183 (setq txt (org-format-agenda-item
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6184 (format (if (= d1 d2) "" "(%d/%d): ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6185 (1+ (- d0 d1)) (1+ (- d2 d1)))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6186 (match-string 1) category tags
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6187 (if (= d0 d1) timestr))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6188 (setq txt org-agenda-no-heading-message))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6189 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6190 'org-marker marker 'org-hd-marker hdmarker
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6191 'priority (org-get-priority txt) 'category category)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6192 (push txt ee)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6193 (outline-next-heading))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6194 ;; Sort the entries by expiration date.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6195 (nreverse ee)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6196
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6197 (defconst org-plain-time-of-day-regexp
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6198 (concat
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6199 "\\(\\<[012]?[0-9]"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6200 "\\(\\(:\\([0-5][0-9]\\([AaPp][Mm]\\)?\\)\\)\\|\\([AaPp][Mm]\\)\\)\\>\\)"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6201 "\\(--?"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6202 "\\(\\<[012]?[0-9]"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6203 "\\(\\(:\\([0-5][0-9]\\([AaPp][Mm]\\)?\\)\\)\\|\\([AaPp][Mm]\\)\\)\\>\\)"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6204 "\\)?")
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6205 "Regular expression to match a plain time or time range.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6206 Examples: 11:45 or 8am-13:15 or 2:45-2:45pm. After a match, the following
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6207 groups carry important information:
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6208 0 the full match
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6209 1 the first time, range or not
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6210 8 the second time, if it is a range.")
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6211
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6212 (defconst org-stamp-time-of-day-regexp
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6213 (concat
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6214 "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +[a-zA-Z]+ +\\)"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6215 "\\([012][0-9]:[0-5][0-9]\\)>"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6216 "\\(--?"
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6217 "<\\1\\([012][0-9]:[0-5][0-9]\\)>\\)?")
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6218 "Regular expression to match a timestamp time or time range.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6219 After a match, the following groups carry important information:
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6220 0 the full match
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6221 1 date plus weekday, for backreferencing to make sure both times on same day
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6222 2 the first time, range or not
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6223 4 the second time, if it is a range.")
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6224
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6225 (defvar org-prefix-has-time nil
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6226 "A flag, set by `org-compile-prefix-format'.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6227 The flag is set if the currently compiled format contains a `%t'.")
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6228 (defvar org-prefix-has-tag nil
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6229 "A flag, set by `org-compile-prefix-format'.
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6230 The flag is set if the currently compiled format contains a `%T'.")
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6231
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6232 (defun org-format-agenda-item (extra txt &optional category tags dotime noprefix)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6233 "Format TXT to be inserted into the agenda buffer.
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6234 In particular, it adds the prefix and corresponding text properties. EXTRA
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6235 must be a string and replaces the `%s' specifier in the prefix format.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6236 CATEGORY (string, symbol or nil) may be used to overrule the default
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6237 category taken from local variable or file name. It will replace the `%c'
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6238 specifier in the format. DOTIME, when non-nil, indicates that a
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6239 time-of-day should be extracted from TXT for sorting of this entry, and for
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6240 the `%t' specifier in the format. When DOTIME is a string, this string is
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6241 searched for a time before TXT is. NOPREFIX is a flag and indicates that
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6242 only the correctly processes TXT should be returned - this is used by
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6243 `org-agenda-change-all-lines'. TAG can be the tag of the headline."
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6244 (save-match-data
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6245 ;; Diary entries sometimes have extra whitespace at the beginning
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6246 (if (string-match "^ +" txt) (setq txt (replace-match "" nil nil txt)))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6247 (let* ((category (or category
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6248 org-category
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
6249 (if buffer-file-name
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6250 (file-name-sans-extension
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
6251 (file-name-nondirectory buffer-file-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6252 "")))
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
6253 (tag (if tags (nth (1- (length tags)) tags) ""))
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
6254 ;;(tag (or (nth (1- (or (length tags) 0)) tags) "")) FIXME: rm
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6255 time ;; needed for the eval of the prefix format
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6256 (ts (if dotime (concat (if (stringp dotime) dotime "") txt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6257 (time-of-day (and dotime (org-get-time-of-day ts)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6258 stamp plain s0 s1 s2 rtn)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6259 (when (and dotime time-of-day org-prefix-has-time)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6260 ;; Extract starting and ending time and move them to prefix
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6261 (when (or (setq stamp (string-match org-stamp-time-of-day-regexp ts))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6262 (setq plain (string-match org-plain-time-of-day-regexp ts)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6263 (setq s0 (match-string 0 ts)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6264 s1 (match-string (if plain 1 2) ts)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6265 s2 (match-string (if plain 8 4) ts))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6266
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6267 ;; If the times are in TXT (not in DOTIMES), and the prefix will list
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6268 ;; them, we might want to remove them there to avoid duplication.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6269 ;; The user can turn this off with a variable.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6270 (if (and org-agenda-remove-times-when-in-prefix (or stamp plain)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6271 (string-match (concat (regexp-quote s0) " *") txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6272 (if (eq org-agenda-remove-times-when-in-prefix 'beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6273 (= (match-beginning 0) 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6274 t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6275 (setq txt (replace-match "" nil nil txt))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6276 ;; Normalize the time(s) to 24 hour
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6277 (if s1 (setq s1 (org-get-time-of-day s1 'string)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6278 (if s2 (setq s2 (org-get-time-of-day s2 'string))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6279
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6280 (when (and (or (eq org-agenda-remove-tags-when-in-prefix t)
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6281 (and org-agenda-remove-tags-when-in-prefix
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6282 org-prefix-has-tag))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6283 (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" txt))
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6284 (setq txt (replace-match "" t t txt)))
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6285
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6286 ;; Create the final string
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6287 (if noprefix
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6288 (setq rtn txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6289 ;; Prepare the variables needed in the eval of the compiled format
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6290 (setq time (cond (s2 (concat s1 "-" s2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6291 (s1 (concat s1 "......"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6292 (t ""))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6293 extra (or extra "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6294 category (if (symbolp category) (symbol-name category) category))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6295 ;; Evaluate the compiled format
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6296 (setq rtn (concat (eval org-prefix-format-compiled) txt)))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6297
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6298 ;; And finally add the text properties
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6299 (org-add-props rtn nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6300 'category (downcase category) 'tags tags
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6301 'prefix-length (- (length rtn) (length txt))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6302 'time-of-day time-of-day
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6303 'dotime dotime))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6304
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6305 (defun org-agenda-add-time-grid-maybe (list ndays todayp)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6306 (catch 'exit
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6307 (cond ((not org-agenda-use-time-grid) (throw 'exit list))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6308 ((and todayp (member 'today (car org-agenda-time-grid))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6309 ((and (= ndays 1) (member 'daily (car org-agenda-time-grid))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6310 ((member 'weekly (car org-agenda-time-grid)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6311 (t (throw 'exit list)))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6312 (let* ((have (delq nil (mapcar
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6313 (lambda (x) (get-text-property 1 'time-of-day x))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6314 list)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6315 (string (nth 1 org-agenda-time-grid))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6316 (gridtimes (nth 2 org-agenda-time-grid))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6317 (req (car org-agenda-time-grid))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6318 (remove (member 'remove-match req))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6319 new time)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6320 (if (and (member 'require-timed req) (not have))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6321 ;; don't show empty grid
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6322 (throw 'exit list))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6323 (while (setq time (pop gridtimes))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6324 (unless (and remove (member time have))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6325 (setq time (int-to-string time))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6326 (push (org-format-agenda-item
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6327 nil string "" nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6328 (concat (substring time 0 -2) ":" (substring time -2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6329 new)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6330 (put-text-property
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6331 1 (length (car new)) 'face 'org-time-grid (car new))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6332 (if (member 'time-up org-agenda-sorting-strategy)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6333 (append new list)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6334 (append list new)))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6335
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6336 (defun org-compile-prefix-format (format)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6337 "Compile the prefix format into a Lisp form that can be evaluated.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6338 The resulting form is returned and stored in the variable
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6339 `org-prefix-format-compiled'."
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6340 (setq org-prefix-has-time nil org-prefix-has-tag nil)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6341 (let ((start 0) varform vars var (s format)e c f opt)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6342 (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cts]\\)"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6343 s start)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6344 (setq var (cdr (assoc (match-string 4 s)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6345 '(("c" . category) ("t" . time) ("s" . extra)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6346 ("T" . tag))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6347 c (or (match-string 3 s) "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6348 opt (match-beginning 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6349 start (1+ (match-beginning 0)))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6350 (if (equal var 'time) (setq org-prefix-has-time t))
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6351 (if (equal var 'tag) (setq org-prefix-has-tag t))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6352 (setq f (concat "%" (match-string 2 s) "s"))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6353 (if opt
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6354 (setq varform
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6355 `(if (equal "" ,var)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6356 ""
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6357 (format ,f (if (equal "" ,var) "" (concat ,var ,c)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6358 (setq varform `(format ,f (if (equal ,var "") "" (concat ,var ,c)))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6359 (setq s (replace-match "%s" t nil s))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6360 (push varform vars))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6361 (setq vars (nreverse vars))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6362 (setq org-prefix-format-compiled `(format ,s ,@vars))))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6363
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6364 (defun org-get-time-of-day (s &optional string)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6365 "Check string S for a time of day.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6366 If found, return it as a military time number between 0 and 2400.
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6367 If not found, return nil.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6368 The optional STRING argument forces conversion into a 5 character wide string
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6369 HH:MM."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6370 (save-match-data
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6371 (when
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6372 (or
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6373 (string-match
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6374 "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s)
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6375 (string-match
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6376 "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6377 (let* ((t0 (+ (* 100
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6378 (+ (string-to-number (match-string 1 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6379 (if (and (match-beginning 4)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6380 (equal (downcase (match-string 4 s)) "pm"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6381 12 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6382 (if (match-beginning 3)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6383 (string-to-number (match-string 3 s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6384 0)))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6385 (t1 (concat " "
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
6386 (if (< t0 100) "0" "") (if (< t0 10) "0" "")
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6387 (int-to-string t0))))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6388 (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6389
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6390 (defun org-finalize-agenda-entries (list)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6391 "Sort and concatenate the agenda items."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6392 (mapconcat 'identity (sort list 'org-entries-lessp) "\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6393
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6394 (defsubst org-cmp-priority (a b)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6395 "Compare the priorities of string A and B."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6396 (let ((pa (or (get-text-property 1 'priority a) 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6397 (pb (or (get-text-property 1 'priority b) 0)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6398 (cond ((> pa pb) +1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6399 ((< pa pb) -1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6400 (t nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6401
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6402 (defsubst org-cmp-category (a b)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6403 "Compare the string values of categories of strings A and B."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6404 (let ((ca (or (get-text-property 1 'category a) ""))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6405 (cb (or (get-text-property 1 'category b) "")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6406 (cond ((string-lessp ca cb) -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6407 ((string-lessp cb ca) +1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6408 (t nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6409
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6410 (defsubst org-cmp-time (a b)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6411 "Compare the time-of-day values of strings A and B."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6412 (let* ((def (if org-sort-agenda-notime-is-late 2401 -1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6413 (ta (or (get-text-property 1 'time-of-day a) def))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6414 (tb (or (get-text-property 1 'time-of-day b) def)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6415 (cond ((< ta tb) -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6416 ((< tb ta) +1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6417 (t nil))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6418
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6419 (defun org-entries-lessp (a b)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6420 "Predicate for sorting agenda entries."
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
6421 ;; The following variables will be used when the form is evaluated.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6422 (let* ((time-up (org-cmp-time a b))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6423 (time-down (if time-up (- time-up) nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6424 (priority-up (org-cmp-priority a b))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6425 (priority-down (if priority-up (- priority-up) nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6426 (category-up (org-cmp-category a b))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6427 (category-down (if category-up (- category-up) nil))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6428 (category-keep (if category-up +1 nil)))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6429 (cdr (assoc
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6430 (eval (cons 'or org-agenda-sorting-strategy))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6431 '((-1 . t) (1 . nil) (nil . nil))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6432
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6433 (defun org-agenda-show-priority ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6434 "Show the priority of the current item.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6435 This priority is composed of the main priority given with the [#A] cookies,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6436 and by additional input from the age of a schedules or deadline entry."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6437 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6438 (let* ((pri (get-text-property (point-at-bol) 'priority)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6439 (message "Priority is %d" (if pri pri -1000))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6440
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6441 (defun org-agenda-show-tags ()
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6442 "Show the tags applicable to the current item."
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6443 (interactive)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6444 (let* ((tags (get-text-property (point-at-bol) 'tags)))
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6445 (if tags
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6446 (message "Tags are :%s:" (mapconcat 'identity tags ":"))
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6447 (message "No tags associated with this line"))))
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6448
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6449 (defun org-agenda-goto (&optional highlight)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6450 "Go to the Org-mode file which contains the item at point."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6451 (interactive)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6452 (let* ((marker (or (get-text-property (point) 'org-marker)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6453 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6454 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6455 (pos (marker-position marker)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6456 (switch-to-buffer-other-window buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6457 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6458 (goto-char pos)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6459 (when (eq major-mode 'org-mode)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6460 (org-show-hidden-entry)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6461 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6462 (and (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6463 (org-flag-heading nil)))) ; show the next heading
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6464 (and highlight (org-highlight (point-at-bol) (point-at-eol)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6465
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6466 (defun org-agenda-switch-to ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6467 "Go to the Org-mode file which contains the item at point."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6468 (interactive)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6469 (let* ((marker (or (get-text-property (point) 'org-marker)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6470 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6471 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6472 (pos (marker-position marker)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6473 (switch-to-buffer buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6474 (delete-other-windows)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6475 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6476 (goto-char pos)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6477 (when (eq major-mode 'org-mode)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6478 (org-show-hidden-entry)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6479 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6480 (and (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6481 (org-flag-heading nil)))))) ; show the next heading
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6482
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6483 (defun org-agenda-goto-mouse (ev)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6484 "Go to the Org-mode file which contains the item at the mouse click."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6485 (interactive "e")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6486 (mouse-set-point ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6487 (org-agenda-goto))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6488
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6489 (defun org-agenda-show ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6490 "Display the Org-mode file which contains the item at point."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6491 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6492 (let ((win (selected-window)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6493 (org-agenda-goto t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6494 (select-window win)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6495
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6496 (defun org-agenda-recenter (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6497 "Display the Org-mode file which contains the item at point and recenter."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6498 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6499 (let ((win (selected-window)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6500 (org-agenda-goto t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6501 (recenter arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6502 (select-window win)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6503
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6504 (defun org-agenda-show-mouse (ev)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6505 "Display the Org-mode file which contains the item at the mouse click."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6506 (interactive "e")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6507 (mouse-set-point ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6508 (org-agenda-show))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6509
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6510 (defun org-agenda-check-no-diary ()
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6511 "Check if the entry is a diary link and abort if yes."
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6512 (if (get-text-property (point) 'org-agenda-diary-link)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6513 (org-agenda-error)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6514
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6515 (defun org-agenda-error ()
63431
fd4b70bc23a4 (org-promote, org-evaluate-time-range, org-agenda-next-date-line,
Juanma Barranquero <lekktu@gmail.com>
parents: 63367
diff changeset
6516 (error "Command not allowed in this line"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6517
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6518 (defvar org-last-heading-marker (make-marker)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6519 "Marker pointing to the headline that last changed its TODO state
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6520 by a remote command from the agenda.")
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6521
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6522 (defun org-agenda-todo (&optional arg)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6523 "Cycle TODO state of line at point, also in Org-mode file.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6524 This changes the line at point, all other lines in the agenda referring to
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6525 the same tree node, and the headline of the tree node in the Org-mode file."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6526 (interactive "P")
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6527 (org-agenda-check-no-diary)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6528 (let* ((col (current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6529 (marker (or (get-text-property (point) 'org-marker)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6530 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6531 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6532 (pos (marker-position marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6533 (hdmarker (get-text-property (point) 'org-hd-marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6534 (buffer-read-only nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6535 newhead)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6536 (with-current-buffer buffer
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6537 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6538 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6539 (org-show-hidden-entry)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6540 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6541 (and (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6542 (org-flag-heading nil))) ; show the next heading
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6543 (org-todo arg)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6544 (forward-char 1)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6545 (setq newhead (org-get-heading))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6546 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6547 (org-back-to-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6548 (move-marker org-last-heading-marker (point))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6549 (beginning-of-line 1)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6550 (save-excursion
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6551 (org-agenda-change-all-lines newhead hdmarker 'fixface))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6552 (move-to-column col)))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6553
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6554 (defun org-agenda-change-all-lines (newhead hdmarker &optional fixface)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6555 "Change all lines in the agenda buffer which match HDMARKER.
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6556 The new content of the line will be NEWHEAD (as modified by
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6557 `org-format-agenda-item'). HDMARKER is checked with
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6558 `equal' against all `org-hd-marker' text properties in the file.
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6559 If FIXFACE is non-nil, the face of each item is modified acording to
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6560 the new TODO state."
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6561 (let* (props m pl undone-face done-face finish new dotime cat tags)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6562 ; (setq newhead (org-format-agenda-item "x" newhead "x" nil 'noprefix))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6563 (save-excursion
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6564 (goto-char (point-max))
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6565 (beginning-of-line 1)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6566 (while (not finish)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6567 (setq finish (bobp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6568 (when (and (setq m (get-text-property (point) 'org-hd-marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6569 (equal m hdmarker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6570 (setq props (text-properties-at (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6571 dotime (get-text-property (point) 'dotime)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
6572 cat (get-text-property (point) 'category)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6573 tags (get-text-property (point) 'tags)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6574 new (org-format-agenda-item "x" newhead cat tags dotime 'noprefix)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6575 pl (get-text-property (point) 'prefix-length)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6576 undone-face (get-text-property (point) 'undone-face)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6577 done-face (get-text-property (point) 'done-face))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6578 (move-to-column pl)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6579 (if (looking-at ".*")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6580 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6581 (replace-match new t t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6582 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6583 (add-text-properties (point-at-bol) (point-at-eol) props)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6584 (if fixface
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6585 (add-text-properties
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6586 (point-at-bol) (point-at-eol)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6587 (list 'face
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6588 (if org-last-todo-state-is-todo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6589 undone-face done-face))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6590 (beginning-of-line 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6591 (error "Line update did not work")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6592 (beginning-of-line 0)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6593
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6594 (defun org-agenda-priority-up ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6595 "Increase the priority of line at point, also in Org-mode file."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6596 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6597 (org-agenda-priority 'up))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6598
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6599 (defun org-agenda-priority-down ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6600 "Decrease the priority of line at point, also in Org-mode file."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6601 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6602 (org-agenda-priority 'down))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6603
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6604 (defun org-agenda-priority (&optional force-direction)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6605 "Set the priority of line at point, also in Org-mode file.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6606 This changes the line at point, all other lines in the agenda referring to
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6607 the same tree node, and the headline of the tree node in the Org-mode file."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6608 (interactive)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6609 (org-agenda-check-no-diary)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6610 (let* ((marker (or (get-text-property (point) 'org-marker)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6611 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6612 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6613 (pos (marker-position marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6614 (hdmarker (get-text-property (point) 'org-hd-marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6615 (buffer-read-only nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6616 newhead)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6617 (with-current-buffer buffer
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6618 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6619 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6620 (org-show-hidden-entry)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6621 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6622 (and (outline-next-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6623 (org-flag-heading nil))) ; show the next heading
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6624 (funcall 'org-priority force-direction)
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
6625 (end-of-line 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6626 (setq newhead (org-get-heading)))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6627 (org-agenda-change-all-lines newhead hdmarker)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6628 (beginning-of-line 1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6629
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6630 (defun org-get-tags-at (&optional pos)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6631 "Get a list of all headline targs applicable at POS.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6632 POS defaults to point. If tags are inherited, the list contains
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6633 the targets in the same sequence as the headlines appear, i.e.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6634 the tags of the current headline come last."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6635 (interactive)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6636 (let (tags)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6637 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6638 (goto-char (or pos (point)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6639 (save-match-data
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6640 (org-back-to-heading t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6641 (condition-case nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6642 (while t
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6643 (if (looking-at "[^\r\n]+?:\\([a-zA-Z_@0-9:]+\\):[ \t]*\\([\n\r]\\|\\'\\)")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6644 (setq tags (append (org-split-string (match-string 1) ":") tags)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6645 (or org-use-tag-inheritance (error ""))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6646 (org-up-heading-all 1))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6647 (error nil))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6648 (message "%s" tags)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6649 tags))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6650
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6651 (defun org-agenda-set-tags ()
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6652 "Set tags for the current headline."
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6653 (interactive)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6654 (org-agenda-check-no-diary)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6655 (org-agenda-show) ;;; FIXME This is a stupid hack and should not be needed
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6656 (let* ((hdmarker (or (get-text-property (point) 'org-hd-marker)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6657 (org-agenda-error)))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6658 (buffer (marker-buffer hdmarker))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6659 (pos (marker-position hdmarker))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6660 (buffer-read-only nil)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6661 newhead)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6662 (with-current-buffer buffer
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6663 (widen)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6664 (goto-char pos)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6665 (org-show-hidden-entry)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6666 (save-excursion
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6667 (and (outline-next-heading)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6668 (org-flag-heading nil))) ; show the next heading
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6669 (call-interactively 'org-set-tags)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6670 (end-of-line 1)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6671 (setq newhead (org-get-heading)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6672 (org-agenda-change-all-lines newhead hdmarker)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6673 (beginning-of-line 1)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6674
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6675 (defun org-agenda-date-later (arg &optional what)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6676 "Change the date of this item to one day later."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6677 (interactive "p")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6678 (org-agenda-check-type t 'agenda 'timeline)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6679 (org-agenda-check-no-diary)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6680 (let* ((marker (or (get-text-property (point) 'org-marker)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6681 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6682 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6683 (pos (marker-position marker)))
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
6684 (with-current-buffer buffer
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6685 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6686 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6687 (if (not (org-at-timestamp-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6688 (error "Cannot find time stamp"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6689 (org-timestamp-change arg (or what 'day))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6690 (message "Time stamp changed to %s" org-last-changed-timestamp))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6691
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6692 (defun org-agenda-date-earlier (arg &optional what)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6693 "Change the date of this item to one day earlier."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6694 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6695 (org-agenda-date-later (- arg) what))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6696
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6697 (defun org-agenda-date-prompt (arg)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6698 "Change the date of this item. Date is prompted for, with default today.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6699 The prefix ARG is passed to the `org-time-stamp' command and can therefore
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6700 be used to request time specification in the time stamp."
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6701 (interactive "P")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6702 (org-agenda-check-type t 'agenda 'timeline)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6703 (org-agenda-check-no-diary)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6704 (let* ((marker (or (get-text-property (point) 'org-marker)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6705 (org-agenda-error)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6706 (buffer (marker-buffer marker))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6707 (pos (marker-position marker)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6708 (with-current-buffer buffer
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6709 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6710 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6711 (if (not (org-at-timestamp-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6712 (error "Cannot find time stamp"))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6713 (org-time-stamp arg)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6714 (message "Time stamp changed to %s" org-last-changed-timestamp))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6715
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6716 (defun org-get-heading ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6717 "Return the heading of the current entry, without the stars."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6718 (save-excursion
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6719 (and (memq (char-before) '(?\n ?\r)) (skip-chars-forward "^\n\r"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6720 (if (and (re-search-backward "[\r\n]\\*" nil t)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6721 (looking-at "[\r\n]\\*+[ \t]+\\([^\r\n]*\\)"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6722 (match-string 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6723 "")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6724
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6725 (defun org-agenda-diary-entry ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6726 "Make a diary entry, like the `i' command from the calendar.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6727 All the standard commands work: block, weekly etc."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
6728 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6729 (org-agenda-check-type t 'agenda 'timeline)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6730 (require 'diary-lib)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6731 (let* ((char (progn
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6732 (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6733 (read-char-exclusive)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6734 (cmd (cdr (assoc char
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6735 '((?d . insert-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6736 (?w . insert-weekly-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6737 (?m . insert-monthly-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6738 (?y . insert-yearly-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6739 (?a . insert-anniversary-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6740 (?b . insert-block-diary-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6741 (?c . insert-cyclic-diary-entry)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6742 (oldf (symbol-function 'calendar-cursor-to-date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6743 (point (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6744 (mark (or (mark t) (point))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6745 (unless cmd
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6746 (error "No command associated with <%c>" char))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6747 (unless (and (get-text-property point 'day)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6748 (or (not (equal ?b char))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6749 (get-text-property mark 'day)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6750 (error "Don't know which date to use for diary entry"))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6751 ;; We implement this by hacking the `calendar-cursor-to-date' function
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6752 ;; and the `calendar-mark-ring' variable. Saves a lot of code.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6753 (let ((calendar-mark-ring
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6754 (list (calendar-gregorian-from-absolute
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6755 (or (get-text-property mark 'day)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6756 (get-text-property point 'day))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6757 (unwind-protect
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6758 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6759 (fset 'calendar-cursor-to-date
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6760 (lambda (&optional error)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6761 (calendar-gregorian-from-absolute
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6762 (get-text-property point 'day))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6763 (call-interactively cmd))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6764 (fset 'calendar-cursor-to-date oldf)))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6765
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6766
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6767 (defun org-agenda-execute-calendar-command (cmd)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6768 "Execute a calendar command from the agenda, with the date associated to
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6769 the cursor position."
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6770 (org-agenda-check-type t 'agenda 'timeline)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6771 (require 'diary-lib)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6772 (unless (get-text-property (point) 'day)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6773 (error "Don't know which date to use for calendar command"))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6774 (let* ((oldf (symbol-function 'calendar-cursor-to-date))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6775 (point (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6776 (date (calendar-gregorian-from-absolute
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6777 (get-text-property point 'day)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6778 (displayed-day (extract-calendar-day date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6779 (displayed-month (extract-calendar-month date))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6780 (displayed-year (extract-calendar-year date)))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6781 (unwind-protect
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6782 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6783 (fset 'calendar-cursor-to-date
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6784 (lambda (&optional error)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6785 (calendar-gregorian-from-absolute
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6786 (get-text-property point 'day))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6787 (call-interactively cmd))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6788 (fset 'calendar-cursor-to-date oldf))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6789
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6790 (defun org-agenda-phases-of-moon ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6791 "Display the phases of the moon for the 3 months around the cursor date."
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6792 (interactive)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6793 (org-agenda-execute-calendar-command 'calendar-phases-of-moon))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6794
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6795 (defun org-agenda-holidays ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6796 "Display the holidays for the 3 months around the cursor date."
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6797 (interactive)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6798 (org-agenda-execute-calendar-command 'list-calendar-holidays))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6799
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6800 (defun org-agenda-sunrise-sunset (arg)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6801 "Display sunrise and sunset for the cursor date.
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6802 Latitude and longitude can be specified with the variables
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6803 `calendar-latitude' and `calendar-longitude'. When called with prefix
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6804 argument, latitude and longitude will be prompted for."
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6805 (interactive "P")
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6806 (let ((calendar-longitude (if arg nil calendar-longitude))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6807 (calendar-latitude (if arg nil calendar-latitude))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6808 (calendar-location-name
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6809 (if arg "the given coordinates" calendar-location-name)))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6810 (org-agenda-execute-calendar-command 'calendar-sunrise-sunset)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6811
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6812 (defun org-agenda-goto-calendar ()
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6813 "Open the Emacs calendar with the date at the cursor."
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6814 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6815 (org-agenda-check-type t 'agenda 'timeline)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6816 (let* ((day (or (get-text-property (point) 'day)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6817 (error "Don't know which date to open in calendar")))
66689
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
6818 (date (calendar-gregorian-from-absolute day))
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
6819 (calendar-move-hook nil)
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
6820 (view-diary-entries-initially nil))
a9a692f50d60 (org-read-date, org-goto-calendar)
Carsten Dominik <dominik@science.uva.nl>
parents: 66409
diff changeset
6821 (calendar)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6822 (calendar-goto-date date)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6823
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6824 (defun org-calendar-goto-agenda ()
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6825 "Compute the Org-mode agenda for the calendar date displayed at the cursor.
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6826 This is a command that has to be installed in `calendar-mode-map'."
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6827 (interactive)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6828 (org-agenda-list nil (calendar-absolute-from-gregorian
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6829 (calendar-cursor-to-date))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6830 nil t))
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
6831
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6832 (defun org-agenda-convert-date ()
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6833 (interactive)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6834 (org-agenda-check-type t 'agenda 'timeline)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6835 (let ((day (get-text-property (point) 'day))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6836 date s)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6837 (unless day
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6838 (error "Don't know which date to convert"))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6839 (setq date (calendar-gregorian-from-absolute day))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
6840 (setq s (concat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6841 "Gregorian: " (calendar-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6842 "ISO: " (calendar-iso-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6843 "Day of Yr: " (calendar-day-of-year-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6844 "Julian: " (calendar-julian-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6845 "Astron. JD: " (calendar-astro-date-string date)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6846 " (Julian date number at noon UTC)\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6847 "Hebrew: " (calendar-hebrew-date-string date) " (until sunset)\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6848 "Islamic: " (calendar-islamic-date-string date) " (until sunset)\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6849 "French: " (calendar-french-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6850 "Mayan: " (calendar-mayan-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6851 "Coptic: " (calendar-coptic-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6852 "Ethiopic: " (calendar-ethiopic-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6853 "Persian: " (calendar-persian-date-string date) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
6854 "Chinese: " (calendar-chinese-date-string date) "\n"))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6855 (with-output-to-temp-buffer "*Dates*"
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6856 (princ s))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6857 (if (fboundp 'fit-window-to-buffer)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6858 (fit-window-to-buffer (get-buffer-window "*Dates*")))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
6859
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6860 ;;; Tags
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6861
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6862 (defun org-scan-tags (action matcher &optional todo-only)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6863 "Scan headline tags with inheritance and produce output ACTION.
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6864 ACTION can be `sparse-tree' or `agenda'. MATCHER is a Lisp form to be
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6865 evaluated, testing if a given set of tags qualifies a headline for
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6866 inclusion. When TODO-ONLY is non-nil, only lines with a TODO keyword
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6867 are included in the output."
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6868 (let* ((re (concat "[\n\r]" outline-regexp " *\\(\\<\\("
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6869 (mapconcat 'regexp-quote
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6870 (nreverse (cdr (reverse org-todo-keywords)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6871 "\\|")
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6872 "\\>\\)\\)? *\\(.*?\\)\\(:[A-Za-z_@0-9:]+:\\)?[ \t]*[\n\r]"))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6873 (props (list 'face nil
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6874 'done-face 'org-done
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6875 'undone-face nil
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6876 'mouse-face 'highlight
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6877 'keymap org-agenda-keymap
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6878 'help-echo
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6879 (format "mouse-2 or RET jump to org file %s"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
6880 (abbreviate-file-name buffer-file-name))))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6881 lspos
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6882 tags tags-list tags-alist (llast 0) rtn level category i txt
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6883 todo marker)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6884
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6885 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6886 (goto-char (point-min))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6887 (when (eq action 'sparse-tree) (hide-sublevels 1))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6888 (while (re-search-forward re nil t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6889 (setq todo (if (match-end 1) (match-string 2))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6890 tags (if (match-end 4) (match-string 4)))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6891 (goto-char (setq lspos (1+ (match-beginning 0))))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
6892 (setq level (funcall outline-level)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6893 category (org-get-category))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6894 (setq i llast llast level)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6895 ;; remove tag lists from same and sublevels
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6896 (while (>= i level)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6897 (when (setq entry (assoc i tags-alist))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6898 (setq tags-alist (delete entry tags-alist)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6899 (setq i (1- i)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6900 ;; add the nex tags
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6901 (when tags
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6902 (setq tags (mapcar 'downcase (org-split-string tags ":"))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6903 tags-alist
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6904 (cons (cons level tags) tags-alist)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6905 ;; compile tags for current headline
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6906 (setq tags-list
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6907 (if org-use-tag-inheritance
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6908 (apply 'append (mapcar 'cdr tags-alist))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6909 tags))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6910 (when (and (or (not todo-only) todo)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6911 (eval matcher))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6912 ;; list this headline
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6913 (if (eq action 'sparse-tree)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6914 (progn
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6915 (org-show-hierarchy-above))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6916 (setq txt (org-format-agenda-item
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6917 ""
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6918 (concat
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6919 (if org-tags-match-list-sublevels
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6920 (make-string (1- level) ?.) "")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6921 (org-get-heading))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
6922 category tags-list))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6923 (goto-char lspos)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6924 (setq marker (org-agenda-new-marker))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6925 (org-add-props txt props
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
6926 'org-marker marker 'org-hd-marker marker 'category category)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6927 (push txt rtn))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6928 ;; if we are to skip sublevels, jump to end of subtree
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6929 (point)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6930 (or org-tags-match-list-sublevels (org-end-of-subtree)))))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6931 (nreverse rtn)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6932
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6933 (defun org-tags-sparse-tree (&optional arg match)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6934 "Create a sparse tree according to tags search string MATCH.
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6935 MATCH can contain positive and negative selection of tags, like
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6936 \"+WORK+URGENT-WITHBOSS\"."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6937 (interactive "P")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6938 (let ((org-show-following-heading nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6939 (org-show-hierarchy-above nil))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6940 (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match)))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6941
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6942 (defun org-make-tags-matcher (match)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6943 "Create the TAGS matcher form for the tags-selecting string MATCH."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6944 (unless match
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6945 ;; Get a new match request, with completion
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6946 (setq org-last-tags-completion-table
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6947 (or (org-get-buffer-tags)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6948 org-last-tags-completion-table))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6949 (setq match (completing-read
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6950 "Tags: " 'org-tags-completion-function nil nil nil
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6951 'org-tags-history)))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6952 ;; parse the string and create a lisp form
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6953 (let ((match0 match) minus tag mm matcher orterms term orlist)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6954 (setq orterms (org-split-string match "|"))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6955 (while (setq term (pop orterms))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
6956 (while (string-match "^&?\\([-+:]\\)?\\([A-Za-z_@0-9]+\\)" term)
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6957 (setq minus (and (match-end 1)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6958 (equal (match-string 1 term) "-"))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6959 tag (match-string 2 term)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6960 term (substring term (match-end 0))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6961 mm (list 'member (downcase tag) 'tags-list)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6962 mm (if minus (list 'not mm) mm))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6963 (push mm matcher))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6964 (push (if (> (length matcher) 1) (cons 'and matcher) (car matcher))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6965 orlist)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6966 (setq matcher nil))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6967 (setq matcher (if (> (length orlist) 1) (cons 'or orlist) (car orlist)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6968 ;; Return the string and lisp forms of the matcher
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6969 (cons match0 matcher)))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
6970
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6971 ;;;###autoload
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6972 (defun org-tags-view (&optional todo-only match keep-modes)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6973 "Show all headlines for all `org-agenda-files' matching a TAGS criterion.
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6974 The prefix arg TODO-ONLY limits the search to TODO entries."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6975 (interactive "P")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6976 (org-agenda-maybe-reset-markers 'force)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6977 (org-compile-prefix-format org-agenda-prefix-format)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6978 (let* ((org-agenda-keep-modes keep-modes)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6979 (org-tags-match-list-sublevels
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6980 (if todo-only t org-tags-match-list-sublevels))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6981 (win (selected-window))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6982 (completion-ignore-case t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6983 rtn rtnall files file pos matcher
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6984 buffer)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6985 (setq matcher (org-make-tags-matcher match)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6986 match (car matcher) matcher (cdr matcher))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6987 (if (not (equal (current-buffer) (get-buffer org-agenda-buffer-name)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6988 (progn
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6989 (delete-other-windows)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6990 (switch-to-buffer-other-window
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6991 (get-buffer-create org-agenda-buffer-name))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6992 (setq buffer-read-only nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6993 (erase-buffer)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6994 (org-agenda-mode) (setq buffer-read-only nil)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6995 (set (make-local-variable 'org-agenda-type) 'tags)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6996 (set (make-local-variable 'org-agenda-redo-command)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
6997 (list 'org-tags-view (list 'quote todo-only)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
6998 (list 'if 'current-prefix-arg nil match) t))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
6999 (setq files (org-agenda-files)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7000 rtnall nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7001 (while (setq file (pop files))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7002 (catch 'nextfile
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7003 (org-check-agenda-file file)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7004 (setq buffer (if (file-exists-p file)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7005 (org-get-agenda-file-buffer file)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7006 (error "No such file %s" file)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7007 (if (not buffer)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7008 ;; If file does not exist, merror message to agenda
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7009 (setq rtn (list
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7010 (format "ORG-AGENDA-ERROR: No such org-file %s" file))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7011 rtnall (append rtnall rtn))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7012 (with-current-buffer buffer
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7013 (unless (eq major-mode 'org-mode)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7014 (error "Agenda file %s is not in `org-mode'" file))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7015 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7016 (save-restriction
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7017 (if org-respect-restriction
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7018 (if (org-region-active-p)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7019 ;; Respect a region to restrict search
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7020 (narrow-to-region (region-beginning) (region-end)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7021 ;; If we work for the calendar or many files,
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7022 ;; get rid of any restriction
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7023 (widen))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7024 (setq rtn (org-scan-tags 'agenda matcher todo-only))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7025 (setq rtnall (append rtnall rtn))))))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7026 (insert "Headlines with TAGS match: ")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7027 (add-text-properties (point-min) (1- (point))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7028 (list 'face 'org-level-3))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7029 (setq pos (point))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7030 (insert match "\n")
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7031 (add-text-properties pos (1- (point)) (list 'face 'org-warning))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7032 (setq pos (point))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7033 (insert "Press `C-u r' to search again with new search string\n")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7034 (add-text-properties pos (1- (point)) (list 'face 'org-level-3))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7035 (when rtnall
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7036 (insert (mapconcat 'identity rtnall "\n")))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7037 (goto-char (point-min))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7038 (setq buffer-read-only t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7039 (org-fit-agenda-window)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7040 (if (not org-select-agenda-window) (select-window win))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7041
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7042 (defvar org-add-colon-after-tag-completion nil) ;; dynamically skoped param
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7043 (defun org-set-tags (&optional arg just-align)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7044 "Set the tags for the current headline.
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7045 With prefix ARG, realign all tags in headings in the current buffer."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7046 (interactive)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7047 (let* (;(inherit (org-get-inherited-tags))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7048 (re (concat "^" outline-regexp))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7049 (col (current-column))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7050 (current (org-get-tags))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7051 tags hd empty invis)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7052 (if arg
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7053 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7054 (goto-char (point-min))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7055 (while (re-search-forward re nil t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7056 (org-set-tags nil t))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7057 (message "All tags realigned to column %d" org-tags-column))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7058 (if just-align
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7059 (setq tags current)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7060 (setq org-last-tags-completion-table
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7061 (or (org-get-buffer-tags)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7062 org-last-tags-completion-table))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7063 (setq tags
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7064 (let ((org-add-colon-after-tag-completion t))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7065 (completing-read "Tags: " 'org-tags-completion-function
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7066 nil nil current 'org-tags-history)))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7067 (while (string-match "[-+&]+" tags)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
7068 (setq tags (replace-match ":" t t tags))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7069 ;; FIXME: still optimize this by not checking when JUST-ALIGN?
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
7070 (unless (setq empty (string-match "\\`[\t ]*\\'" tags))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
7071 (unless (string-match ":$" tags) (setq tags (concat tags ":")))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
7072 (unless (string-match "^:" tags) (setq tags (concat ":" tags))))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7073 (if (equal current "")
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7074 (progn
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
7075 (end-of-line 1)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7076 (or empty (insert-before-markers " ")))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7077 (beginning-of-line 1)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7078 (setq invis (org-invisible-p))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7079 (looking-at (concat "\\(.*\\)\\(" (regexp-quote current) "\\)[ \t]*"))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7080 (setq hd (match-string 1))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7081 (delete-region (match-beginning 0) (match-end 0))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7082 (insert-before-markers (org-trim hd) (if empty "" " ")))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7083 (unless (equal tags "")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7084 (move-to-column (max (current-column)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7085 (if (> org-tags-column 0)
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7086 org-tags-column
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7087 (- (- org-tags-column) (length tags))))
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7088 t)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7089 (insert-before-markers tags)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7090 (if (and (not invis) (org-invisible-p))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7091 (outline-flag-region (point-at-bol) (point) nil)))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7092 (move-to-column col))))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7093
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7094 (defun org-tags-completion-function (string predicate &optional flag)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7095 (let (s1 s2 rtn (ctable org-last-tags-completion-table))
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
7096 (if (string-match "^\\(.*[-+:&|]\\)\\([^-+:&|]*\\)$" string)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7097 (setq s1 (match-string 1 string)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7098 s2 (match-string 2 string))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7099 (setq s1 "" s2 string))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7100 (cond
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7101 ((eq flag nil)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7102 ;; try completion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7103 (setq rtn (try-completion s2 ctable))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7104 (if (stringp rtn)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7105 (concat s1 s2 (substring rtn (length s2))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7106 (if (and org-add-colon-after-tag-completion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7107 (assoc rtn ctable))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7108 ":" "")))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7109 )
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7110 ((eq flag t)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7111 ;; all-completions
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7112 (all-completions s2 ctable)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7113 )
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7114 ((eq flag 'lambda)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7115 ;; exact match?
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7116 (assoc s2 ctable)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7117 ))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7118
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7119 (defun org-get-tags ()
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7120 "Get the TAGS string in the current headline."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7121 (unless (org-on-heading-p)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7122 (error "Not on a heading"))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7123 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7124 (beginning-of-line 1)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7125 (if (looking-at ".*[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \t]*\\(\r\\|$\\)")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7126 (org-match-string-no-properties 1)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7127 "")))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7128
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7129 (defun org-get-buffer-tags ()
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7130 "Get a table of all tags used in the buffer, for completion."
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7131 (let (tags)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7132 (save-excursion
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7133 (goto-char (point-min))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7134 (while (re-search-forward "[ \t]:\\([A-Za-z_@0-9:]+\\):[ \t\r\n]" nil t)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7135 (mapc (lambda (x) (add-to-list 'tags x))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7136 (org-split-string (org-match-string-no-properties 1) ":"))))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7137 (mapcar 'list tags)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7138
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7139 ;;; Link Stuff
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7140
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7141 (defun org-find-file-at-mouse (ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7142 "Open file link or URL at mouse."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7143 (interactive "e")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7144 (mouse-set-point ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7145 (org-open-at-point 'in-emacs))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7146
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7147 (defun org-open-at-mouse (ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7148 "Open file link or URL at mouse."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7149 (interactive "e")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7150 (mouse-set-point ev)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7151 (org-open-at-point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7152
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7153 (defun org-open-at-point (&optional in-emacs)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7154 "Open link at or after point.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7155 If there is no link at point, this function will search forward up to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7156 the end of the current subtree.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7157 Normally, files will be opened by an appropriate application. If the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7158 optional argument IN-EMACS is non-nil, Emacs will visit the file."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7159 (interactive "P")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7160 (org-remove-occur-highlights nil nil t)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7161 (if (org-at-timestamp-p)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7162 (org-agenda-list nil (time-to-days (org-time-string-to-time
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7163 (substring (match-string 1) 0 10)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7164 1)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7165 (let (type path link line search (pos (point)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7166 (catch 'match
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7167 (save-excursion
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7168 (skip-chars-forward "^]\n\r")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7169 (when (and (re-search-backward "\\[\\[" nil t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7170 (looking-at org-bracket-link-regexp)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7171 (<= (match-beginning 0) pos)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7172 (>= (match-end 0) pos))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7173 (setq link (org-link-unescape (org-match-string-no-properties 1)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7174 (while (string-match " *\n *" link)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7175 (setq link (replace-match " " t t link)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7176 (if (string-match org-link-re-with-space2 link)
69620
fd0fd3b4eeb9 (org-open-at-point): Fixed bug in wiki-style bracket links.
Carsten Dominik <dominik@science.uva.nl>
parents: 69534
diff changeset
7177 (setq type (match-string 1 link)
fd0fd3b4eeb9 (org-open-at-point): Fixed bug in wiki-style bracket links.
Carsten Dominik <dominik@science.uva.nl>
parents: 69534
diff changeset
7178 path (match-string 2 link))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7179 (setq type "thisfile"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7180 path link))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7181 (throw 'match t)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7182
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7183 (when (get-text-property (point) 'org-linked-text)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7184 (setq type "thisfile"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7185 pos (if (get-text-property (1+ (point)) 'org-linked-text)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7186 (1+ (point)) (point))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7187 path (buffer-substring
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7188 (previous-single-property-change pos 'org-linked-text)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7189 (next-single-property-change pos 'org-linked-text)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7190 (throw 'match t))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7191
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7192 (save-excursion
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7193 (skip-chars-backward (concat "^[]" org-non-link-chars " "))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7194 (if (equal (char-before) ?<) (backward-char 1))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7195 (when (or (looking-at org-angle-link-re)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7196 (looking-at org-plain-link-re)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7197 (and (or (re-search-forward org-angle-link-re (point-at-eol) t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7198 (re-search-forward org-plain-link-re (point-at-eol) t))
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7199 (<= (match-beginning 0) pos)
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7200 (>= (match-end 0) pos)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7201 (setq type (match-string 1)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7202 path (match-string 2))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7203 (throw 'match t)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7204 (save-excursion
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7205 (skip-chars-backward "^ \t\n\r")
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7206 (when (looking-at "\\(:[A-Za-z_@0-9:]+\\):[ \t\r\n]")
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7207 (setq type "tags"
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7208 path (match-string 1))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7209 (while (string-match ":" path)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7210 (setq path (replace-match "+" t t path)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7211 (throw 'match t)))
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7212 (save-excursion
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7213 (skip-chars-backward "a-zA-Z_")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7214 (when (and (memq 'camel org-activate-links)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7215 (looking-at org-camel-regexp))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7216 (setq type "camel" path (match-string 0))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7217 (if (equal (char-before) ?*)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7218 (setq path (concat "*" path))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7219 (throw 'match t)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7220 (unless path
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7221 (error "No link found"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7222 ;; Remove any trailing spaces in path
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7223 (if (string-match " +\\'" path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7224 (setq path (replace-match "" t t path)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7225
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7226 (cond
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7227
69620
fd0fd3b4eeb9 (org-open-at-point): Fixed bug in wiki-style bracket links.
Carsten Dominik <dominik@science.uva.nl>
parents: 69534
diff changeset
7228 ((member type '("http" "https" "ftp" "mailto" "news"))
fd0fd3b4eeb9 (org-open-at-point): Fixed bug in wiki-style bracket links.
Carsten Dominik <dominik@science.uva.nl>
parents: 69534
diff changeset
7229 (browse-url (concat type ":" path)))
fd0fd3b4eeb9 (org-open-at-point): Fixed bug in wiki-style bracket links.
Carsten Dominik <dominik@science.uva.nl>
parents: 69534
diff changeset
7230
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
7231 ((string= type "tags")
68294
f915fc860323 (org-open-at-point): Fixed bug with matching a link.
Carsten Dominik <dominik@science.uva.nl>
parents: 68245
diff changeset
7232 (org-tags-view in-emacs path))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7233 ((or (string= type "camel")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7234 (string= type "thisfile"))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7235 (org-mark-ring-push)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7236 (org-link-search
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7237 path
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7238 (cond ((equal in-emacs '(4)) 'occur)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7239 ((equal in-emacs '(16)) 'org-occur)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7240 (t nil))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7241
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7242 ((string= type "file")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7243 (if (string-match "::?\\([0-9]+\\)\\'" path) ;; second : optional
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7244 (setq line (string-to-number (match-string 1 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7245 path (substring path 0 (match-beginning 0)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7246 (if (string-match "::\\(.+\\)\\'" path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7247 (setq search (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7248 path (substring path 0 (match-beginning 0)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7249 (org-open-file path in-emacs line search))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7250
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7251 ((string= type "news")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7252 (org-follow-gnus-link path))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7253
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7254 ((string= type "bbdb")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7255 (org-follow-bbdb-link path))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7256
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7257 ((string= type "gnus")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7258 (let (group article)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7259 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7260 (error "Error in Gnus link"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7261 (setq group (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7262 article (match-string 3 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7263 (org-follow-gnus-link group article)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7264
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7265 ((string= type "vm")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7266 (let (folder article)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7267 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7268 (error "Error in VM link"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7269 (setq folder (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7270 article (match-string 3 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7271 ;; in-emacs is the prefix arg, will be interpreted as read-only
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7272 (org-follow-vm-link folder article in-emacs)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7273
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7274 ((string= type "wl")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7275 (let (folder article)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7276 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7277 (error "Error in Wanderlust link"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7278 (setq folder (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7279 article (match-string 3 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7280 (org-follow-wl-link folder article)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7281
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7282 ((string= type "mhe")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7283 (let (folder article)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7284 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7285 (error "Error in MHE link"))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7286 (setq folder (match-string 1 path)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7287 article (match-string 3 path))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7288 (org-follow-mhe-link folder article)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7289
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7290 ((string= type "rmail")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7291 (let (folder article)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7292 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7293 (error "Error in RMAIL link"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7294 (setq folder (match-string 1 path)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7295 article (match-string 3 path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7296 (org-follow-rmail-link folder article)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7297
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7298 ((string= type "shell")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7299 (let ((cmd path))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7300 (while (string-match "@{" cmd)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7301 (setq cmd (replace-match "<" t t cmd)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7302 (while (string-match "@}" cmd)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7303 (setq cmd (replace-match ">" t t cmd)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7304 (if (or (not org-confirm-shell-links)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7305 (funcall org-confirm-shell-links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7306 (format "Execute \"%s\" in shell? "
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7307 (org-add-props cmd nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7308 'face 'org-warning))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7309 (shell-command cmd)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7310 (error "Abort"))))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7311
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7312 (t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7313 (browse-url-at-point))))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7314
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7315 (defun org-link-search (s &optional type)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7316 "Search for a link search option.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7317 When S is a CamelCaseWord, search for a target, or for a sentence containing
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7318 the words. If S is surrounded by forward slashes, it is interpreted as a
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7319 regular expression. In org-mode files, this will create an `org-occur'
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7320 sparse tree. In ordinary files, `occur' will be used to list matches.
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7321 If the current buffer is in `dired-mode', grep will be used to search
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7322 in all files."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7323 (let ((case-fold-search t)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7324 (s0 (mapconcat 'identity (org-split-string s "[ \t\r\n]+") " "))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7325 (pos (point))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7326 (pre "") (post "")
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7327 words re0 re1 re2 re3 re4 re5 re2a reall camel)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7328 (cond ((save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7329 (goto-char (point-min))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7330 (and
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7331 (re-search-forward
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7332 (concat "<<" (regexp-quote s0) ">>") nil t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7333 (setq pos (match-beginning 0))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7334 ;; There is an exact target for this
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7335 (goto-char pos))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7336 ((string-match "^/\\(.*\\)/$" s)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7337 ;; A regular expression
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7338 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7339 ((eq major-mode 'org-mode)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7340 (org-occur (match-string 1 s)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7341 ;;((eq major-mode 'dired-mode)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7342 ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *")))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7343 (t (org-do-occur (match-string 1 s)))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7344 ((or (setq camel (string-match (concat "^" org-camel-regexp "$") s))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7345 t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7346 ;; A camel or a normal search string
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7347 (when (equal (string-to-char s) ?*)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7348 ;; Anchor on headlines, post may include tags.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7349 (setq pre "^\\*+[ \t]*\\(\\sw+\\)?[ \t]*"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7350 post "[ \t]*\\([ \t]+:[a-zA-Z_@0-9:+]:[ \t]*\\)?$"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7351 s (substring s 1)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7352 (remove-text-properties
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7353 0 (length s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7354 '(face nil mouse-face nil keymap nil fontified nil) s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7355 ;; Make a series of regular expressions to find a match
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7356 (setq words
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7357 (if camel
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7358 (org-camel-to-words s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7359 (org-split-string s "[ \n\r\t]+"))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7360 re0 (concat "<<" (regexp-quote s0) ">>")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7361 re2 (concat "\\<" (mapconcat 'downcase words "[ \t]+") "\\>")
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7362 re2a (concat "\\<" (mapconcat 'downcase words "[ \t\r\n]+") "\\>")
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7363 re4 (concat "\\<" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\>")
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7364 re1 (concat pre re2 post)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7365 re3 (concat pre re4 post)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7366 re5 (concat pre ".*" re4)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7367 re2 (concat pre re2)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7368 re2a (concat pre re2a)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7369 re4 (concat pre re4)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7370 reall (concat "\\(" re0 "\\)\\|\\(" re1 "\\)\\|\\(" re2
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7371 "\\)\\|\\(" re3 "\\)\\|\\(" re4 "\\)\\|\\("
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7372 re5 "\\)"
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7373 ))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7374 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7375 ((eq type 'org-occur) (org-occur reall))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7376 ((eq type 'occur) (org-do-occur (downcase reall) 'cleanup))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7377 (t (goto-char (point-min))
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7378 (if (or (org-search-not-link re0 nil t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7379 (org-search-not-link re1 nil t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7380 (org-search-not-link re2 nil t)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7381 (org-search-not-link re2a nil t)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7382 (org-search-not-link re3 nil t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7383 (org-search-not-link re4 nil t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7384 (org-search-not-link re5 nil t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7385 )
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7386 (goto-char (match-beginning 0))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7387 (goto-char pos)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7388 (error "No match")))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7389 (t
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7390 ;; Normal string-search
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7391 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7392 (if (search-forward s nil t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7393 (goto-char (match-beginning 0))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7394 (error "No match"))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7395 (and (eq major-mode 'org-mode) (org-show-hierarchy-above))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7396
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7397 (defun org-search-not-link (&rest args)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7398 "Execute `re-search-forward', but only accept matches that are not a link."
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7399 (catch 'exit
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7400 (let ((pos (point)) p1)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7401 (while (apply 're-search-forward args)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7402 (setq p1 (point))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7403 (if (not (save-match-data
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7404 (and (re-search-backward "\\[\\[" nil t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7405 (looking-at org-bracket-link-regexp)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7406 (<= (match-beginning 0) p1)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7407 (>= (match-end 0) p1))))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7408 (progn (goto-char (match-end 0))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7409 (throw 'exit (point)))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7410 (goto-char (match-end 0)))))))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7411
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7412 (defun org-do-occur (regexp &optional cleanup)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7413 "Call the Emacs command `occur'.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7414 If CLEANUP is non-nil, remove the printout of the regular expression
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7415 in the *Occur* buffer. This is useful if the regex is long and not useful
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7416 to read."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7417 (occur regexp)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7418 (when cleanup
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7419 (let ((cwin (selected-window)) win beg end)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7420 (when (setq win (get-buffer-window "*Occur*"))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7421 (select-window win))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7422 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7423 (when (re-search-forward "match[a-z]+" nil t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7424 (setq beg (match-end 0))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7425 (if (re-search-forward "^[ \t]*[0-9]+" nil t)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7426 (setq end (1- (match-beginning 0)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7427 (and beg end (let ((buffer-read-only)) (delete-region beg end)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7428 (goto-char (point-min))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7429 (select-window cwin))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7430
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7431 (defvar org-mark-ring nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7432 "Mark ring for positions before jumps in Org-mode.")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7433 (defvar org-mark-ring-last-goto nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7434 "Last position in the mark ring used to go back.")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7435 ;; Fill and close the ring
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7436 (setq org-mark-ring nil org-mark-ring-last-goto nil) ;; in case file is reloaded
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7437 (loop for i from 1 to org-mark-ring-length do
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7438 (push (make-marker) org-mark-ring))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7439 (setcdr (nthcdr (1- org-mark-ring-length) org-mark-ring)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7440 org-mark-ring)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7441
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7442 (defun org-mark-ring-push (&optional pos buffer)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7443 "Put the current position or POS into the mark ring and rotate it."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7444 (interactive)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7445 (setq pos (or pos (point)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7446 (setq org-mark-ring (nthcdr (1- org-mark-ring-length) org-mark-ring))
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
7447 (move-marker (car org-mark-ring)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7448 (or pos (point))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7449 (or buffer (current-buffer)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7450 (message
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7451 (substitute-command-keys
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7452 "Position saved to mark ring, go back with \\[org-mark-ring-goto].")))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7453
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7454 (defun org-mark-ring-goto (&optional n)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7455 "Jump to the previous position in the mark ring.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7456 With prefix arg N, jump back that many stored positions. When
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7457 called several times in succession, walk through the entire ring.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7458 Org-mode commands jumping to a different position in the current file,
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7459 or to another Org-mode file, automatically push the old position
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7460 onto the ring."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7461 (interactive "p")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7462 (let (p m)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7463 (if (eq last-command this-command)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7464 (setq p (nthcdr n (or org-mark-ring-last-goto org-mark-ring)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7465 (setq p org-mark-ring))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7466 (setq org-mark-ring-last-goto p)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7467 (setq m (car p))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7468 (switch-to-buffer (marker-buffer m))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7469 (goto-char m)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7470 (if (or (org-invisible-p) (org-invisible-p2)) (org-show-hierarchy-above))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7471
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7472 (defun org-camel-to-words (s)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7473 "Split \"CamelCaseWords\" to (\"Camel\" \"Case\" \"Words\")."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7474 (let ((case-fold-search nil)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7475 words)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7476 (while (string-match "[a-z][A-Z]" s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7477 (push (substring s 0 (1+ (match-beginning 0))) words)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7478 (setq s (substring s (1+ (match-beginning 0)))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7479 (nreverse (cons s words))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7480
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7481 (defun org-remove-angle-brackets (s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7482 (if (equal (substring s 0 1) "<") (setq s (substring s 1)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7483 (if (equal (substring s -1) ">") (setq s (substring s 0 -1)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7484 s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7485 (defun org-add-angle-brackets (s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7486 (if (equal (substring s 0 1) "<") nil (setq s (concat "<" s)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7487 (if (equal (substring s -1) ">") nil (setq s (concat s ">")))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7488 s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7489
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7490 (defun org-follow-bbdb-link (name)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7491 "Follow a BBDB link to NAME."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7492 (require 'bbdb)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7493 (let ((inhibit-redisplay t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7494 (bbdb-electric-p nil))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7495 (catch 'exit
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7496 ;; Exact match on name
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7497 (bbdb-name (concat "\\`" name "\\'") nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7498 (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7499 ;; Exact match on name
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7500 (bbdb-company (concat "\\`" name "\\'") nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7501 (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7502 ;; Partial match on name
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7503 (bbdb-name name nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7504 (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7505 ;; Partial match on company
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7506 (bbdb-company name nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7507 (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7508 ;; General match including network address and notes
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7509 (bbdb name nil)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7510 (when (= 0 (buffer-size (get-buffer "*BBDB*")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7511 (delete-window (get-buffer-window "*BBDB*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7512 (error "No matching BBDB record")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7513
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7514 (defun org-follow-gnus-link (&optional group article)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7515 "Follow a Gnus link to GROUP and ARTICLE."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7516 (require 'gnus)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7517 (funcall (cdr (assq 'gnus org-link-frame-setup)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7518 (if group (gnus-fetch-group group))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7519 (if article
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7520 (or (gnus-summary-goto-article article nil 'force)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7521 (if (fboundp 'gnus-summary-insert-cached-articles)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7522 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7523 (gnus-summary-insert-cached-articles)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7524 (gnus-summary-goto-article article nil 'force))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7525 (message "Message could not be found.")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7526
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7527 (defun org-follow-vm-link (&optional folder article readonly)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7528 "Follow a VM link to FOLDER and ARTICLE."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7529 (require 'vm)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7530 (setq article (org-add-angle-brackets article))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7531 (if (string-match "^//\\([a-zA-Z]+@\\)?\\([^:]+\\):\\(.*\\)" folder)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7532 ;; ange-ftp or efs or tramp access
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7533 (let ((user (or (match-string 1 folder) (user-login-name)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7534 (host (match-string 2 folder))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7535 (file (match-string 3 folder)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7536 (cond
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7537 ((featurep 'tramp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7538 ;; use tramp to access the file
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7539 (if (featurep 'xemacs)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7540 (setq folder (format "[%s@%s]%s" user host file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7541 (setq folder (format "/%s@%s:%s" user host file))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7542 (t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7543 ;; use ange-ftp or efs
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7544 (require (if (featurep 'xemacs) 'efs 'ange-ftp))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7545 (setq folder (format "/%s@%s:%s" user host file))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7546 (when folder
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7547 (funcall (cdr (assq 'vm org-link-frame-setup)) folder readonly)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7548 (sit-for 0.1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7549 (when article
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7550 (vm-select-folder-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7551 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7552 (let ((case-fold-search t))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7553 (goto-char (point-min))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7554 (if (not (re-search-forward
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7555 (concat "^" "message-id: *" (regexp-quote article))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7556 (error "Could not find the specified message in this folder"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7557 (vm-isearch-update)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7558 (vm-isearch-narrow)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7559 (vm-beginning-of-message)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7560 (vm-summarize)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7561
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7562 (defun org-follow-wl-link (folder article)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7563 "Follow a Wanderlust link to FOLDER and ARTICLE."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7564 (setq article (org-add-angle-brackets article))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7565 (wl-summary-goto-folder-subr folder 'no-sync t nil t)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7566 (if article (wl-summary-jump-to-msg-by-message-id article ">"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7567 (wl-summary-redisplay))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7568
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7569 (defun org-follow-rmail-link (folder article)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7570 "Follow an RMAIL link to FOLDER and ARTICLE."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7571 (setq article (org-add-angle-brackets article))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7572 (let (message-number)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7573 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7574 (save-window-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7575 (rmail (if (string= folder "RMAIL") rmail-file-name folder))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7576 (setq message-number
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7577 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7578 (widen)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7579 (goto-char (point-max))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7580 (if (re-search-backward
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7581 (concat "^Message-ID:\\s-+" (regexp-quote
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7582 (or article "")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7583 nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7584 (rmail-what-message))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7585 (if message-number
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7586 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7587 (rmail (if (string= folder "RMAIL") rmail-file-name folder))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7588 (rmail-show-message message-number)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7589 message-number)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7590 (error "Message not found"))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7591
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7592 ;; mh-e integration based on planner-mode
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7593 (defun org-mhe-get-message-real-folder ()
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7594 "Return the name of the current message real folder, so if you use
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
7595 sequences, it will now work."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7596 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7597 (let* ((folder
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7598 (if (equal major-mode 'mh-folder-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7599 mh-current-folder
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7600 ;; Refer to the show buffer
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7601 mh-show-folder-buffer))
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
7602 (end-index
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7603 (if (boundp 'mh-index-folder)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7604 (min (length mh-index-folder) (length folder))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7605 )
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7606 ;; a simple test on mh-index-data does not work, because
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7607 ;; mh-index-data is always nil in a show buffer.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7608 (if (and (boundp 'mh-index-folder)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7609 (string= mh-index-folder (substring folder 0 end-index)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7610 (if (equal major-mode 'mh-show-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7611 (save-window-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7612 (when (buffer-live-p (get-buffer folder))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7613 (progn
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7614 (pop-to-buffer folder)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7615 (org-mhe-get-message-folder-from-index)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7616 )
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7617 ))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7618 (org-mhe-get-message-folder-from-index)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7619 )
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7620 folder
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7621 )
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7622 )))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7623
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7624 (defun org-mhe-get-message-folder-from-index ()
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
7625 "Returns the name of the message folder in a index folder buffer."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7626 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7627 (mh-index-previous-folder)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7628 (re-search-forward "^\\(+.*\\)$" nil t)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7629 (message (match-string 1))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7630
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7631 (defun org-mhe-get-message-folder ()
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
7632 "Return the name of the current message folder. Be careful if you
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
7633 use sequences."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7634 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7635 (if (equal major-mode 'mh-folder-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7636 mh-current-folder
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7637 ;; Refer to the show buffer
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7638 mh-show-folder-buffer)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7639
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7640 (defun org-mhe-get-message-num ()
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
7641 "Return the number of the current message. Be careful if you
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
7642 use sequences."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7643 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7644 (if (equal major-mode 'mh-folder-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7645 (mh-get-msg-num nil)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7646 ;; Refer to the show buffer
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7647 (mh-show-buffer-message-number))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7648
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7649 (defun org-mhe-get-header (header)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
7650 "Return a header of the message in folder mode. This will create a
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
7651 show buffer for the corresponding message. If you have a more clever
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
7652 idea..."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7653 (let* ((folder (org-mhe-get-message-folder))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7654 (num (org-mhe-get-message-num))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7655 (buffer (get-buffer-create (concat "show-" folder)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7656 (header-field))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7657 (with-current-buffer buffer
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7658 (mh-display-msg num folder)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7659 (if (equal major-mode 'mh-folder-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7660 (mh-header-display)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7661 (mh-show-header-display))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7662 (set-buffer buffer)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7663 (setq header-field (mh-get-header-field header))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7664 (if (equal major-mode 'mh-folder-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7665 (mh-show)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7666 (mh-show-show))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7667 header-field)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7668
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7669 (defun org-follow-mhe-link (folder article)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7670 "Follow an MHE link to FOLDER and ARTICLE.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7671 If ARTICLE is nil FOLDER is shown. If the configuration variable
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7672 `org-mhe-search-all-folders' is t and `mh-searcher' is pick,
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7673 ARTICLE is searched in all folders. Indexed searches (swish++,
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7674 namazu, and others supported by MH-E) will always search in all
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7675 folders."
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
7676 (require 'mh-e)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7677 (require 'mh-search)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7678 (require 'mh-utils)
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
7679 (mh-find-path)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7680 (if (not article)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7681 (mh-visit-folder (mh-normalize-folder-name folder))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7682 (setq article (org-add-angle-brackets article))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7683 (mh-search-choose)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7684 (if (equal mh-searcher 'pick)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7685 (progn
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7686 (mh-search folder (list "--message-id" article))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7687 (when (and org-mhe-search-all-folders
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7688 (not (org-mhe-get-message-real-folder)))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7689 (kill-this-buffer)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7690 (mh-search "+" (list "--message-id" article))))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7691 (mh-search "+" article))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7692 (if (org-mhe-get-message-real-folder)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7693 (mh-show-msg 1)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7694 (kill-this-buffer)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
7695 (error "Message not found"))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7696
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7697 (defun org-upgrade-old-links (&optional query-description)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7698 "Transfer old <...> style links to new [[...]] style links.
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7699 With arg query-description, ask at each match for a description text to use
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7700 for this link."
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7701 (interactive (list (y-or-n-p "Would you like to be queried for a description at each link?")))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7702 (save-excursion
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7703 (goto-char (point-min))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7704 (let ((re (concat "\\([^[]\\)<\\("
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7705 "\\(" (mapconcat 'identity org-link-types "\\|")
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7706 "\\):"
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7707 "[^" org-non-link-chars "]+\\)>"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7708 l1 l2 (cnt 0))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7709 (while (re-search-forward re nil t)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7710 (setq cnt (1+ cnt)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7711 l1 (org-match-string-no-properties 2)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7712 l2 (save-match-data (org-link-escape l1)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7713 (when query-description (setq l1 (read-string "Desc: " l1)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7714 (if (equal l1 l2)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7715 (replace-match (concat (match-string 1) "[[" l1 "]]") t t)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7716 (replace-match (concat (match-string 1) "[[" l2 "][" l1 "]]") t t)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7717 (message "%d matches have beed treated" cnt))))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
7718
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7719 (defun org-open-file (path &optional in-emacs line search)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7720 "Open the file at PATH.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7721 First, this expands any special file name abbreviations. Then the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7722 configuration variable `org-file-apps' is checked if it contains an
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7723 entry for this file type, and if yes, the corresponding command is launched.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7724 If no application is found, Emacs simply visits the file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7725 With optional argument IN-EMACS, Emacs will visit the file.
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7726 Optional LINE specifies a line to go to, optional SEARCH a string to
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7727 search for. If LINE or SEARCH is given, the file will always be
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7728 opened in Emacs.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7729 If the file does not exist, an error is thrown."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7730 (setq in-emacs (or in-emacs line search))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7731 (let* ((file (if (equal path "")
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7732 buffer-file-name
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7733 (convert-standard-filename (org-expand-file-name path))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7734 (dirp (file-directory-p file))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7735 (dfile (downcase file))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7736 (old-buffer (current-buffer))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7737 (old-pos (point))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7738 (old-mode major-mode)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7739 ext cmd apps)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7740 (if (and (not (file-exists-p file))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7741 (not org-open-non-existing-files))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7742 (error "No such file: %s" file))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7743 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\.gz\\)$" dfile)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7744 (setq ext (match-string 1 dfile))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7745 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\)$" dfile)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7746 (setq ext (match-string 1 dfile))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7747 (setq apps (append org-file-apps (org-default-apps)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7748 (if in-emacs
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7749 (setq cmd 'emacs)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7750 (setq cmd (or (and dirp (cdr (assoc 'directory apps)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7751 (cdr (assoc ext apps))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7752 (cdr (assoc t apps)))))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7753 (when (eq cmd 'mailcap)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7754 (require 'mailcap)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7755 (mailcap-parse-mailcaps)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7756 (let* ((mime-type (mailcap-extension-to-mime (or ext "")))
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7757 (command (mailcap-mime-info mime-type)))
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7758 (if (stringp command)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7759 (setq cmd command)
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7760 (setq cmd 'emacs))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7761 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7762 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
7763 (setq cmd (format cmd (concat "\"" file "\"")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7764 (save-window-excursion
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
7765 (shell-command (concat cmd " &"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7766 ((or (stringp cmd)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7767 (eq cmd 'emacs))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7768 (unless (equal (file-truename file) (file-truename (or buffer-file-name "")))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7769 (funcall (cdr (assq 'file org-link-frame-setup)) file))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7770 (if line (goto-line line)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7771 (if search (org-link-search search))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7772 ((consp cmd)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7773 (eval cmd))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7774 (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7775 (and (eq major-mode 'org-mode) (eq old-mode 'org-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7776 (or (not (equal old-buffer (current-buffer)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7777 (not (equal old-pos (point))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7778 (org-mark-ring-push old-pos old-buffer))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7779
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7780 (defun org-default-apps ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7781 "Return the default applications for this operating system."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7782 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7783 ((eq system-type 'darwin)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7784 org-file-apps-defaults-macosx)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7785 ((eq system-type 'windows-nt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7786 org-file-apps-defaults-windowsnt)
64078
ebf5ec3a071e (org-file-apps-defaults-gnu): Renamed from org-file-apps-defaults-linux.
Richard M. Stallman <rms@gnu.org>
parents: 64057
diff changeset
7787 (t org-file-apps-defaults-gnu)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7788
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7789 (defun org-expand-file-name (path)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7790 "Replace special path abbreviations and expand the file name."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7791 (expand-file-name path))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7793
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7794 (defvar org-insert-link-history nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7795 "Minibuffer history for links inserted with `org-insert-link'.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7796
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7797 (defvar org-stored-links nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7798 "Contains the links stored with `org-store-link'.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7799
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7800 ;;;###autoload
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7801 (defun org-store-link (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7802 "\\<org-mode-map>Store an org-link to the current location.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7803 This link can later be inserted into an org-buffer with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7804 \\[org-insert-link].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7805 For some link types, a prefix arg is interpreted:
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7806 For links to usenet articles, arg negates `org-usenet-links-prefer-google'.
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7807 For file links, arg negates `org-context-in-file-links'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7808 (interactive "P")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7809 (let (link cpltxt desc txt (pos (point)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7810 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7811
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7812 ((eq major-mode 'bbdb-mode)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
7813 (setq cpltxt (concat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7814 "bbdb:"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7815 (or (bbdb-record-name (bbdb-current-record))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7816 (bbdb-record-company (bbdb-current-record))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7817 link (org-make-link cpltxt)))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
7818
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7819 ((eq major-mode 'calendar-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7820 (let ((cd (calendar-cursor-to-date)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7821 (setq link
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7822 (format-time-string
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7823 (car org-time-stamp-formats)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7824 (apply 'encode-time
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7825 (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7826 nil nil nil))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7827
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7828 ((or (eq major-mode 'vm-summary-mode)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7829 (eq major-mode 'vm-presentation-mode))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7830 (and (eq major-mode 'vm-presentation-mode) (vm-summarize))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7831 (vm-follow-summary-cursor)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7832 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7833 (vm-select-folder-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7834 (let* ((message (car vm-message-pointer))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7835 (folder buffer-file-name)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7836 (subject (vm-su-subject message))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7837 (author (vm-su-full-name message))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7838 (message-id (vm-su-message-id message)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7839 (setq message-id (org-remove-angle-brackets message-id))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7840 (setq folder (abbreviate-file-name folder))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7841 (if (string-match (concat "^" (regexp-quote vm-folder-directory))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7842 folder)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7843 (setq folder (replace-match "" t t folder)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7844 (setq cpltxt (concat author " on: " subject))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7845 (setq link (org-make-link "vm:" folder "#" message-id)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7846
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7847 ((eq major-mode 'wl-summary-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7848 (let* ((msgnum (wl-summary-message-number))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7849 (message-id (elmo-message-field wl-summary-buffer-elmo-folder
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7850 msgnum 'message-id))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7851 (wl-message-entity (elmo-msgdb-overview-get-entity
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7852 msgnum (wl-summary-buffer-msgdb)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7853 (author (wl-summary-line-from)) ; FIXME: correct?
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7854 (subject "???")) ; FIXME:
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7855 (setq message-id (org-remove-angle-brackets message-id))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7856 (setq cpltxt (concat author " on: " subject))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7857 (setq link (org-make-link "wl:" wl-summary-buffer-folder-name
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7858 "#" message-id))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7859
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7860 ((or (equal major-mode 'mh-folder-mode)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7861 (equal major-mode 'mh-show-mode))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7862 (let ((from-header (org-mhe-get-header "From:"))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7863 (to-header (org-mhe-get-header "To:"))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7864 (subject (org-mhe-get-header "Subject:")))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7865 (setq cpltxt (concat from-header " on: " subject))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7866 (setq link (org-make-link "mhe:" (org-mhe-get-message-real-folder) "#"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7867 (org-remove-angle-brackets
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7868 (org-mhe-get-header "Message-Id:"))))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7869
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7870 ((eq major-mode 'rmail-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7871 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7872 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7873 (rmail-narrow-to-non-pruned-header)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7874 (let ((folder buffer-file-name)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7875 (message-id (mail-fetch-field "message-id"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7876 (author (mail-fetch-field "from"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7877 (subject (mail-fetch-field "subject")))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7878 (setq message-id (org-remove-angle-brackets message-id))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7879 (setq cpltxt (concat author " on: " subject))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7880 (setq link (org-make-link "rmail:" folder "#" message-id))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7881
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7882 ((eq major-mode 'gnus-group-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7883 (let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7884 (gnus-group-group-name)) ; version
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7885 ((fboundp 'gnus-group-name)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7886 (gnus-group-name))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7887 (t "???"))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7888 (setq cpltxt (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7889 (if (org-xor arg org-usenet-links-prefer-google)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7890 "http://groups.google.com/groups?group="
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7891 "gnus:")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7892 group)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7893 link (org-make-link cpltxt))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7894
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7895 ((memq major-mode '(gnus-summary-mode gnus-article-mode))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
7896 (and (eq major-mode 'gnus-article-mode) (gnus-article-show-summary))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7897 (gnus-summary-beginning-of-article)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7898 (let* ((group (car gnus-article-current))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7899 (article (cdr gnus-article-current))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7900 (header (gnus-summary-article-header article))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7901 (author (mail-header-from header))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7902 (message-id (mail-header-id header))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7903 (date (mail-header-date header))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7904 (subject (gnus-summary-subject-string)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7905 (setq cpltxt (concat author " on: " subject))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7906 (if (org-xor arg org-usenet-links-prefer-google)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7907 (setq link
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7908 (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7909 cpltxt "\n "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7910 (format "http://groups.google.com/groups?as_umsgid=%s"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7911 (org-fixup-message-id-for-http message-id))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7912 (setq link (org-make-link "gnus:" group
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7913 "#" (number-to-string article))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7914
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7915 ((eq major-mode 'w3-mode)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
7916 (setq cpltxt (url-view-url t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7917 link (org-make-link cpltxt)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7918 ((eq major-mode 'w3m-mode)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
7919 (setq cpltxt w3m-current-url
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7920 link (org-make-link cpltxt)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7921
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7922 ((eq major-mode 'org-mode)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7923 ;; Just link to current headline
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7924 (setq cpltxt (concat "file:"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7925 (abbreviate-file-name buffer-file-name)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7926 ;; Add a context search string
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7927 (when (org-xor org-context-in-file-links arg)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7928 ;; Check if we are on a target
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7929 (if (save-excursion
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7930 (skip-chars-forward "^>\n\r")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7931 (and (re-search-backward "<<" nil t)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7932 (looking-at "<<\\(.*?\\)>>")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7933 (<= (match-beginning 0) pos)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7934 (>= (match-end 0) pos)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7935 (setq cpltxt (concat cpltxt "::" (match-string 1)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7936 (setq txt (cond
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7937 ((org-on-heading-p) nil)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7938 ((org-region-active-p)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7939 (buffer-substring (region-beginning) (region-end)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7940 (t (buffer-substring (point-at-bol) (point-at-eol)))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7941 (setq cpltxt
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7942 (concat cpltxt "::"
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7943 (if org-file-link-context-use-camel-case
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7944 (org-make-org-heading-camel txt)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7945 (org-make-org-heading-search-string txt)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7946 desc "NONE")))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7947 (if (string-match "::\\'" cpltxt)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7948 (setq cpltxt (substring cpltxt 0 -2)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7949 (setq link (org-make-link cpltxt)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7950
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7951 (buffer-file-name
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7952 ;; Just link to this file here.
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
7953 (setq cpltxt (concat "file:"
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
7954 (abbreviate-file-name buffer-file-name)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7955 ;; Add a context string
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7956 (when (org-xor org-context-in-file-links arg)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7957 (setq txt (if (org-region-active-p)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7958 (buffer-substring (region-beginning) (region-end))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7959 (buffer-substring (point-at-bol) (point-at-eol))))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
7960 (setq cpltxt
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
7961 (concat cpltxt "::"
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7962 (if org-file-link-context-use-camel-case
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7963 (org-make-org-heading-camel txt)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7964 (org-make-org-heading-search-string txt)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7965 desc "NONE"))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
7966 (setq link (org-make-link cpltxt)))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
7967
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7968 ((interactive-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7969 (error "Cannot link to a buffer which is not visiting a file"))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
7970
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7971 (t (setq link nil)))
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
7972
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7973 (if (consp link) (setq cpltxt (car link) link (cdr link)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7974 (setq link (or link cpltxt)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7975 desc (or desc cpltxt))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7976 (if (equal desc "NONE") (setq desc nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7977
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7978 (if (and (interactive-p) link)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7979 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7980 (setq org-stored-links
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7981 (cons (list cpltxt link desc) org-stored-links))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
7982 (message "Stored: %s" (or cpltxt link)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
7983 (org-make-link-string link desc))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7984
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7985 (defun org-make-org-heading-search-string (&optional string heading)
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
7986 "Make search string for STRING or current headline."
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7987 (interactive)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7988 (let ((s (or string (org-get-heading))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7989 (unless (and string (not heading))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7990 ;; We are using a headline, clean up garbage in there.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7991 (if (string-match org-todo-regexp s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7992 (setq s (replace-match "" t t s)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7993 (if (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7994 (setq s (replace-match "" t t s)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7995 (setq s (org-trim s))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7996 (if (string-match (concat "^\\(" org-quote-string "\\|"
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7997 org-comment-string "\\)") s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7998 (setq s (replace-match "" t t s)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
7999 (while (string-match org-ts-regexp s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8000 (setq s (replace-match "" t t s))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8001 (while (string-match "[^a-zA-Z_0-9 \t]+" s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8002 (setq s (replace-match " " t t s)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8003 (or string (setq s (concat "*" s))) ; Add * for headlines
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8004 (mapconcat 'identity (org-split-string s "[ \t]+") " ")))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8005
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8006 (defun org-make-org-heading-camel (&optional string heading)
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
8007 "Make a CamelCase string for STRING or the current headline."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8008 (interactive)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8009 (let ((s (or string (org-get-heading))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8010 (unless (and string (not heading))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8011 ;; We are using a headline, clean up garbage in there.
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8012 (if (string-match org-todo-regexp s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8013 (setq s (replace-match "" t t s)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8014 (if (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" s)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8015 (setq s (replace-match "" t t s)))
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8016 (setq s (org-trim s))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8017 (if (string-match (concat "^\\(" org-quote-string "\\|"
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8018 org-comment-string "\\)") s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8019 (setq s (replace-match "" t t s)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8020 (while (string-match org-ts-regexp s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8021 (setq s (replace-match "" t t s))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8022 (while (string-match "[^a-zA-Z_ \t]+" s)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8023 (setq s (replace-match " " t t s)))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8024 (or string (setq s (concat "*" s))) ; Add * for headlines
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8025 (mapconcat 'capitalize (org-split-string s "[ \t]+") "")))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
8026
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8027 (defun org-make-link (&rest strings)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8028 "Concatenate STRINGS, format resulting string with `org-link-format'."
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8029 (format org-link-format (apply 'concat strings)))
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8030
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8031 (defun org-make-link-string (link &optional description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8032 "Make a link with brackets, consisting of LINK and DESCRIPTION."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8033 (if (eq org-link-style 'plain)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8034 (if (equal description link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8035 link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8036 (concat description "\n" link))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8037 (when (stringp description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8038 ;; Remove brackets from the description, they are fatal.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8039 (while (string-match "\\[\\|\\]" description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8040 (setq description (replace-match "" t t description))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8041 (when (equal (org-link-escape link) description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8042 ;; No description needed, it is identical
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8043 (setq description nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8044 (when (and (not description)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8045 (not (equal link (org-link-escape link))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8046 (setq description link))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8047 (concat "[[" (org-link-escape link) "]"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8048 (if description (concat "[" description "]") "")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8049 "]")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8050
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8051 (defconst org-link-escape-chars '(("[" . "%5B") ("]" . "%5D") (" " . "%20"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8052 "Association list of escapes for some characters problematic in links.")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8053
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8054 (defun org-link-escape (text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8055 "Escape charaters in TEXT that are problematic for links."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8056 (when text
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8057 (let ((re (mapconcat (lambda (x) (regexp-quote (car x)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8058 org-link-escape-chars "\\|")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8059 (while (string-match re text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8060 (setq text
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8061 (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8062 (cdr (assoc (match-string 0 text) org-link-escape-chars))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8063 t t text)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8064 text)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8065
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8066 (defun org-link-unescape (text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8067 "Reverse the action of `org-link-escape'."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8068 (when text
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8069 (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8070 org-link-escape-chars "\\|")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8071 (while (string-match re text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8072 (setq text
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8073 (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8074 (car (rassoc (match-string 0 text) org-link-escape-chars))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8075 t t text)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8076 text)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
8077
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8078 (defun org-xor (a b)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8079 "Exclusive or."
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8080 (if a (not b) b))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8081
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8082 (defun org-get-header (header)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8083 "Find a header field in the current buffer."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8084 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8085 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8086 (let ((case-fold-search t) s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8087 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8088 ((eq header 'from)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8089 (if (re-search-forward "^From:\\s-+\\(.*\\)" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8090 (setq s (match-string 1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8091 (while (string-match "\"" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8092 (setq s (replace-match "" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8093 (if (string-match "[<(].*" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8094 (setq s (replace-match "" t t s))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8095 ((eq header 'message-id)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8096 (if (re-search-forward "^message-id:\\s-+\\(.*\\)" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8097 (setq s (match-string 1))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8098 ((eq header 'subject)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8099 (if (re-search-forward "^subject:\\s-+\\(.*\\)" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8100 (setq s (match-string 1)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8101 (if (string-match "\\`[ \t\]+" s) (setq s (replace-match "" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8102 (if (string-match "[ \t\]+\\'" s) (setq s (replace-match "" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8103 s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8104
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8105
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8106 (defun org-fixup-message-id-for-http (s)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8107 "Replace special characters in a message id, so it can be used in an http query."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8108 (while (string-match "<" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8109 (setq s (replace-match "%3C" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8110 (while (string-match ">" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8111 (setq s (replace-match "%3E" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8112 (while (string-match "@" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8113 (setq s (replace-match "%40" t t s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8114 s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8115
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8116 (defun org-insert-link (&optional complete-file)
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
8117 "Insert a link. At the prompt, enter the link.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8118
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8119 Completion can be used to select a link previously stored with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8120 `org-store-link'. When the empty string is entered (i.e. if you just
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8121 press RET at the prompt), the link defaults to the most recently
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8122 stored link. As SPC triggers completion in the minibuffer, you need to
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
8123 use M-SPC or C-q SPC to force the insertion of a space character.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8124
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8125 You will also be prompted for a description, and if one is given, it will
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8126 be displayed in the buffer instead of the link.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8127
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8128 If there is already a link at point, this command will allow you to edit link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8129 and description parts.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8130
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8131 With a \\[universal-argument] prefix, prompts for a file to link to. The file name can be
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8132 selected using completion. The path to the file will be relative to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8133 the current directory if the file is in the current directory or a
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8134 subdirectory. Otherwise, the link will be the absolute path as
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8135 completed in the minibuffer (i.e. normally ~/path/to/file).
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8136
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8137 With two \\[universal-argument] prefixes, enforce an absolute path even if the file
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8138 is in the current directory or below."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8139 (interactive "P")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8140 (let (link desc entry remove file (pos (point)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8141 (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8142 ((save-excursion
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8143 (skip-chars-forward "^]\n\r")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8144 (and (re-search-backward "\\[\\[" nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8145 (looking-at org-bracket-link-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8146 (<= (match-beginning 0) pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8147 (>= (match-end 0) pos)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8148 ;; We do have a link at point, and we are going to edit it.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8149 (setq remove (list (match-beginning 0) (match-end 0)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8150 (setq desc (if (match-end 3) (org-match-string-no-properties 3)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8151 (setq link (read-string "Link: "
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8152 (org-link-unescape
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8153 (org-match-string-no-properties 1)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8154 (complete-file
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8155 ;; Completing read for file names.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8156 (setq file (read-file-name "File: "))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8157 (let ((pwd (file-name-as-directory (expand-file-name "."))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8158 (cond
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8159 ((equal complete-file '(16))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8160 (setq link (org-make-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8161 "file:"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8162 (abbreviate-file-name (expand-file-name file)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8163 ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8164 (expand-file-name file))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8165 (setq link (org-make-link
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8166 "file:" (match-string 1 (expand-file-name file)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8167 (t (setq link (org-make-link "file:" file))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8168 (t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8169 ;; Read link, with completion for stored links.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8170 (setq link (org-completing-read
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8171 "Link: " org-stored-links nil nil nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8172 org-insert-link-history
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8173 (or (car (car org-stored-links)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8174 (setq entry (assoc link org-stored-links))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8175 (if (not org-keep-stored-link-after-insertion)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8176 (setq org-stored-links (delq (assoc link org-stored-links)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8177 org-stored-links)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8178 (setq link (if entry (nth 1 entry) link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8179 desc (or desc (nth 2 entry)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8180
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8181 (if (string-match org-plain-link-re link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8182 ;; URL-like link, normalize the use of angular brackets.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8183 (setq link (org-make-link (org-remove-angle-brackets link))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8184
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8185 ;; Check if we are linking to the current file. If yes, simplify the link.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8186 (when (string-match "\\<file:\\(.+?\\)::\\([^>]+\\)" link)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8187 (let* ((path (match-string 1 link))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8188 (case-fold-search nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8189 (search (match-string 2 link)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8190 (when (save-match-data
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8191 (equal (file-truename buffer-file-name)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8192 (file-truename path)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8193 ;; We are linking to this same file, with a search option
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8194 (setq link search))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8195 (setq desc (read-string "Description: " desc))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8196 (unless (string-match "\\S-" desc) (setq desc nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8197 (if remove (apply 'delete-region remove))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8198 (insert (org-make-link-string link desc))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8199
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8200 (defun org-completing-read (&rest args)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8201 (let ((minibuffer-local-completion-map
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8202 (copy-keymap minibuffer-local-completion-map)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8203 (define-key minibuffer-local-completion-map " " 'self-insert-command)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8204 (apply 'completing-read args)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8205
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8206 ;;; Hooks for remember.el
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8207
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8208 (defvar org-finish-function nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8209
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8210 ;;;###autoload
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8211 (defun org-remember-annotation ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8212 "Return a link to the current location as an annotation for remember.el.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8213 If you are using Org-mode files as target for data storage with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8214 remember.el, then the annotations should include a link compatible with the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8215 conventions in Org-mode. This function returns such a link."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8216 (org-store-link nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8217
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8218 (defconst org-remember-help
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8219 "Select a destination location for the note.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8220 UP/DOWN=headline TAB=cycle visibility [Q]uit RET/<left>/<right>=Store
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8221 RET at beg-of-buf -> Append to file as level 2 headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8222 RET on headline -> Store as sublevel entry to current headline
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8223 <left>/<right> -> before/after current headline, same headings level")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8224
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8225 ;;;###autoload
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8226 (defun org-remember-apply-template ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8227 "Initialize *remember* buffer with template, invode `org-mode'.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8228 This function should be placed into `remember-mode-hook' and in fact requires
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8229 to be run from that hook to fucntion properly."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8230 (when org-remember-templates
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8231 (let* ((entry (if (= (length org-remember-templates) 1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8232 (cdar org-remember-templates)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8233 (message "Select template: %s"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8234 (mapconcat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8235 (lambda (x) (char-to-string (car x)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8236 org-remember-templates " "))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8237 (cdr (assoc (read-char-exclusive) org-remember-templates))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8238 (tpl (if (consp (cdr entry)) (cadr entry) (cdr entry)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8239 (file (if (consp (cdr entry)) (nth 2 entry)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8240 (v-t (format-time-string (car org-time-stamp-formats) (org-current-time)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8241 (v-T (format-time-string (cdr org-time-stamp-formats) (org-current-time)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8242 (v-u (concat "[" (substring v-t 1 -1) "]"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8243 (v-U (concat "[" (substring v-T 1 -1) "]"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8244 (v-a annotation) ; defined in `remember-mode'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8245 (v-i initial) ; defined in `remember-mode'
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8246 (v-n user-full-name)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8247 )
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8248 (unless tpl (setq tpl "") (message "No template") (ding))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8249 (insert tpl) (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8250 (while (re-search-forward "%\\([tTuTai]\\)" nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8251 (when (and initial (equal (match-string 0) "%i"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8252 (save-match-data
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8253 (let* ((lead (buffer-substring
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8254 (point-at-bol) (match-beginning 0))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8255 (setq v-i (mapconcat 'identity
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8256 (org-split-string initial "\n")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8257 (concat "\n" lead))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8258 (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8259 (or (eval (intern (concat "v-" (match-string 1)))) "")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8260 t t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8261 (let ((org-startup-folded nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8262 (org-startup-with-deadline-check nil))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8263 (org-mode))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8264 (if (and file (string-match "\\S-" file) (not (file-directory-p file)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8265 (set (make-local-variable 'org-default-notes-file) file))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8266 (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8267 (if (re-search-forward "%\\?" nil t) (replace-match ""))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8268 (set (make-local-variable 'org-finish-function) 'remember-buffer))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8269
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8270 ;;;###autoload
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8271 (defun org-remember-handler ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8272 "Store stuff from remember.el into an org file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8273 First prompts for an org file. If the user just presses return, the value
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8274 of `org-default-notes-file' is used.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8275 Then the command offers the headings tree of the selected file in order to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8276 file the text at a specific location.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8277 You can either immediately press RET to get the note appended to the
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
8278 file, or you can use vertical cursor motion and visibility cycling (TAB) to
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8279 find a better place. Then press RET or <left> or <right> in insert the note.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8280
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8281 Key Cursor position Note gets inserted
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8282 -----------------------------------------------------------------------------
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8283 RET buffer-start as level 2 heading at end of file
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8284 RET on headline as sublevel of the heading at cursor
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8285 RET no heading at cursor position, level taken from context.
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8286 Or use prefix arg to specify level manually.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8287 <left> on headline as same level, before current heading
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8288 <right> on headline as same level, after current heading
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8289
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8290 So the fastest way to store the note is to press RET RET to append it to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8291 the default file. This way your current train of thought is not
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8292 interrupted, in accordance with the principles of remember.el. But with
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8293 little extra effort, you can push it directly to the correct location.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8294
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8295 Before being stored away, the function ensures that the text has a
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8296 headline, i.e. a first line that starts with a \"*\". If not, a headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8297 is constructed from the current date and some additional data.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8298
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8299 If the variable `org-adapt-indentation' is non-nil, the entire text is
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8300 also indented so that it starts in the same column as the headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8301 \(i.e. after the stars).
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8302
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
8303 See also the variable `org-reverse-note-order'."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8304 (catch 'quit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8305 (let* ((txt (buffer-substring (point-min) (point-max)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8306 (fastp current-prefix-arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8307 (file (if fastp org-default-notes-file (org-get-org-file)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8308 (visiting (find-buffer-visiting file))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8309 (org-startup-with-deadline-check nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8310 (org-startup-folded nil)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8311 (org-startup-align-all-tables nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8312 spos level indent reversed)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8313 ;; Modify text so that it becomes a nice subtree which can be inserted
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8314 ;; into an org tree.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8315 (let* ((lines (split-string txt "\n"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8316 first)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8317 ;; remove empty lines at the beginning
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8318 (while (and lines (string-match "^[ \t]*\n" (car lines)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8319 (setq lines (cdr lines)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8320 (setq first (car lines) lines (cdr lines))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8321 (if (string-match "^\\*+" first)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8322 ;; Is already a headline
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8323 (setq indent nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8324 ;; We need to add a headline: Use time and first buffer line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8325 (setq lines (cons first lines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8326 first (concat "* " (current-time-string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8327 " (" (remember-buffer-desc) ")")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8328 indent " "))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8329 (if (and org-adapt-indentation indent)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8330 (setq lines (mapcar (lambda (x) (concat indent x)) lines)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8331 (setq txt (concat first "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8332 (mapconcat 'identity lines "\n"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8333 ;; Find the file
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8334 (if (not visiting)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8335 (find-file-noselect file))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8336 (with-current-buffer (get-file-buffer file)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8337 (setq reversed (org-notes-order-reversed-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8338 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8339 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8340 (widen)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8341 ;; Ask the User for a location
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8342 (setq spos (if fastp 1 (org-get-location
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8343 (current-buffer)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8344 org-remember-help)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8345 (if (not spos) (throw 'quit nil)) ; return nil to show we did
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8346 ; not handle this note
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8347 (goto-char spos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8348 (cond ((bobp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8349 ;; Put it at the start or end, as level 2
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8350 (save-restriction
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8351 (widen)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8352 (goto-char (if reversed (point-min) (point-max)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8353 (if (not (bolp)) (newline))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8354 (org-paste-subtree 2 txt)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8355 ((and (org-on-heading-p nil) (not current-prefix-arg))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8356 ;; Put it below this entry, at the beg/end of the subtree
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8357 (org-back-to-heading)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
8358 (setq level (funcall outline-level))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8359 (if reversed
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8360 (outline-end-of-heading)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8361 (outline-end-of-subtree))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8362 (if (not (bolp)) (newline))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8363 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8364 (org-paste-subtree (1+ level) txt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8365 (t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8366 ;; Put it right there, with automatic level determined by
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8367 ;; org-paste-subtree or from prefix arg
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8368 (org-paste-subtree current-prefix-arg txt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8369 (when remember-save-after-remembering
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8370 (save-buffer)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8371 (if (not visiting) (kill-buffer (current-buffer)))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8372 t) ;; return t to indicate that we took care of this note.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8373
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8374 (defun org-get-org-file ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8375 "Read a filename, with default directory `org-directory'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8376 (let ((default (or org-default-notes-file remember-data-file)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8377 (read-file-name (format "File name [%s]: " default)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8378 (file-name-as-directory org-directory)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8379 default)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8380
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8381 (defun org-notes-order-reversed-p ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8382 "Check if the current file should receive notes in reversed order."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8383 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8384 ((not org-reverse-note-order) nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8385 ((eq t org-reverse-note-order) t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8386 ((not (listp org-reverse-note-order)) nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8387 (t (catch 'exit
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8388 (let ((all org-reverse-note-order)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8389 entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8390 (while (setq entry (pop all))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
8391 (if (string-match (car entry) buffer-file-name)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8392 (throw 'exit (cdr entry))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8393 nil)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8394
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8395 ;;; Tables
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8396
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8397 ;; Watch out: Here we are talking about two different kind of tables.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8398 ;; Most of the code is for the tables created with the Org-mode table editor.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8399 ;; Sometimes, we talk about tables created and edited with the table.el
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8400 ;; Emacs package. We call the former org-type tables, and the latter
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8401 ;; table.el-type tables.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8402
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8403
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8404 (defun org-before-change-function (beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8405 "Every change indicates that a table might need an update."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8406 (setq org-table-may-need-update t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8407
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8408 (defconst org-table-line-regexp "^[ \t]*|"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8409 "Detects an org-type table line.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8410 (defconst org-table-dataline-regexp "^[ \t]*|[^-]"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8411 "Detects an org-type table line.")
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8412 (defconst org-table-auto-recalculate-regexp "^[ \t]*| *# *\\(|\\|$\\)"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8413 "Detects a table line marked for automatic recalculation.")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8414 (defconst org-table-recalculate-regexp "^[ \t]*| *[#*] *\\(|\\|$\\)"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8415 "Detects a table line marked for automatic recalculation.")
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
8416 (defconst org-table-calculate-mark-regexp "^[ \t]*| *[!$^_#*] *\\(|\\|$\\)"
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
8417 "Detects a table line marked for automatic recalculation.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8418 (defconst org-table-hline-regexp "^[ \t]*|-"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8419 "Detects an org-type table hline.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8420 (defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8421 "Detects a table-type table hline.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8422 (defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)"
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8423 "Detects an org-type or table-type table.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8424 (defconst org-table-border-regexp "^[ \t]*[^| \t]"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8425 "Searching from within a table (any type) this finds the first line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8426 outside the table.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8427 (defconst org-table-any-border-regexp "^[ \t]*[^|+ \t]"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8428 "Searching from within a table (any type) this finds the first line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8429 outside the table.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8430
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8431 (defun org-table-create-with-table.el ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8432 "Use the table.el package to insert a new table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8433 If there is already a table at point, convert between Org-mode tables
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8434 and table.el tables."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8435 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8436 (require 'table)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8437 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8438 ((org-at-table.el-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8439 (if (y-or-n-p "Convert table to Org-mode table? ")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8440 (org-table-convert)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8441 ((org-at-table-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8442 (if (y-or-n-p "Convert table to table.el table? ")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8443 (org-table-convert)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8444 (t (call-interactively 'table-insert))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8445
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8446 (defun org-table-create-or-convert-from-region (arg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8447 "Convert region to table, or create an empty table.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8448 If there is an active region, convert it to a table. If there is no such
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8449 region, create an empty table."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8450 (interactive "P")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8451 (if (org-region-active-p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8452 (org-table-convert-region (region-beginning) (region-end) arg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8453 (org-table-create arg)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8454
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8455 (defun org-table-create (&optional size)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8456 "Query for a size and insert a table skeleton.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8457 SIZE is a string Columns x Rows like for example \"3x2\"."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8458 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8459 (unless size
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8460 (setq size (read-string
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8461 (concat "Table size Columns x Rows [e.g. "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8462 org-table-default-size "]: ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8463 "" nil org-table-default-size)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8464
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8465 (let* ((pos (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8466 (indent (make-string (current-column) ?\ ))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8467 (split (org-split-string size " *x *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8468 (rows (string-to-number (nth 1 split)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8469 (columns (string-to-number (car split)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8470 (line (concat (apply 'concat indent "|" (make-list columns " |"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8471 "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8472 (if (string-match "^[ \t]*$" (buffer-substring-no-properties
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8473 (point-at-bol) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8474 (beginning-of-line 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8475 (newline))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8476 ;; (mapcar (lambda (x) (insert line)) (make-list rows t))
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8477 (dotimes (i rows) (insert line))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8478 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8479 (if (> rows 1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8480 ;; Insert a hline after the first row.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8481 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8482 (end-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8483 (insert "\n|-")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8484 (goto-char pos)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8485 (org-table-align)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8486
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8487 (defun org-table-convert-region (beg0 end0 &optional nspace)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8488 "Convert region to a table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8489 The region goes from BEG0 to END0, but these borders will be moved
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8490 slightly, to make sure a beginning of line in the first line is included.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8491 When NSPACE is non-nil, it indicates the minimum number of spaces that
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
8492 separate columns (default: just one space)."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8493 (interactive "rP")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8494 (let* ((beg (min beg0 end0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8495 (end (max beg0 end0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8496 (tabsep t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8497 re)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8498 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8499 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8500 (setq beg (move-marker (make-marker) (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8501 (goto-char end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8502 (if (bolp) (backward-char 1) (end-of-line 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8503 (setq end (move-marker (make-marker) (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8504 ;; Lets see if this is tab-separated material. If every nonempty line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8505 ;; contains a tab, we will assume that it is tab-separated material
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8506 (if nspace
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8507 (setq tabsep nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8508 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8509 (and (re-search-forward "^[^\n\t]+$" end t) (setq tabsep nil)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8510 (if nspace (setq tabsep nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8511 (if tabsep
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8512 (setq re "^\\|\t")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8513 (setq re (format "^ *\\| *\t *\\| \\{%d,\\}"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8514 (max 1 (prefix-numeric-value nspace)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8515 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8516 (while (re-search-forward re end t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8517 (replace-match "|" t t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8518 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8519 (insert " ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8520 (org-table-align)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8521
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8522 (defun org-table-import (file arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8523 "Import FILE as a table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8524 The file is assumed to be tab-separated. Such files can be produced by most
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8525 spreadsheet and database applications. If no tabs (at least one per line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8526 are found, lines will be split on whitespace into fields."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8527 (interactive "f\nP")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8528 (or (bolp) (newline))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8529 (let ((beg (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8530 (pm (point-max)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8531 (insert-file-contents file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8532 (org-table-convert-region beg (+ (point) (- (point-max) pm)) arg)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8533
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8534 (defun org-table-export ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8535 "Export table as a tab-separated file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8536 Such a file can be imported into a spreadsheet program like Excel."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8537 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8538 (let* ((beg (org-table-begin))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8539 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8540 (table (buffer-substring beg end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8541 (file (read-file-name "Export table to: "))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8542 buf)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8543 (unless (or (not (file-exists-p file))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8544 (y-or-n-p (format "Overwrite file %s? " file)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8545 (error "Abort"))
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8546 (with-current-buffer (find-file-noselect file)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8547 (setq buf (current-buffer))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8548 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8549 (fundamental-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8550 (insert table)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8551 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8552 (while (re-search-forward "^[ \t]*|[ \t]*" nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8553 (replace-match "" t t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8554 (end-of-line 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8555 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8556 (while (re-search-forward "[ \t]*|[ \t]*$" nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8557 (replace-match "" t t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8558 (goto-char (min (1+ (point)) (point-max))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8559 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8560 (while (re-search-forward "^-[-+]*$" nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8561 (replace-match "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8562 (if (looking-at "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8563 (delete-char 1)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8564 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8565 (while (re-search-forward "[ \t]*|[ \t]*" nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8566 (replace-match "\t" t t))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8567 (save-buffer))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8568 (kill-buffer buf)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8569
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8570 (defvar org-table-aligned-begin-marker (make-marker)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8571 "Marker at the beginning of the table last aligned.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8572 Used to check if cursor still is in that table, to minimize realignment.")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8573 (defvar org-table-aligned-end-marker (make-marker)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8574 "Marker at the end of the table last aligned.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8575 Used to check if cursor still is in that table, to minimize realignment.")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8576 (defvar org-table-last-alignment nil
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8577 "List of flags for flushright alignment, from the last re-alignment.
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8578 This is being used to correctly align a single field after TAB or RET.")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8579 (defvar org-table-last-column-widths nil
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8580 "List of max width of fields in each column.
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8581 This is being used to correctly align a single field after TAB or RET.")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8582
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8583 (defvar org-last-recalc-line nil)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8584 (defconst org-narrow-column-arrow "=>"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8585 "Used as display property in narrowed table columns.")
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8586
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8587 (defun org-table-align ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8588 "Align the table at point by aligning all vertical bars."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8589 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8590 (let* (
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8591 ;; Limits of table
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8592 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8593 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8594 ;; Current cursor position
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8595 (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8596 (colpos (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8597 (winstart (window-start))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8598 text lines (new "") lengths l typenums ty fields maxfields i
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8599 column
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8600 (indent "") cnt frac
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8601 rfmt hfmt
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8602 (spaces '(1 . 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8603 (sp1 (car spaces))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8604 (sp2 (cdr spaces))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8605 (rfmt1 (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8606 (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8607 (hfmt1 (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8608 (make-string sp2 ?-) "%s" (make-string sp1 ?-) "+"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8609 emptystrings xx links narrow fmax fmin f1 len c e)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8610 (untabify beg end)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8611 (remove-text-properties beg end '(org-cwidth t display t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8612 ;; Check if we have links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8613 (goto-char beg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8614 (setq links (re-search-forward org-bracket-link-regexp end t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8615 ;; Make sure the link properties are right FIXME: Can this be optimized????
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8616 (when links (goto-char beg) (while (org-activate-bracket-links end)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8617 ;; Check if we are narrowing any columns
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8618 (goto-char beg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8619 (setq narrow (and org-format-transports-properties-p
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8620 (re-search-forward "<[0-9]+>" end t)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8621 ;; Get the rows
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8622 (setq lines (org-split-string
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8623 (buffer-substring beg end) "\n"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8624 ;; Store the indentation of the first line
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8625 (if (string-match "^ *" (car lines))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8626 (setq indent (make-string (- (match-end 0) (match-beginning 0)) ?\ )))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8627 ;; Mark the hlines by setting the corresponding element to nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8628 ;; At the same time, we remove trailing space.
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8629 (setq lines (mapcar (lambda (l)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8630 (if (string-match "^ *|-" l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8631 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8632 (if (string-match "[ \t]+$" l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8633 (substring l 0 (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8634 l)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8635 lines))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8636 ;; Get the data fields by splitting the lines.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8637 (setq fields (mapcar
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8638 (lambda (l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8639 (org-split-string l " *| *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8640 (delq nil (copy-sequence lines))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8641 ;; How many fields in the longest line?
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8642 (condition-case nil
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8643 (setq maxfields (apply 'max (mapcar 'length fields)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8644 (error
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8645 (kill-region beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8646 (org-table-create org-table-default-size)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8647 (error "Empty table - created default table")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8648 ;; A list of empty string to fill any short rows on output
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8649 (setq emptystrings (make-list maxfields ""))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8650 ;; Check for special formatting.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8651 (setq i -1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8652 (while (< (setq i (1+ i)) maxfields) ;; Loop over all columns
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8653 (setq column (mapcar (lambda (x) (or (nth i x) "")) fields))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8654 ;; Check if there is an explicit width specified
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8655 (when (and org-table-limit-column-width narrow)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8656 (setq c column fmax nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8657 (while c
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8658 (setq e (pop c))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8659 (if (and (stringp e) (string-match "^<\\([0-9]+\\)>$" e))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8660 (setq fmax (string-to-number (match-string 1 e)) c nil)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8661 ;; Find fields that are wider than fmax, and shorten them
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8662 (when fmax
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8663 (loop for xx in column do
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8664 (when (and (stringp xx)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8665 (> (org-string-width xx) fmax))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8666 (org-add-props xx nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8667 'help-echo
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8668 (concat "Clipped table field, use C-c ` to edit. Full value is:\n" (copy-sequence xx)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8669 (setq f1 (min fmax (or (string-match org-bracket-link-regexp xx) fmax)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8670 (unless (> f1 1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8671 (error "Cannot narrow field starting with wide link \"%s\""
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8672 (match-string 0 xx)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8673 (add-text-properties f1 (length xx) (list 'org-cwidth t) xx)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8674 (add-text-properties (- f1 2) f1
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8675 (list 'display org-narrow-column-arrow)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8676 xx)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8677 ;; Get the maximum width for each column
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8678 (push (apply 'max 1 (mapcar 'org-string-width column)) lengths)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8679 ;; Get the fraction of numbers, to decide about alignment of the column
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8680 (setq cnt 0 frac 0.0)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8681 (loop for x in column do
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8682 (if (equal x "")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8683 nil
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8684 (setq frac ( / (+ (* frac cnt)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8685 (if (string-match org-table-number-regexp x) 1 0))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8686 (setq cnt (1+ cnt))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8687 (push (>= frac org-table-number-fraction) typenums))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8688 (setq lengths (nreverse lengths) typenums (nreverse typenums))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8689
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8690 ;; Store the alignment of this table, for later editing of single fields
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8691 (setq org-table-last-alignment typenums
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8692 org-table-last-column-widths lengths)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8693
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8694 ;; With invisible characters, `format' does not get the field width right
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8695 ;; So we need to make these fields wide by hand.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8696 (when links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8697 (loop for i from 0 upto (1- maxfields) do
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8698 (setq len (nth i lengths))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8699 (loop for j from 0 upto (1- (length fields)) do
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8700 (setq c (nthcdr i (car (nthcdr j fields))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8701 (if (and (stringp (car c))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8702 (string-match org-bracket-link-regexp (car c))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8703 (< (org-string-width (car c)) len))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8704 (setcar c (concat (car c) (make-string (- len (org-string-width (car c))) ?\ )))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8705
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8706 ;; Compute the formats needed for output of the table
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8707 (setq rfmt (concat indent "|") hfmt (concat indent "|"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8708 (while (setq l (pop lengths))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8709 (setq ty (if (pop typenums) "" "-")) ; number types flushright
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8710 (setq rfmt (concat rfmt (format rfmt1 ty l))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8711 hfmt (concat hfmt (format hfmt1 (make-string l ?-)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8712 (setq rfmt (concat rfmt "\n")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8713 hfmt (concat (substring hfmt 0 -1) "|\n"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8714
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
8715 (setq new (mapconcat
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8716 (lambda (l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8717 (if l (apply 'format rfmt
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8718 (append (pop fields) emptystrings))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8719 hfmt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8720 lines ""))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8721 ;; Replace the old one
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8722 (delete-region beg end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8723 (move-marker end nil)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8724 (move-marker org-table-aligned-begin-marker (point))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8725 (insert new)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8726 (move-marker org-table-aligned-end-marker (point))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8727 (when (and orgtbl-mode (not (eq major-mode 'org-mode)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8728 (goto-char org-table-aligned-begin-marker)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8729 (while (org-hide-wide-columns org-table-aligned-end-marker)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8730 ;; Try to move to the old location (approximately)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8731 (goto-line linepos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8732 (set-window-start (selected-window) winstart 'noforce)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8733 (org-table-goto-column colpos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8734 (setq org-table-may-need-update nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8735 ))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8736
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8737 (defun org-string-width (s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8738 "Compute width of string, ignoring invisible characters.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8739 This ignores character with invisibility property `org-link', and also
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8740 characters with property `org-cwidth', because these will become invisible
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8741 upon the next fontification round."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8742 (let (b)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8743 (when (or (eq t buffer-invisibility-spec)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8744 (assq 'org-link buffer-invisibility-spec))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8745 (while (setq b (text-property-any 0 (length s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8746 'invisible 'org-link s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8747 (setq s (concat (substring s 0 b)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8748 (substring s (or (next-single-property-change
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8749 b 'invisible s) (length s)))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8750 (while (setq b (text-property-any 0 (length s) 'org-cwidth t s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8751 (setq s (concat (substring s 0 b)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8752 (substring s (or (next-single-property-change
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8753 b 'org-cwidth s) (length s))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8754 (string-width s)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8755
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8756 (defun org-table-begin (&optional table-type)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8757 "Find the beginning of the table and return its position.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8758 With argument TABLE-TYPE, go to the beginning of a table.el-type table."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8759 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8760 (if (not (re-search-backward
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8761 (if table-type org-table-any-border-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8762 org-table-border-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8763 nil t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8764 (error "Can't find beginning of table")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8765 (goto-char (match-beginning 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8766 (beginning-of-line 2)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8767 (point))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8768
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8769 (defun org-table-end (&optional table-type)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8770 "Find the end of the table and return its position.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8771 With argument TABLE-TYPE, go to the end of a table.el-type table."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8772 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8773 (if (not (re-search-forward
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8774 (if table-type org-table-any-border-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8775 org-table-border-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8776 nil t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8777 (goto-char (point-max))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8778 (goto-char (match-beginning 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8779 (point-marker)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8780
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8781 (defun org-table-justify-field-maybe (&optional new)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8782 "Justify the current field, text to left, number to right.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8783 Optional argument NEW may specify text to replace the current field content."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8784 (cond
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8785 ((and (not new) org-table-may-need-update)) ; Realignment will happen anyway
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8786 ((org-at-table-hline-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8787 ((and (not new)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8788 (or (not (equal (marker-buffer org-table-aligned-begin-marker)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8789 (current-buffer)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8790 (< (point) org-table-aligned-begin-marker)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8791 (>= (point) org-table-aligned-end-marker)))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8792 ;; This is not the same table, force a full re-align
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8793 (setq org-table-may-need-update t))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8794 (t ;; realign the current field, based on previous full realign
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8795 (let* ((pos (point)) s
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8796 (col (org-table-current-column))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8797 (num (if (> col 0) (nth (1- col) org-table-last-alignment)))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
8798 l f n o e)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8799 (when (> col 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8800 (skip-chars-backward "^|\n")
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
8801 (if (looking-at " *\\([^|\n]*?\\) *\\(|\\|$\\)")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8802 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8803 (setq s (match-string 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8804 o (match-string 0)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
8805 l (max 1 (- (match-end 0) (match-beginning 0) 3))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
8806 e (not (= (match-beginning 2) (match-end 2))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
8807 (setq f (format (if num " %%%ds %s" " %%-%ds %s")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
8808 l (if e "|" (setq org-table-may-need-update t) ""))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8809 n (format f s t t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8810 (if new
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8811 (if (<= (length new) l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8812 (setq n (format f new t t)) ;; FIXME: why t t?????
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8813 (setq n (concat new "|") org-table-may-need-update t)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8814 (or (equal n o)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8815 (let (org-table-may-need-update)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8816 (replace-match n))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8817 (setq org-table-may-need-update t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8818 (goto-char pos))))))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8819
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8820 (defun org-table-next-field ()
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8821 "Go to the next field in the current table, creating new lines as needed.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8822 Before doing so, re-align the table if necessary."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8823 (interactive)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8824 (org-table-maybe-eval-formula)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8825 (org-table-maybe-recalculate-line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8826 (if (and org-table-automatic-realign
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8827 org-table-may-need-update)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8828 (org-table-align))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8829 (let ((end (org-table-end)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8830 (if (org-at-table-hline-p)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8831 (end-of-line 1))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8832 (condition-case nil
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8833 (progn
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8834 (re-search-forward "|" end)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8835 (if (looking-at "[ \t]*$")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8836 (re-search-forward "|" end))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8837 (if (and (looking-at "-")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8838 org-table-tab-jumps-over-hlines
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8839 (re-search-forward "^[ \t]*|\\([^-]\\)" end t))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8840 (goto-char (match-beginning 1)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8841 (if (looking-at "-")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8842 (progn
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8843 (beginning-of-line 0)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8844 (org-table-insert-row 'below))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8845 (if (looking-at " ") (forward-char 1))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8846 (error
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8847 (org-table-insert-row 'below)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8848
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8849 (defun org-table-previous-field ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8850 "Go to the previous field in the table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8851 Before doing so, re-align the table if necessary."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8852 (interactive)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8853 (org-table-justify-field-maybe)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8854 (org-table-maybe-recalculate-line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8855 (if (and org-table-automatic-realign
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8856 org-table-may-need-update)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8857 (org-table-align))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8858 (if (org-at-table-hline-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8859 (end-of-line 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8860 (re-search-backward "|" (org-table-begin))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8861 (re-search-backward "|" (org-table-begin))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8862 (while (looking-at "|\\(-\\|[ \t]*$\\)")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8863 (re-search-backward "|" (org-table-begin)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8864 (if (looking-at "| ?")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8865 (goto-char (match-end 0))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8866
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8867 (defun org-table-next-row ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8868 "Go to the next row (same column) in the current table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8869 Before doing so, re-align the table if necessary."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8870 (interactive)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8871 (org-table-maybe-eval-formula)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8872 (org-table-maybe-recalculate-line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8873 (if (or (looking-at "[ \t]*$")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8874 (save-excursion (skip-chars-backward " \t") (bolp)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8875 (newline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8876 (if (and org-table-automatic-realign
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8877 org-table-may-need-update)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8878 (org-table-align))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8879 (let ((col (org-table-current-column)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8880 (beginning-of-line 2)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8881 (if (or (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8882 (org-at-table-hline-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8883 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8884 (beginning-of-line 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8885 (org-table-insert-row 'below)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8886 (org-table-goto-column col)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8887 (skip-chars-backward "^|\n\r")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8888 (if (looking-at " ") (forward-char 1)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8889
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8890 (defun org-table-copy-down (n)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8891 "Copy a field down in the current column.
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8892 If the field at the cursor is empty, copy into it the content of the nearest
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8893 non-empty field above. With argument N, use the Nth non-empty field.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
8894 If the current field is not empty, it is copied down to the next row, and
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8895 the cursor is moved with it. Therefore, repeating this command causes the
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
8896 column to be filled row-by-row.
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8897 If the variable `org-table-copy-increment' is non-nil and the field is an
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8898 integer, it will be incremented while copying."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8899 (interactive "p")
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
8900 (let* ((colpos (org-table-current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8901 (field (org-table-get-field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8902 (non-empty (string-match "[^ \t]" field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8903 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8904 txt)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8905 (org-table-check-inside-data-field)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8906 (if non-empty
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8907 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8908 (setq txt (org-trim field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8909 (org-table-next-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8910 (org-table-blank-field))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8911 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8912 (setq txt
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8913 (catch 'exit
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8914 (while (progn (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8915 (re-search-backward org-table-dataline-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8916 beg t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8917 (org-table-goto-column colpos t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8918 (if (and (looking-at
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8919 "|[ \t]*\\([^| \t][^|]*?\\)[ \t]*|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8920 (= (setq n (1- n)) 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8921 (throw 'exit (match-string 1))))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8922 (if txt
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8923 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8924 (if (and org-table-copy-increment
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8925 (string-match "^[0-9]+$" txt))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
8926 (setq txt (format "%d" (+ (string-to-number txt) 1))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8927 (insert txt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8928 (org-table-maybe-recalculate-line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8929 (org-table-align))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8930 (error "No non-empty field found"))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8931
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8932 (defun org-table-check-inside-data-field ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8933 "Is point inside a table data field?
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
8934 I.e. not on a hline or before the first or after the last column?
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
8935 This actually throws an error, so it aborts the current command."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8936 (if (or (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8937 (= (org-table-current-column) 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8938 (org-at-table-hline-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8939 (looking-at "[ \t]*$"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8940 (error "Not in table data field")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8941
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8942 (defvar org-table-clip nil
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
8943 "Clipboard for table regions.")
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
8944
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8945 (defun org-table-blank-field ()
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8946 "Blank the current table field or active region."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8947 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8948 (org-table-check-inside-data-field)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8949 (if (and (interactive-p) (org-region-active-p))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8950 (let (org-table-clip)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8951 (org-table-cut-region (region-beginning) (region-end)))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8952 (skip-chars-backward "^|")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
8953 (backward-char 1)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8954 (if (looking-at "|[^|\n]+")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8955 (let* ((pos (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8956 (match (match-string 0))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
8957 (len (org-string-width match)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8958 (replace-match (concat "|" (make-string (1- len) ?\ )))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8959 (goto-char (+ 2 pos))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8960 (substring match 1)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8961
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8962 (defun org-table-get-field (&optional n replace)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8963 "Return the value of the field in column N of current row.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8964 N defaults to current field.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8965 If REPLACE is a string, replace field with this value. The return value
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8966 is always the old value."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8967 (and n (org-table-goto-column n))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8968 (skip-chars-backward "^|\n")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8969 (backward-char 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8970 (if (looking-at "|[^|\r\n]*")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8971 (let* ((pos (match-beginning 0))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8972 (val (buffer-substring (1+ pos) (match-end 0))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8973 (if replace
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8974 (replace-match (concat "|" replace)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8975 (goto-char (min (point-at-eol) (+ 2 pos)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8976 val)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
8977 (forward-char 1) ""))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8978
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8979 (defun org-table-current-column ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8980 "Find out which column we are in.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8981 When called interactively, column is also displayed in echo area."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8982 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8983 (if (interactive-p) (org-table-check-inside-data-field))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8984 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8985 (let ((cnt 0) (pos (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8986 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8987 (while (search-forward "|" pos t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
8988 (setq cnt (1+ cnt)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8989 (if (interactive-p) (message "This is table column %d" cnt))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8990 cnt)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8991
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8992 (defun org-table-goto-column (n &optional on-delim force)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8993 "Move the cursor to the Nth column in the current table line.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8994 With optional argument ON-DELIM, stop with point before the left delimiter
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
8995 of the field.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8996 If there are less than N fields, just go to after the last delimiter.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8997 However, when FORCE is non-nil, create new columns if necessary."
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
8998 (interactive "p")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8999 (let ((pos (point-at-eol)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9000 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9001 (when (> n 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9002 (while (and (> (setq n (1- n)) -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9003 (or (search-forward "|" pos t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9004 (and force
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9005 (progn (end-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9006 (skip-chars-backward "^|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9007 (insert " | "))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9008 ; (backward-char 2) t)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9009 (when (and force (not (looking-at ".*|")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9010 (save-excursion (end-of-line 1) (insert " | ")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9011 (if on-delim
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9012 (backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9013 (if (looking-at " ") (forward-char 1))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9014
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9015 (defun org-at-table-p (&optional table-type)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
9016 "Return t if the cursor is inside an org-type table.
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9017 If TABLE-TYPE is non-nil, also check for table.el-type tables."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9018 (if org-enable-table-editor
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9019 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9020 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9021 (looking-at (if table-type org-table-any-line-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9022 org-table-line-regexp)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9023 nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9024
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9025 (defun org-at-table.el-p ()
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9026 "Return t if and only if we are at a table.el table."
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9027 (and (org-at-table-p 'any)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9028 (save-excursion
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9029 (goto-char (org-table-begin 'any))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9030 (looking-at org-table1-hline-regexp))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9031
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9032 (defun org-table-recognize-table.el ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9033 "If there is a table.el table nearby, recognize it and move into it."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9034 (if org-table-tab-recognizes-table.el
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9035 (if (org-at-table.el-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9036 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9037 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9038 (if (looking-at org-table-dataline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9039 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9040 (if (looking-at org-table1-hline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9041 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9042 (beginning-of-line 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9043 (if (looking-at org-table-any-border-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9044 (beginning-of-line -1)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9045 (if (re-search-forward "|" (org-table-end t) t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9046 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9047 (require 'table)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9048 (if (table--at-cell-p (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9049 t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9050 (message "recognizing table.el table...")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9051 (table-recognize-table)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9052 (message "recognizing table.el table...done")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9053 (error "This should not happen..."))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9054 t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9055 nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9056 nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9057
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9058 (defun org-at-table-hline-p ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9059 "Return t if the cursor is inside a hline in a table."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9060 (if org-enable-table-editor
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9061 (save-excursion
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9062 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9063 (looking-at org-table-hline-regexp))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9064 nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9065
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9066 (defun org-table-insert-column ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9067 "Insert a new column into the table."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9068 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9069 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9070 (error "Not at a table"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9071 (org-table-find-dataline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9072 (let* ((col (max 1 (org-table-current-column)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9073 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9074 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9075 ;; Current cursor position
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9076 (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9077 (colpos col))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9078 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9079 (while (< (point) end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9080 (if (org-at-table-hline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9081 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9082 (org-table-goto-column col t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9083 (insert "| "))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9084 (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9085 (move-marker end nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9086 (goto-line linepos)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9087 (org-table-goto-column colpos)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9088 (org-table-align)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9089 (org-table-modify-formulas 'insert col)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9090
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9091 (defun org-table-find-dataline ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9092 "Find a dataline in the current table, which is needed for column commands."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9093 (if (and (org-at-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9094 (not (org-at-table-hline-p)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9095 t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9096 (let ((col (current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9097 (end (org-table-end)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9098 (move-to-column col)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9099 (while (and (< (point) end)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9100 (or (not (= (current-column) col))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9101 (org-at-table-hline-p)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9102 (beginning-of-line 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9103 (move-to-column col))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9104 (if (and (org-at-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9105 (not (org-at-table-hline-p)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9106 t
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9107 (error
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9108 "Please position cursor in a data line for column operations")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9109
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9110 (defun org-table-delete-column ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
9111 "Delete a column into the table."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9112 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9113 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9114 (error "Not at a table"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9115 (org-table-find-dataline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9116 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9117 (let* ((col (org-table-current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9118 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9119 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9120 ;; Current cursor position
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9121 (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9122 (colpos col))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9123 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9124 (while (< (point) end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9125 (if (org-at-table-hline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9126 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9127 (org-table-goto-column col t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9128 (and (looking-at "|[^|\n]+|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9129 (replace-match "|")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9130 (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9131 (move-marker end nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9132 (goto-line linepos)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9133 (org-table-goto-column colpos)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9134 (org-table-align)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9135 (org-table-modify-formulas 'remove col)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9136
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9137 (defun org-table-move-column-right ()
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9138 "Move column to the right."
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9139 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9140 (org-table-move-column nil))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9141 (defun org-table-move-column-left ()
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9142 "Move column to the left."
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9143 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9144 (org-table-move-column 'left))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9145
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9146 (defun org-table-move-column (&optional left)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9147 "Move the current column to the right. With arg LEFT, move to the left."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9148 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9149 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9150 (error "Not at a table"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9151 (org-table-find-dataline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9152 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9153 (let* ((col (org-table-current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9154 (col1 (if left (1- col) col))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9155 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9156 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9157 ;; Current cursor position
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9158 (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9159 (colpos (if left (1- col) (1+ col))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9160 (if (and left (= col 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9161 (error "Cannot move column further left"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9162 (if (and (not left) (looking-at "[^|\n]*|[^|\n]*$"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9163 (error "Cannot move column further right"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9164 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9165 (while (< (point) end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9166 (if (org-at-table-hline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9167 nil
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9168 (org-table-goto-column col1 t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9169 (and (looking-at "|\\([^|\n]+\\)|\\([^|\n]+\\)|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9170 (replace-match "|\\2|\\1|")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9171 (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9172 (move-marker end nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9173 (goto-line linepos)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9174 (org-table-goto-column colpos)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9175 (org-table-align)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9176 (org-table-modify-formulas 'swap col (if left (1- col) (1+ col)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9177
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9178 (defun org-table-move-row-down ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9179 "Move table row down."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9180 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9181 (org-table-move-row nil))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9182 (defun org-table-move-row-up ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9183 "Move table row up."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9184 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9185 (org-table-move-row 'up))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9186
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9187 (defun org-table-move-row (&optional up)
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
9188 "Move the current table line down. With arg UP, move it up."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9189 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9190 (let ((col (current-column))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9191 (pos (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9192 (tonew (if up 0 2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9193 txt)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9194 (beginning-of-line tonew)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9195 (if (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9196 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9197 (goto-char pos)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9198 (error "Cannot move row further")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9199 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9200 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9201 (setq pos (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9202 (setq txt (buffer-substring (point) (1+ (point-at-eol))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9203 (delete-region (point) (1+ (point-at-eol)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9204 (beginning-of-line tonew)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9205 (insert txt)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9206 (beginning-of-line 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9207 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9208
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9209 (defun org-table-insert-row (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9210 "Insert a new row above the current line into the table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9211 With prefix ARG, insert below the current line."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9212 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9213 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9214 (error "Not at a table"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9215 (let* ((line (buffer-substring (point-at-bol) (point-at-eol)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9216 (new (org-table-clean-line line)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9217 ;; Fix the first field if necessary
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9218 (if (string-match "^[ \t]*| *[#$] *|" line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9219 (setq new (replace-match (match-string 0 line) t t new)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9220 (beginning-of-line (if arg 2 1))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9221 (let (org-table-may-need-update) (insert-before-markers new "\n"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9222 (beginning-of-line 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9223 (re-search-forward "| ?" (point-at-eol) t)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
9224 (and org-table-may-need-update (org-table-align))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9225
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9226 (defun org-table-insert-hline (&optional arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9227 "Insert a horizontal-line below the current line into the table.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9228 With prefix ARG, insert above the current line."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9229 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9230 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9231 (error "Not at a table"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9232 (let ((line (org-table-clean-line
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9233 (buffer-substring (point-at-bol) (point-at-eol))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9234 (col (current-column)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9235 (while (string-match "|\\( +\\)|" line)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9236 (setq line (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9237 (concat "+" (make-string (- (match-end 1) (match-beginning 1))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9238 ?-) "|") t t line)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9239 (and (string-match "\\+" line) (setq line (replace-match "|" t t line)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9240 (beginning-of-line (if arg 1 2))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9241 (insert line "\n")
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9242 (beginning-of-line (if arg 1 -1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9243 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9244
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9245 (defun org-table-clean-line (s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9246 "Convert a table line S into a string with only \"|\" and space.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9247 In particular, this does handle wide and invisible characters."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9248 (if (string-match "^[ \t]*|-" s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9249 ;; It's a hline, just map the characters
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9250 (setq s (mapcar (lambda (x) (if (member x '(?| ?+)) ?| ?\ )) s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9251 (while (string-match "|\\([ \t]*?[^ \t\r\n|][^\r\n|]*\\)|" s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9252 (setq s (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9253 (concat "|" (make-string (org-string-width (match-string 1 s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9254 ?\ ) "|")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9255 t t s)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9256 s))
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9257
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9258 (defun org-table-kill-row ()
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9259 "Delete the current row or horizontal line from the table."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9260 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9261 (if (not (org-at-table-p))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9262 (error "Not at a table"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9263 (let ((col (current-column)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9264 (kill-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9265 (if (not (org-at-table-p)) (beginning-of-line 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9266 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9267
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9268 (defun org-table-sort-lines (beg end numericp)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9269 "Sort table lines in region.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9270 Point and mark define the first and last line to include. Both point and
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9271 mark should be in the column that is used for sorting. For example, to
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9272 sort according to column 3, put the mark in the first line to sort, in
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9273 table column 3. Put point into the last line to be included in the sorting,
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9274 also in table column 3. The command will prompt for the sorting method
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
9275 \(n for numerical, a for alphanumeric)."
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9276 (interactive "r\nsSorting method: [n]=numeric [a]=alpha: ")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9277 (setq numericp (string-match "[nN]" numericp))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9278 (org-table-align) ;; Just to be safe
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9279 (let* (bcol ecol cmp column lns)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9280 (goto-char beg)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9281 (org-table-check-inside-data-field)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9282 (setq column (org-table-current-column)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9283 beg (move-marker (make-marker) (point-at-bol)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9284 (goto-char end)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9285 (org-table-check-inside-data-field)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9286 (setq end (move-marker (make-marker) (1+ (point-at-eol))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9287 (untabify beg end)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9288 (goto-char beg)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9289 (org-table-goto-column column)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9290 (skip-chars-backward "^|")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9291 (setq bcol (current-column))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9292 (org-table-goto-column (1+ column))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9293 (skip-chars-backward "^|")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9294 (setq ecol (1- (current-column)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9295 (setq cmp (if numericp
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9296 (lambda (a b) (< (car a) (car b)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9297 (lambda (a b) (string< (car a) (car b)))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9298 (setq lns (mapcar (lambda(x) (cons (org-trim (substring x bcol ecol)) x))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9299 (split-string (buffer-substring beg end) "\n")))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9300 (if numericp
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9301 (setq lns (mapcar (lambda(x)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9302 (cons (string-to-number (car x)) (cdr x)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9303 lns)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9304 (delete-region beg end)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9305 (move-marker beg nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9306 (move-marker end nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9307 (insert (mapconcat 'cdr (setq lns (sort lns cmp)) "\n") "\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9308 (message "%d lines sorted %s based on column %d"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9309 (length lns)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
9310 (if numericp "numerically" "alphabetically") column)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9311
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9312 (defun org-table-cut-region (beg end)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9313 "Copy region in table to the clipboard and blank all relevant fields."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9314 (interactive "r")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9315 (org-table-copy-region beg end 'cut))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9316
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9317 (defun org-table-copy-region (beg end &optional cut)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9318 "Copy rectangular region in table to clipboard.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
9319 A special clipboard is used which can only be accessed
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9320 with `org-table-paste-rectangle'."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9321 (interactive "rP")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9322 (let* (l01 c01 l02 c02 l1 c1 l2 c2 ic1 ic2
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9323 region cols
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9324 (rpl (if cut " " nil)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9325 (goto-char beg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9326 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9327 (setq l01 (count-lines (point-min) (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9328 c01 (org-table-current-column))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9329 (goto-char end)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9330 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9331 (setq l02 (count-lines (point-min) (point))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9332 c02 (org-table-current-column))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9333 (setq l1 (min l01 l02) l2 (max l01 l02)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9334 c1 (min c01 c02) c2 (max c01 c02))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9335 (catch 'exit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9336 (while t
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9337 (catch 'nextline
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9338 (if (> l1 l2) (throw 'exit t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9339 (goto-line l1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9340 (if (org-at-table-hline-p) (throw 'nextline (setq l1 (1+ l1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9341 (setq cols nil ic1 c1 ic2 c2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9342 (while (< ic1 (1+ ic2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9343 (push (org-table-get-field ic1 rpl) cols)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9344 (setq ic1 (1+ ic1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9345 (push (nreverse cols) region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9346 (setq l1 (1+ l1)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9347 (setq org-table-clip (nreverse region))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9348 (if cut (org-table-align))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9349 org-table-clip))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
9350
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9351 (defun org-table-paste-rectangle ()
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
9352 "Paste a rectangular region into a table.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9353 The upper right corner ends up in the current field. All involved fields
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9354 will be overwritten. If the rectangle does not fit into the present table,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9355 the table is enlarged as needed. The process ignores horizontal separator
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9356 lines."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9357 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9358 (unless (and org-table-clip (listp org-table-clip))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9359 (error "First cut/copy a region to paste!"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9360 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9361 (let* ((clip org-table-clip)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9362 (line (count-lines (point-min) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9363 (col (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9364 (org-enable-table-editor t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9365 (org-table-automatic-realign nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9366 c cols field)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9367 (while (setq cols (pop clip))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9368 (while (org-at-table-hline-p) (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9369 (if (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9370 (progn (end-of-line 0) (org-table-next-field)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9371 (setq c col)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9372 (while (setq field (pop cols))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9373 (org-table-goto-column c nil 'force)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9374 (org-table-get-field nil field)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9375 (setq c (1+ c)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9376 (beginning-of-line 2))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9377 (goto-line line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9378 (org-table-goto-column col)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9379 (org-table-align)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9380
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9381 (defun org-table-convert ()
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9382 "Convert from `org-mode' table to table.el and back.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9383 Obviously, this only works within limits. When an Org-mode table is
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9384 converted to table.el, all horizontal separator lines get lost, because
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9385 table.el uses these as cell boundaries and has no notion of horizontal lines.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9386 A table.el table can be converted to an Org-mode table only if it does not
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9387 do row or column spanning. Multiline cells will become multiple cells.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9388 Beware, Org-mode does not test if the table can be successfully converted - it
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9389 blindly applies a recipe that works for simple tables."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9390 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9391 (require 'table)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9392 (if (org-at-table.el-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9393 ;; convert to Org-mode table
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9394 (let ((beg (move-marker (make-marker) (org-table-begin t)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9395 (end (move-marker (make-marker) (org-table-end t))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9396 (table-unrecognize-region beg end)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9397 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9398 (while (re-search-forward "^\\([ \t]*\\)\\+-.*\n" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9399 (replace-match ""))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9400 (goto-char beg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9401 (if (org-at-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9402 ;; convert to table.el table
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9403 (let ((beg (move-marker (make-marker) (org-table-begin)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9404 (end (move-marker (make-marker) (org-table-end))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9405 ;; first, get rid of all horizontal lines
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9406 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9407 (while (re-search-forward "^\\([ \t]*\\)|-.*\n" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9408 (replace-match ""))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9409 ;; insert a hline before first
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9410 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9411 (org-table-insert-hline 'above)
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9412 (beginning-of-line -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9413 ;; insert a hline after each line
68171
0164d7cc3832 (org-open-file): Use mailcap for selecting an
Carsten Dominik <dominik@science.uva.nl>
parents: 68031
diff changeset
9414 (while (progn (beginning-of-line 3) (< (point) end))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9415 (org-table-insert-hline))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9416 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9417 (setq end (move-marker end (org-table-end)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9418 ;; replace "+" at beginning and ending of hlines
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9419 (while (re-search-forward "^\\([ \t]*\\)|-" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9420 (replace-match "\\1+-"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9421 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9422 (while (re-search-forward "-|[ \t]*$" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9423 (replace-match "-+"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9424 (goto-char beg)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9425
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9426 (defun org-table-wrap-region (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9427 "Wrap several fields in a column like a paragraph.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9428 This is useful if you'd like to spread the contents of a field over several
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9429 lines, in order to keep the table compact.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9430
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9431 If there is an active region, and both point and mark are in the same column,
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9432 the text in the column is wrapped to minimum width for the given number of
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9433 lines. Generally, this makes the table more compact. A prefix ARG may be
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9434 used to change the number of desired lines. For example, `C-2 \\[org-table-wrap]'
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9435 formats the selected text to two lines. If the region was longer than two
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9436 lines, the remaining lines remain empty. A negative prefix argument reduces
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9437 the current number of lines by that amount. The wrapped text is pasted back
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9438 into the table. If you formatted it to more lines than it was before, fields
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9439 further down in the table get overwritten - so you might need to make space in
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9440 the table first.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9441
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9442 If there is no region, the current field is split at the cursor position and
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9443 the text fragment to the right of the cursor is prepended to the field one
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9444 line down.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9445
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9446 If there is no region, but you specify a prefix ARG, the current field gets
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9447 blank, and the content is appended to the field above."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9448 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9449 (org-table-check-inside-data-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9450 (if (org-region-active-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9451 ;; There is a region: fill as a paragraph
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9452 (let ((beg (region-beginning))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9453 nlines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9454 (org-table-cut-region (region-beginning) (region-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9455 (if (> (length (car org-table-clip)) 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9456 (error "Region must be limited to single column"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9457 (setq nlines (if arg
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9458 (if (< arg 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9459 (+ (length org-table-clip) arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9460 arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9461 (length org-table-clip)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9462 (setq org-table-clip
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9463 (mapcar 'list (org-wrap (mapconcat 'car org-table-clip " ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9464 nil nlines)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9465 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9466 (org-table-paste-rectangle))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9467 ;; No region, split the current field at point
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9468 (if arg
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9469 ;; combine with field above
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9470 (let ((s (org-table-blank-field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9471 (col (org-table-current-column)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9472 (beginning-of-line 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9473 (while (org-at-table-hline-p) (beginning-of-line 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9474 (org-table-goto-column col)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9475 (skip-chars-forward "^|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9476 (skip-chars-backward " ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9477 (insert " " (org-trim s))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9478 (org-table-align))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9479 ;; split field
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9480 (when (looking-at "\\([^|]+\\)+|")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9481 (let ((s (match-string 1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9482 (replace-match " |")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9483 (goto-char (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9484 (org-table-next-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9485 (insert (org-trim s) " ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9486 (org-table-align))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9487
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9488 (defvar org-field-marker nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9489
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9490 (defun org-table-edit-field (arg)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9491 "Edit table field in a different window.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9492 This is mainly useful for fields that contain hidden parts.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9493 When called with a \\[universal-argument] prefix, just make the full field visible so that
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9494 it can be edited in place."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9495 (interactive "P")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9496 (if arg
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9497 (let ((b (save-excursion (skip-chars-backward "^|") (point)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9498 (e (save-excursion (skip-chars-forward "^|\r\n") (point))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9499 (remove-text-properties b e '(org-cwidth t invisible t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9500 display t intangible t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9501 (if (and (boundp 'font-lock-mode) font-lock-mode)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9502 (font-lock-fontify-block)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9503 (let ((pos (move-marker (make-marker) (point)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9504 (field (org-table-get-field))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9505 (cw (current-window-configuration))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9506 p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9507 (switch-to-buffer-other-window "*Org tmp*")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9508 (erase-buffer)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9509 (insert "#\n# Edit field and finish with C-c C-c\n#\n")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9510 (org-mode)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9511 (goto-char (setq p (point-max)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9512 (insert (org-trim field))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9513 (remove-text-properties p (point-max)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9514 '(invisible t org-cwidth t display t
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9515 intangible t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9516 (goto-char p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9517 (set (make-local-variable 'org-finish-function)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9518 'org-table-finish-edit-field)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9519 (set (make-local-variable 'org-window-configuration) cw)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9520 (set (make-local-variable 'org-field-marker) pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9521 (message "Edit and finish with C-c C-c"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9522
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9523 (defun org-table-finish-edit-field ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9524 "Finish editing a table data field.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9525 Remove all newline characters, insert the result into the table, realign
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9526 the table and kill the editing buffer."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9527 (let ((pos org-field-marker)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9528 (cw org-window-configuration)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9529 (cb (current-buffer))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9530 text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9531 (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9532 (while (re-search-forward "^#.*\n?" nil t) (replace-match ""))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9533 (while (re-search-forward "\\([ \t]*\n[ \t]*\\)+" nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9534 (replace-match " "))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9535 (setq text (org-trim (buffer-string)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9536 (set-window-configuration cw)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9537 (kill-buffer cb)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9538 (select-window (get-buffer-window (marker-buffer pos)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9539 (goto-char pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9540 (move-marker pos nil)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9541 (org-table-check-inside-data-field)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9542 (org-table-get-field nil text)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9543 (org-table-align)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9544 (message "New field value inserted")))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9545
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9546 (defun org-trim (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9547 "Remove whitespace at beginning and end of string."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9548 (if (string-match "^[ \t]+" s) (setq s (replace-match "" t t s)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9549 (if (string-match "[ \t]+$" s) (setq s (replace-match "" t t s)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9550 s)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9551
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9552 (defun org-wrap (string &optional width lines)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
9553 "Wrap string to either a number of lines, or a width in characters.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9554 If WIDTH is non-nil, the string is wrapped to that width, however many lines
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
9555 that costs. If there is a word longer than WIDTH, the text is actually
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9556 wrapped to the length of that word.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
9557 IF WIDTH is nil and LINES is non-nil, the string is forced into at most that
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9558 many lines, whatever width that takes.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9559 The return value is a list of lines, without newlines at the end."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9560 (let* ((words (org-split-string string "[ \t\n]+"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9561 (maxword (apply 'max (mapcar 'org-string-width words)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9562 w ll)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9563 (cond (width
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9564 (org-do-wrap words (max maxword width)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9565 (lines
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9566 (setq w maxword)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9567 (setq ll (org-do-wrap words maxword))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9568 (if (<= (length ll) lines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9569 ll
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9570 (setq ll words)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9571 (while (> (length ll) lines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9572 (setq w (1+ w))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9573 (setq ll (org-do-wrap words w)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9574 ll))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9575 (t (error "Cannot wrap this")))))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
9576
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9577
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9578 (defun org-do-wrap (words width)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
9579 "Create lines of maximum width WIDTH (in characters) from word list WORDS."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9580 (let (lines line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9581 (while words
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9582 (setq line (pop words))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9583 (while (and words (< (+ (length line) (length (car words))) width))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9584 (setq line (concat line " " (pop words))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9585 (setq lines (push line lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9586 (nreverse lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9587
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9588 (defun org-split-string (string &optional separators)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9589 "Splits STRING into substrings at SEPARATORS.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9590 No empty strings are returned if there are matches at the beginning
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9591 and end of string."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9592 (let ((rexp (or separators "[ \f\t\n\r\v]+"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9593 (start 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9594 notfirst
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9595 (list nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9596 (while (and (string-match rexp string
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9597 (if (and notfirst
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9598 (= start (match-beginning 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9599 (< start (length string)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9600 (1+ start) start))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9601 (< (match-beginning 0) (length string)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9602 (setq notfirst t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9603 (or (eq (match-beginning 0) 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9604 (and (eq (match-beginning 0) (match-end 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9605 (eq (match-beginning 0) start))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9606 (setq list
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9607 (cons (substring string start (match-beginning 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9608 list)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9609 (setq start (match-end 0)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9610 (or (eq start (length string))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9611 (setq list
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9612 (cons (substring string start)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9613 list)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9614 (nreverse list)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9615
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9616 (defun org-table-map-tables (function)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
9617 "Apply FUNCTION to the start of all tables in the buffer."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9618 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9619 (save-restriction
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9620 (widen)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9621 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9622 (while (re-search-forward org-table-any-line-regexp nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9623 (message "Mapping tables: %d%%" (/ (* 100.0 (point)) (buffer-size)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9624 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9625 (if (looking-at org-table-line-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9626 (save-excursion (funcall function)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9627 (re-search-forward org-table-any-border-regexp nil 1))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9628 (message "Mapping tables: done"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9629
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9630 (defun org-table-sum (&optional beg end nlast)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9631 "Sum numbers in region of current table column.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9632 The result will be displayed in the echo area, and will be available
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9633 as kill to be inserted with \\[yank].
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9634
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9635 If there is an active region, it is interpreted as a rectangle and all
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9636 numbers in that rectangle will be summed. If there is no active
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9637 region and point is located in a table column, sum all numbers in that
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9638 column.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9639
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
9640 If at least one number looks like a time HH:MM or HH:MM:SS, all other
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9641 numbers are assumed to be times as well (in decimal hours) and the
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9642 numbers are added as such.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9643
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9644 If NLAST is a number, only the NLAST fields will actually be summed."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9645 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9646 (save-excursion
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9647 (let (col (timecnt 0) diff h m s org-table-clip)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9648 (cond
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9649 ((and beg end)) ; beg and end given explicitly
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9650 ((org-region-active-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9651 (setq beg (region-beginning) end (region-end)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9652 (t
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9653 (setq col (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9654 (goto-char (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9655 (unless (re-search-forward "^[ \t]*|[^-]" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9656 (error "No table data"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9657 (org-table-goto-column col)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9658 ;not needed? (skip-chars-backward "^|")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9659 (setq beg (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9660 (goto-char (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9661 (unless (re-search-backward "^[ \t]*|[^-]" nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9662 (error "No table data"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9663 (org-table-goto-column col)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9664 ;not needed? (skip-chars-forward "^|")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9665 (setq end (point))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9666 (let* ((items (apply 'append (org-table-copy-region beg end)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9667 (items1 (cond ((not nlast) items)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9668 ((>= nlast (length items)) items)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9669 (t (setq items (reverse items))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9670 (setcdr (nthcdr (1- nlast) items) nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9671 (nreverse items))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9672 (numbers (delq nil (mapcar 'org-table-get-number-for-summing
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9673 items1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9674 (res (apply '+ numbers))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9675 (sres (if (= timecnt 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9676 (format "%g" res)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9677 (setq diff (* 3600 res)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9678 h (floor (/ diff 3600)) diff (mod diff 3600)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9679 m (floor (/ diff 60)) diff (mod diff 60)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9680 s diff)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9681 (format "%d:%02d:%02d" h m s))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9682 (kill-new sres)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9683 (if (interactive-p)
65705
7d20cbe1d616 (org-table-sum): Fix format string.
Juanma Barranquero <lekktu@gmail.com>
parents: 65654
diff changeset
9684 (message "%s"
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
9685 (substitute-command-keys
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
9686 (format "Sum of %d items: %-20s (\\[yank] will insert result into buffer)"
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
9687 (length numbers) sres))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9688 sres))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9689
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9690 (defun org-table-get-number-for-summing (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9691 (let (n)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9692 (if (string-match "^ *|? *" s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9693 (setq s (replace-match "" nil nil s)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9694 (if (string-match " *|? *$" s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9695 (setq s (replace-match "" nil nil s)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9696 (setq n (string-to-number s))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9697 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9698 ((and (string-match "0" s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9699 (string-match "\\`[-+ \t0.edED]+\\'" s)) 0)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9700 ((string-match "\\`[ \t]+\\'" s) nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9701 ((string-match "\\`\\([0-9]+\\):\\([0-9]+\\)\\(:\\([0-9]+\\)\\)?\\'" s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9702 (let ((h (string-to-number (or (match-string 1 s) "0")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9703 (m (string-to-number (or (match-string 2 s) "0")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9704 (s (string-to-number (or (match-string 4 s) "0"))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9705 (if (boundp 'timecnt) (setq timecnt (1+ timecnt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9706 (* 1.0 (+ h (/ m 60.0) (/ s 3600.0)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9707 ((equal n 0) nil)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9708 (t n))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9709
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9710 (defun org-table-get-vertical-vector (desc &optional tbeg col)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9711 "Get a calc vector from a column, accorting to descriptor DESC.
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
9712 Optional arguments TBEG and COL can give the beginning of the table and
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
9713 the current column, to avoid unnecessary parsing."
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9714 (save-excursion
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9715 (or tbeg (setq tbeg (org-table-begin)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9716 (or col (setq col (org-table-current-column)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9717 (let (beg end nn n n1 n2 l (thisline (org-current-line)) hline-list)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9718 (cond
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9719 ((string-match "\\(I+\\)\\(-\\(I+\\)\\)?" desc)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9720 (setq n1 (- (match-end 1) (match-beginning 1)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9721 (if (match-beginning 3)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9722 (setq n2 (- (match-end 2) (match-beginning 3))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9723 (setq n (if n2 (max n1 n2) n1))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9724 (setq n1 (if n2 (min n1 n2)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9725 (setq nn n)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9726 (while (and (> nn 0)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9727 (re-search-backward org-table-hline-regexp tbeg t))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9728 (push (org-current-line) hline-list)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9729 (setq nn (1- nn)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9730 (setq hline-list (nreverse hline-list))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9731 (goto-line (nth (1- n) hline-list))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9732 (when (re-search-forward org-table-dataline-regexp)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9733 (org-table-goto-column col)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9734 (setq beg (point)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9735 (goto-line (if n1 (nth (1- n1) hline-list) thisline))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9736 (when (re-search-backward org-table-dataline-regexp)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9737 (org-table-goto-column col)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9738 (setq end (point)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9739 (setq l (apply 'append (org-table-copy-region beg end)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9740 (concat "[" (mapconcat (lambda (x) (setq x (org-trim x))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9741 (if (equal x "") "0" x))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9742 l ",") "]"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9743 ((string-match "\\([0-9]+\\)-\\([0-9]+\\)" desc)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9744 (setq n1 (string-to-number (match-string 1 desc))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9745 n2 (string-to-number (match-string 2 desc)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9746 (beginning-of-line 1)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9747 (save-excursion
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9748 (when (re-search-backward org-table-dataline-regexp tbeg t n1)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9749 (org-table-goto-column col)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9750 (setq beg (point))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9751 (when (re-search-backward org-table-dataline-regexp tbeg t n2)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9752 (org-table-goto-column col)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9753 (setq end (point)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9754 (setq l (apply 'append (org-table-copy-region beg end)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9755 (concat "[" (mapconcat
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9756 (lambda (x) (setq x (org-trim x))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9757 (if (equal x "") "0" x))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9758 l ",") "]"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9759 ((string-match "\\([0-9]+\\)" desc)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9760 (beginning-of-line 1)
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
9761 (when (re-search-backward org-table-dataline-regexp tbeg t
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9762 (string-to-number (match-string 0 desc)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9763 (org-table-goto-column col)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9764 (org-trim (org-table-get-field))))))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9765
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9766 (defvar org-table-formula-history nil)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9767
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9768 (defvar org-table-column-names nil
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9769 "Alist with column names, derived from the `!' line.")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9770 (defvar org-table-column-name-regexp nil
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9771 "Regular expression matching the current column names.")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9772 (defvar org-table-local-parameters nil
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9773 "Alist with parameter names, derived from the `$' line.")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9774 (defvar org-table-named-field-locations nil
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9775 "Alist with locations of named fields.")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9776
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9777 (defun org-table-get-formula (&optional equation named)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9778 "Read a formula from the minibuffer, offer stored formula as default."
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9779 (let* ((name (car (rassoc (list (org-current-line)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9780 (org-table-current-column))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9781 org-table-named-field-locations)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9782 (scol (if named
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9783 (if name name
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9784 (error "Not in a named field"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9785 (int-to-string (org-table-current-column))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9786 (dummy (and name (not named)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9787 (not (y-or-n-p "Replace named-field formula with column equation? " ))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9788 (error "Abort")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9789 (org-table-may-need-update nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9790 (stored-list (org-table-get-stored-formulas))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9791 (stored (cdr (assoc scol stored-list)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9792 (eq (cond
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
9793 ((and stored equation (string-match "^ *=? *$" equation))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9794 stored)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9795 ((stringp equation)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9796 equation)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9797 (t (read-string
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9798 (format "%s formula $%s=" (if named "Field" "Column") scol)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9799 (or stored "") 'org-table-formula-history
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9800 ;stored
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9801 ))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9802 mustsave)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9803 (when (not (string-match "\\S-" eq))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9804 ;; remove formula
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9805 (setq stored-list (delq (assoc scol stored-list) stored-list))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9806 (org-table-store-formulas stored-list)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9807 (error "Formula removed"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9808 (if (string-match "^ *=?" eq) (setq eq (replace-match "" t t eq)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9809 (if (string-match " *$" eq) (setq eq (replace-match "" t t eq)))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9810 (if (and name (not named))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9811 ;; We set the column equation, delete the named one.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9812 (setq stored-list (delq (assoc name stored-list) stored-list)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9813 mustsave t))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9814 (if stored
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9815 (setcdr (assoc scol stored-list) eq)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9816 (setq stored-list (cons (cons scol eq) stored-list)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9817 (if (or mustsave (not (equal stored eq)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9818 (org-table-store-formulas stored-list))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9819 eq))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9820
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9821 (defun org-table-store-formulas (alist)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9822 "Store the list of formulas below the current table."
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9823 (setq alist (sort alist (lambda (a b) (string< (car a) (car b)))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9824 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9825 (goto-char (org-table-end))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9826 (if (looking-at "\\([ \t]*\n\\)*#\\+TBLFM:.*\n?")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9827 (delete-region (point) (match-end 0)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9828 (insert "#+TBLFM: "
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9829 (mapconcat (lambda (x)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9830 (concat "$" (car x) "=" (cdr x)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9831 alist "::")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9832 "\n")))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9833
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9834 (defun org-table-get-stored-formulas ()
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9835 "Return an alist with the t=stored formulas directly after current table."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9836 (interactive)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9837 (let (scol eq eq-alist strings string seen)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9838 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9839 (goto-char (org-table-end))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9840 (when (looking-at "\\([ \t]*\n\\)*#\\+TBLFM: *\\(.*\\)")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9841 (setq strings (org-split-string (match-string 2) " *:: *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9842 (while (setq string (pop strings))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9843 (when (string-match "\\$\\([a-zA-Z0-9]+\\) *= *\\(.*[^ \t]\\)" string)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9844 (setq scol (match-string 1 string)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9845 eq (match-string 2 string)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9846 eq-alist (cons (cons scol eq) eq-alist))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9847 (if (member scol seen)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9848 (error "Double definition `$%s=' in TBLFM line, please fix by hand" scol)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9849 (push scol seen))))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9850 (nreverse eq-alist)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9851
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9852 (defun org-table-modify-formulas (action &rest columns)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9853 "Modify the formulas stored below the current table.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9854 ACTION can be `remove', `insert', `swap'. For `swap', two column numbers are
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9855 expected, for the other actions only a single column number is needed."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9856 (let ((list (org-table-get-stored-formulas))
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
9857 (nmax (length (org-split-string
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9858 (buffer-substring (point-at-bol) (point-at-eol))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9859 "|")))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9860 col col1 col2 scol si sc1 sc2)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9861 (cond
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9862 ((null list)) ; No action needed if there are no stored formulas
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9863 ((eq action 'remove)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9864 (setq col (car columns)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9865 scol (int-to-string col))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9866 (org-table-replace-in-formulas list scol "INVALID")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9867 (if (assoc scol list) (setq list (delq (assoc scol list) list)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9868 (loop for i from (1+ col) upto nmax by 1 do
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9869 (setq si (int-to-string i))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9870 (org-table-replace-in-formulas list si (int-to-string (1- i)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9871 (if (assoc si list) (setcar (assoc si list)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9872 (int-to-string (1- i))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9873 ((eq action 'insert)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9874 (setq col (car columns))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9875 (loop for i from nmax downto col by 1 do
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9876 (setq si (int-to-string i))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9877 (org-table-replace-in-formulas list si (int-to-string (1+ i)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9878 (if (assoc si list) (setcar (assoc si list)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9879 (int-to-string (1+ i))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9880 ((eq action 'swap)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9881 (setq col1 (car columns) col2 (nth 1 columns)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9882 sc1 (int-to-string col1) sc2 (int-to-string col2))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9883 ;; Hopefully, ZqZtZ will never be a name in a table
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9884 (org-table-replace-in-formulas list sc1 "ZqZtZ")
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9885 (org-table-replace-in-formulas list sc2 sc1)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9886 (org-table-replace-in-formulas list "ZqZtZ" sc2)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9887 (if (assoc sc1 list) (setcar (assoc sc1 list) "ZqZtZ"))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9888 (if (assoc sc2 list) (setcar (assoc sc2 list) sc1))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
9889 (if (assoc "ZqZtZ" list) (setcar (assoc "ZqZtZ" list) sc2)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9890 (t (error "Invalid action in `org-table-modify-formulas'")))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9891 (if list (org-table-store-formulas list))))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9892
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9893 (defun org-table-replace-in-formulas (list s1 s2)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9894 (let (elt re s)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9895 (setq s1 (concat "$" (if (integerp s1) (int-to-string s1) s1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9896 s2 (concat "$" (if (integerp s2) (int-to-string s2) s2))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9897 re (concat (regexp-quote s1) "\\>"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9898 (while (setq elt (pop list))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9899 (setq s (cdr elt))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9900 (while (string-match re s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9901 (setq s (replace-match s2 t t s)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9902 (setcdr elt s))))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9903
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9904 (defun org-table-get-specials ()
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9905 "Get the column names and local parameters for this table."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9906 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9907 (let ((beg (org-table-begin)) (end (org-table-end))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9908 names name fields fields1 field cnt c v line col)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9909 (setq org-table-column-names nil
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9910 org-table-local-parameters nil
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9911 org-table-named-field-locations nil)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9912 (goto-char beg)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9913 (when (re-search-forward "^[ \t]*| *! *\\(|.*\\)" end t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9914 (setq names (org-split-string (match-string 1) " *| *")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9915 cnt 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9916 (while (setq name (pop names))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9917 (setq cnt (1+ cnt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9918 (if (string-match "^[a-zA-Z][a-zA-Z0-9]*$" name)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9919 (push (cons name (int-to-string cnt)) org-table-column-names))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9920 (setq org-table-column-names (nreverse org-table-column-names))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9921 (setq org-table-column-name-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9922 (concat "\\$\\(" (mapconcat 'car org-table-column-names "\\|") "\\)\\>"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9923 (goto-char beg)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9924 (while (re-search-forward "^[ \t]*| *\\$ *\\(|.*\\)" end t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9925 (setq fields (org-split-string (match-string 1) " *| *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9926 (while (setq field (pop fields))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9927 (if (string-match "^\\([a-zA-Z][a-zA-Z0-9]*\\|%\\) *= *\\(.*\\)" field)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9928 (push (cons (match-string 1 field) (match-string 2 field))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9929 org-table-local-parameters))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9930 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9931 (while (re-search-forward "^[ \t]*| *\\([_^]\\) *\\(|.*\\)" end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9932 (setq c (match-string 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9933 fields (org-split-string (match-string 2) " *| *"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9934 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9935 (beginning-of-line (if (equal c "_") 2 0))
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
9936 (setq line (org-current-line) col 1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9937 (and (looking-at "^[ \t]*|[^|]*\\(|.*\\)")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9938 (setq fields1 (org-split-string (match-string 1) " *| *"))))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9939 (while (and fields1 (setq field (pop fields)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9940 (setq v (pop fields1) col (1+ col))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9941 (when (and (stringp field) (stringp v)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9942 (string-match "^[a-zA-Z][a-zA-Z0-9]*$" field))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9943 (push (cons field v) org-table-local-parameters)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9944 (push (list field line col) org-table-named-field-locations)))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9945
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9946 (defun org-this-word ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9947 ;; Get the current word
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9948 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9949 (let ((beg (progn (skip-chars-backward "^ \t\n") (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9950 (end (progn (skip-chars-forward "^ \t\n") (point))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9951 (buffer-substring-no-properties beg end))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9952
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9953 (defun org-table-maybe-eval-formula ()
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9954 "Check if the current field starts with \"=\" or \":=\".
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9955 If yes, store the formula and apply it."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9956 ;; We already know we are in a table. Get field will only return a formula
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9957 ;; when appropriate. It might return a separator line, but no problem.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9958 (when org-table-formula-evaluate-inline
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9959 (let* ((field (org-trim (or (org-table-get-field) "")))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9960 named eq)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
9961 (when (string-match "^:?=\\(.*\\)" field)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9962 (setq named (equal (string-to-char field) ?:)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9963 eq (match-string 1 field))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9964 (if (fboundp 'calc-eval)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
9965 (org-table-eval-formula (if named '(4) nil) eq))))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9966
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9967 (defvar org-recalc-commands nil
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9968 "List of commands triggering the recalculation of a line.
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9969 Will be filled automatically during use.")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9970
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9971 (defvar org-recalc-marks
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9972 '((" " . "Unmarked: no special line, no automatic recalculation")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9973 ("#" . "Automatically recalculate this line upon TAB, RET, and C-c C-c in the line")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9974 ("*" . "Recalculate only when entire table is recalculated with `C-u C-c *'")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9975 ("!" . "Column name definition line. Reference in formula as $name.")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9976 ("$" . "Parameter definition line name=value. Reference in formula as $name.")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9977 ("_" . "Names for values in row below this one.")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9978 ("^" . "Names for values in row above this one.")))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9979
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9980 (defun org-table-rotate-recalc-marks (&optional newchar)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9981 "Rotate the recalculation mark in the first column.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9982 If in any row, the first field is not consistent with a mark,
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9983 insert a new column for the markers.
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9984 When there is an active region, change all the lines in the region,
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9985 after prompting for the marking character.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
9986 After each change, a message will be displayed indicating the meaning
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9987 of the new mark."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9988 (interactive)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9989 (unless (org-at-table-p) (error "Not at a table"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
9990 (let* ((marks (append (mapcar 'car org-recalc-marks) '(" ")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9991 (beg (org-table-begin))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9992 (end (org-table-end))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9993 (l (org-current-line))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9994 (l1 (if (org-region-active-p) (org-current-line (region-beginning))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9995 (l2 (if (org-region-active-p) (org-current-line (region-end))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9996 (have-col
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9997 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9998 (goto-char beg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
9999 (not (re-search-forward "^[ \t]*|[^-|][^|]*[^#!$*_^| \t][^|]*|" end t))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10000 (col (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10001 (forcenew (car (assoc newchar org-recalc-marks)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10002 epos new)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10003 (when l1
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10004 (message "Change region to what mark? Type # * ! $ or SPC: ")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10005 (setq newchar (char-to-string (read-char-exclusive))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10006 forcenew (car (assoc newchar org-recalc-marks))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10007 (if (and newchar (not forcenew))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10008 (error "Invalid NEWCHAR `%s' in `org-table-rotate-recalc-marks'"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10009 newchar))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10010 (if l1 (goto-line l1))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10011 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10012 (beginning-of-line 1)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10013 (unless (looking-at org-table-dataline-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10014 (error "Not at a table data line")))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10015 (unless have-col
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10016 (org-table-goto-column 1)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10017 (org-table-insert-column)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10018 (org-table-goto-column (1+ col)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10019 (setq epos (point-at-eol))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10020 (save-excursion
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10021 (beginning-of-line 1)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
10022 (org-table-get-field
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10023 1 (if (looking-at "^[ \t]*| *\\([#!$*^_ ]\\) *|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10024 (concat " "
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10025 (setq new (or forcenew
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10026 (cadr (member (match-string 1) marks))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10027 " ")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10028 " # ")))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10029 (if (and l1 l2)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10030 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10031 (goto-line l1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10032 (while (progn (beginning-of-line 2) (not (= (org-current-line) l2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10033 (and (looking-at org-table-dataline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10034 (org-table-get-field 1 (concat " " new " "))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10035 (goto-line l1)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10036 (if (not (= epos (point-at-eol))) (org-table-align))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10037 (goto-line l)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10038 (and (interactive-p) (message (cdr (assoc new org-recalc-marks))))))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10039
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10040 (defun org-table-maybe-recalculate-line ()
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10041 "Recompute the current line if marked for it, and if we haven't just done it."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10042 (interactive)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10043 (and org-table-allow-automatic-line-recalculation
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10044 (not (and (memq last-command org-recalc-commands)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10045 (equal org-last-recalc-line (org-current-line))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10046 (save-excursion (beginning-of-line 1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10047 (looking-at org-table-auto-recalculate-regexp))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10048 (fboundp 'calc-eval)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10049 (org-table-recalculate) t))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10050
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10051 (defvar org-table-formula-debug nil
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10052 "Non-nil means, debug table formulas.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10053 When nil, simply write \"#ERROR\" in corrupted fields.")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10054
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10055 (defvar modes)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10056 (defsubst org-set-calc-mode (var &optional value)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10057 (if (stringp var)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10058 (setq var (assoc var '(("D" calc-angle-mode deg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10059 ("R" calc-angle-mode rad)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10060 ("F" calc-prefer-frac t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10061 ("S" calc-symbolic-mode t)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10062 value (nth 2 var) var (nth 1 var)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10063 (if (memq var modes)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10064 (setcar (cdr (memq var modes)) value)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10065 (cons var (cons value modes)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10066 modes)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10067
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10068 (defun org-table-eval-formula (&optional arg equation
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10069 suppress-align suppress-const
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10070 suppress-store)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10071 "Replace the table field value at the cursor by the result of a calculation.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10072
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
10073 This function makes use of Dave Gillespie's Calc package, in my view the
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
10074 most exciting program ever written for GNU Emacs. So you need to have Calc
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10075 installed in order to use this function.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10076
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10077 In a table, this command replaces the value in the current field with the
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
10078 result of a formula. It also installs the formula as the \"current\" column
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10079 formula, by storing it in a special line below the table. When called
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10080 with a `C-u' prefix, the current field must ba a named field, and the
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10081 formula is installed as valid in only this specific field.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10082
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10083 When called, the command first prompts for a formula, which is read in
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10084 the minibuffer. Previously entered formulas are available through the
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10085 history list, and the last used formula is offered as a default.
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10086 These stored formulas are adapted correctly when moving, inserting, or
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10087 deleting columns with the corresponding commands.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10088
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
10089 The formula can be any algebraic expression understood by the Calc package.
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10090 For details, see the Org-mode manual.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10091
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10092 This function can also be called from Lisp programs and offers
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
10093 additional arguments: EQUATION can be the formula to apply. If this
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10094 argument is given, the user will not be prompted. SUPPRESS-ALIGN is
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10095 used to speed-up recursive calls by by-passing unnecessary aligns.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10096 SUPPRESS-CONST suppresses the interpretation of constants in the
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
10097 formula, assuming that this has been done already outside the function.
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10098 SUPPRESS-STORE means the formula should not be stored, either because
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10099 it is already stored, or because it is a modified equation that should
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10100 not overwrite the stored one."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10101 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10102 (require 'calc)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10103 (org-table-check-inside-data-field)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10104 (org-table-get-specials)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10105 (let* (fields
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10106 (ndown (if (integerp arg) arg 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10107 (org-table-automatic-realign nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10108 (case-fold-search nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10109 (down (> ndown 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10110 (formula (if (and equation suppress-store)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10111 equation
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10112 (org-table-get-formula equation (equal arg '(4)))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10113 (n0 (org-table-current-column))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10114 (modes (copy-sequence org-calc-default-modes))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10115 n form fmt x ev orig c)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10116 ;; Parse the format string. Since we have a lot of modes, this is
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10117 ;; a lot of work. However, I think calc still uses most of the time.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10118 (if (string-match ";" formula)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10119 (let ((tmp (org-split-string formula ";")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10120 (setq formula (car tmp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10121 fmt (concat (cdr (assoc "%" org-table-local-parameters))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10122 (nth 1 tmp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10123 (while (string-match "[pnfse]\\(-?[0-9]+\\)" fmt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10124 (setq c (string-to-char (match-string 1 fmt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10125 n (string-to-number (or (match-string 1 fmt) "")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10126 (if (= c ?p) (setq modes (org-set-calc-mode 'calc-internal-prec n))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10127 (setq modes (org-set-calc-mode
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10128 'calc-float-format
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
10129 (list (cdr (assoc c '((?n . float) (?f . fix)
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
10130 (?s . sci) (?e . eng))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10131 n))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10132 (setq fmt (replace-match "" t t fmt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10133 (while (string-match "[DRFS]" fmt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10134 (setq modes (org-set-calc-mode (match-string 0 fmt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10135 (setq fmt (replace-match "" t t fmt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10136 (unless (string-match "\\S-" fmt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10137 (setq fmt nil))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10138 (if (and (not suppress-const) org-table-formula-use-constants)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10139 (setq formula (org-table-formula-substitute-names formula)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10140 (setq orig (or (get-text-property 1 :orig-formula formula) "?"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10141 (while (> ndown 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10142 (setq fields (org-split-string
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10143 (buffer-substring
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10144 (point-at-bol) (point-at-eol)) " *| *"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10145 (if org-table-formula-numbers-only
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10146 (setq fields (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10147 (lambda (x) (number-to-string (string-to-number x)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10148 fields)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10149 (setq ndown (1- ndown))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10150 (setq form (copy-sequence formula))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10151 ;; Insert the references to fields in same row
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10152 (while (string-match "\\$\\([0-9]+\\)?" form)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10153 (setq n (if (match-beginning 1)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
10154 (string-to-number (match-string 1 form))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10155 n0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10156 x (nth (1- n) fields))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10157 (unless x (error "Invalid field specifier \"%s\""
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10158 (match-string 0 form)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10159 (if (equal x "") (setq x "0"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10160 (setq form (replace-match (concat "(" x ")") t t form)))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10161 ;; Insert ranges in current column
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10162 (while (string-match "\\&[-I0-9]+" form)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10163 (setq form (replace-match
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10164 (save-match-data
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10165 (org-table-get-vertical-vector (match-string 0 form)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10166 nil n0))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10167 t t form)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10168 (setq ev (calc-eval (cons form modes)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10169 (if org-table-formula-numbers-only 'num)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10170
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10171 (when org-table-formula-debug
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10172 (with-output-to-temp-buffer "*Help*"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10173 (princ (format "Substitution history of formula
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10174 Orig: %s
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10175 $xyz-> %s
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10176 $1-> %s\n" orig formula form))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10177 (if (listp ev)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10178 (princ (format " %s^\nError: %s"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10179 (make-string (car ev) ?\-) (nth 1 ev)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10180 (princ (format "Result: %s\nFormat: %s\nFinal: %s"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10181 ev (or fmt "NONE")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10182 (if fmt (format fmt (string-to-number ev)) ev)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10183 (shrink-window-if-larger-than-buffer (get-buffer-window "*Help*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10184 (unless (and (interactive-p) (not ndown))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10185 (unless (let (inhibit-redisplay)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10186 (y-or-n-p "Debugging Formula. Continue to next? "))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10187 (org-table-align)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10188 (error "Abort"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10189 (delete-window (get-buffer-window "*Help*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10190 (message "")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10191 (if (listp ev) (setq fmt nil ev "#ERROR"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10192 (org-table-justify-field-maybe
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10193 (if fmt (format fmt (string-to-number ev)) ev))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10194 (if (and down (> ndown 0) (looking-at ".*\n[ \t]*|[^-]"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10195 (call-interactively 'org-return)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10196 (setq ndown 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10197 (and down (org-table-maybe-recalculate-line))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10198 (or suppress-align (and org-table-may-need-update
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10199 (org-table-align)))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10200
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10201 (defun org-table-recalculate (&optional all noalign)
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
10202 "Recalculate the current table line by applying all stored formulas.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
10203 With prefix arg ALL, do this for all lines in the table."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10204 (interactive "P")
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10205 (or (memq this-command org-recalc-commands)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10206 (setq org-recalc-commands (cons this-command org-recalc-commands)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10207 (unless (org-at-table-p) (error "Not at a table"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10208 (org-table-get-specials)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10209 (let* ((eqlist (sort (org-table-get-stored-formulas)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10210 (lambda (a b) (string< (car a) (car b)))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10211 (inhibit-redisplay t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10212 (line-re org-table-dataline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10213 (thisline (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10214 (thiscol (org-table-current-column))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10215 beg end entry eqlnum eqlname eql (cnt 0) eq a name)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10216 ;; Insert constants in all formulas
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10217 (setq eqlist
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10218 (mapcar (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10219 (setcdr x (org-table-formula-substitute-names (cdr x)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10220 x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10221 eqlist))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10222 ;; Split the equation list
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10223 (while (setq eq (pop eqlist))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10224 (if (<= (string-to-char (car eq)) ?9)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10225 (push eq eqlnum)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10226 (push eq eqlname)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10227 (setq eqlnum (nreverse eqlnum) eqlname (nreverse eqlname))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10228 (if all
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10229 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10230 (setq end (move-marker (make-marker) (1+ (org-table-end))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10231 (goto-char (setq beg (org-table-begin)))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10232 (if (re-search-forward org-table-calculate-mark-regexp end t)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10233 ;; This is a table with marked lines, only compute selected lines
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10234 (setq line-re org-table-recalculate-regexp)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10235 ;; Move forward to the first non-header line
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10236 (if (and (re-search-forward org-table-dataline-regexp end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10237 (re-search-forward org-table-hline-regexp end t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10238 (re-search-forward org-table-dataline-regexp end t))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10239 (setq beg (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10240 nil))) ;; just leave beg where it is
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10241 (setq beg (point-at-bol)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10242 end (move-marker (make-marker) (1+ (point-at-eol)))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10243 (goto-char beg)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10244 (and all (message "Re-applying formulas to full table..."))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10245 (while (re-search-forward line-re end t)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10246 (unless (string-match "^ *[_^!$] *$" (org-table-get-field 1))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10247 ;; Unprotected line, recalculate
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10248 (and all (message "Re-applying formulas to full table...(line %d)"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10249 (setq cnt (1+ cnt))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10250 (setq org-last-recalc-line (org-current-line))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10251 (setq eql eqlnum)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10252 (while (setq entry (pop eql))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10253 (goto-line org-last-recalc-line)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
10254 (org-table-goto-column (string-to-number (car entry)) nil 'force)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10255 (org-table-eval-formula nil (cdr entry) 'noalign 'nocst 'nostore))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10256 (goto-line thisline)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10257 (org-table-goto-column thiscol)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10258 (or noalign (and org-table-may-need-update (org-table-align))
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10259 (and all (message "Re-applying formulas to %d lines...done" cnt)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10260 ;; Now do the names fields
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10261 (while (setq eq (pop eqlname))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10262 (setq name (car eq)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10263 a (assoc name org-table-named-field-locations))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10264 (when a
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10265 (message "Re-applying formula to named field: %s" name)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10266 (goto-line (nth 1 a))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10267 (org-table-goto-column (nth 2 a))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10268 (org-table-eval-formula nil (cdr eq) 'noalign 'nocst 'nostore)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10269 ;; back to initial position
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10270 (goto-line thisline)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10271 (org-table-goto-column thiscol)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10272 (or noalign (and org-table-may-need-update (org-table-align))
64518
7b82147924c7 (org-table-formula-substitute-names, org-table-get-vertical-vector): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents: 64515
diff changeset
10273 (and all (message "Re-applying formulas...done")))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10274
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10275 (defun org-table-formula-substitute-names (f)
64518
7b82147924c7 (org-table-formula-substitute-names, org-table-get-vertical-vector): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents: 64515
diff changeset
10276 "Replace $const with values in string F."
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10277 (let ((start 0) a n1 n2 nn1 nn2 s (f1 f))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10278 ;; First, check for column names
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10279 (while (setq start (string-match org-table-column-name-regexp f start))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10280 (setq start (1+ start))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10281 (setq a (assoc (match-string 1 f) org-table-column-names))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10282 (setq f (replace-match (concat "$" (cdr a)) t t f)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10283 ;; Expand ranges to vectors
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10284 (while (string-match "\\$\\([0-9]+\\)\\.\\.\\.?\\$\\([0-9]+\\)" f)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10285 (setq n1 (string-to-number (match-string 1 f))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10286 n2 (string-to-number (match-string 2 f))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10287 nn1 (1+ (min n1 n2)) nn2 (max n1 n2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10288 s (concat "[($" (number-to-string (1- nn1)) ")"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10289 (loop for i from nn1 upto nn2 do
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10290 (setq s (concat s ",($" (int-to-string i) ")")))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10291 (setq s (concat s "]"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10292 (if (< n2 n1) (setq s (concat "rev(" s ")")))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10293 (setq f (replace-match s t t f)))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10294 ;; Parameters and constants
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10295 (setq start 0)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10296 (while (setq start (string-match "\\$\\([a-zA-Z][a-zA-Z0-9]*\\)" f start))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10297 (setq start (1+ start))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
10298 (if (setq a (save-match-data
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10299 (org-table-get-constant (match-string 1 f))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10300 (setq f (replace-match (concat "(" a ")") t t f))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10301 (if org-table-formula-debug
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10302 (put-text-property 0 (length f) :orig-formula f1 f))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10303 f))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10304
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10305 (defun org-table-get-constant (const)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10306 "Find the value for a parameter or constant in a formula.
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10307 Parameters get priority."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10308 (or (cdr (assoc const org-table-local-parameters))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10309 (cdr (assoc const org-table-formula-constants))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10310 (and (fboundp 'constants-get) (constants-get const))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10311 "#UNDEFINED_NAME"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10312
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10313 (defvar org-edit-formulas-map (make-sparse-keymap))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10314 (define-key org-edit-formulas-map "\C-c\C-c" 'org-finish-edit-formulas)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10315 (define-key org-edit-formulas-map "\C-c\C-q" 'org-abort-edit-formulas)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10316 (define-key org-edit-formulas-map "\C-c?" 'org-show-variable)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10317
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10318 (defvar org-pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10319
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10320 (defun org-table-edit-formulas ()
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10321 "Edit the formulas of the current table in a separate buffer."
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10322 (interactive)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10323 (unless (org-at-table-p)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10324 (error "Not at a table"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10325 (org-table-get-specials)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10326 (let ((eql (org-table-get-stored-formulas))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10327 (pos (move-marker (make-marker) (point)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10328 (wc (current-window-configuration))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10329 entry loc s)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10330 (switch-to-buffer-other-window "*Edit Formulas*")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10331 (erase-buffer)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10332 (fundamental-mode)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10333 (set (make-local-variable 'org-pos) pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10334 (set (make-local-variable 'org-window-configuration) wc)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10335 (use-local-map org-edit-formulas-map)
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
10336 (setq s "# Edit formulas and finish with `C-c C-c'.
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10337 # Use `C-u C-c C-c' to also appy them immediately to the entire table.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10338 # Use `C-c ?' to get information about $name at point.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10339 # To cancel editing, press `C-c C-q'.\n")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10340 (put-text-property 0 (length s) 'face 'font-lock-comment-face s)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10341 (insert s)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10342 (while (setq entry (pop eql))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10343 (when (setq loc (assoc (car entry) org-table-named-field-locations))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10344 (setq s (format "# Named formula, referring to column %d in line %d\n"
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10345 (nth 2 loc) (nth 1 loc)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10346 (put-text-property 0 (length s) 'face 'font-lock-comment-face s)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10347 (insert s))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10348 (setq s (concat "$" (car entry) "=" (cdr entry) "\n"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10349 (remove-text-properties 0 (length s) '(face nil) s)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10350 (insert s))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10351 (goto-char (point-min))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10352 (message "Edit formulas and finish with `C-c C-c'.")))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10353
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10354 (defun org-show-variable ()
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10355 "Show the location/value of the $ expression at point."
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10356 (interactive)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10357 (let (var (pos org-pos) (win (selected-window)) e)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10358 (save-excursion
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10359 (or (looking-at "\\$") (skip-chars-backward "$a-zA-Z0-9"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10360 (if (looking-at "\\$\\([a-zA-Z0-9]+\\)")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10361 (setq var (match-string 1))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10362 (error "No variable at point")))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10363 (cond
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10364 ((setq e (assoc var org-table-named-field-locations))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10365 (switch-to-buffer-other-window (marker-buffer pos))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10366 (goto-line (nth 1 e))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10367 (org-table-goto-column (nth 2 e))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10368 (select-window win)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10369 (message "Named field, column %d of line %d" (nth 2 e) (nth 1 e)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10370 ((setq e (assoc var org-table-column-names))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10371 (switch-to-buffer-other-window (marker-buffer pos))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10372 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10373 (goto-char (org-table-begin))
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
10374 (if (re-search-forward (concat "^[ \t]*| *! *.*?| *\\(" var "\\) *|")
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10375 (org-table-end) t)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10376 (progn
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10377 (goto-char (match-beginning 1))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10378 (message "Named column (column %s)" (cdr e)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10379 (error "Column name not found"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10380 (select-window win))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10381 ((string-match "^[0-9]$" var)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10382 ;; column number
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10383 (switch-to-buffer-other-window (marker-buffer pos))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10384 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10385 (goto-char (org-table-begin))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10386 (recenter 1)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10387 (if (re-search-forward org-table-dataline-regexp
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10388 (org-table-end) t)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10389 (progn
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10390 (goto-char (match-beginning 0))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10391 (org-table-goto-column (string-to-number var))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10392 (message "Column %s" var))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10393 (error "Column name not found"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10394 (select-window win))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10395 ((setq e (assoc var org-table-local-parameters))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10396 (switch-to-buffer-other-window (marker-buffer pos))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10397 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10398 (goto-char (org-table-begin))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10399 (if (re-search-forward (concat "^[ \t]*| *\\$ *.*?| *\\(" var "=\\)") nil t)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10400 (progn
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10401 (goto-char (match-beginning 1))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10402 (message "Local parameter."))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10403 (error "Parameter not found"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10404 (select-window win))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10405 (t
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10406 (cond
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10407 ((setq e (assoc var org-table-formula-constants))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10408 (message "Constant: $%s=%s in `org-table-formula-constants'." var (cdr e)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10409 ((setq e (and (fboundp 'constants-get) (constants-get var)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10410 (message "Constant: $%s=%s, retrieved from `constants.el'." var e))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10411 (t (error "Undefined name $%s" var)))))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10412
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10413 (defun org-finish-edit-formulas (&optional arg)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10414 "Parse the buffer for formula definitions and install them.
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10415 With prefix ARG, apply the new formulas to the table."
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10416 (interactive "P")
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10417 (let ((pos org-pos) eql)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10418 (goto-char (point-min))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10419 (while (re-search-forward "^\\$\\([a-zA-Z0-9]+\\) *= *\\(.*?\\) *$" nil t)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10420 (push (cons (match-string 1) (match-string 2)) eql))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10421 (set-window-configuration org-window-configuration)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10422 (select-window (get-buffer-window (marker-buffer pos)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10423 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10424 (unless (org-at-table-p)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10425 (error "Lost table position - cannot install formulae"))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10426 (org-table-store-formulas eql)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10427 (move-marker pos nil)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10428 (kill-buffer "*Edit Formulas*")
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
10429 (if arg
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10430 (org-table-recalculate 'all)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10431 (message "New formulas installed - press C-u C-c C-c to apply."))))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10432
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10433 (defun org-abort-edit-formulas ()
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10434 "Abort editing formulas, without installing the changes."
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10435 (interactive)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10436 (let ((pos org-pos))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10437 (set-window-configuration org-window-configuration)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10438 (select-window (get-buffer-window (marker-buffer pos)))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10439 (goto-char pos)
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10440 (message "Formula editing aborted without installing changes")))
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10441
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10442 ;;; The orgtbl minor mode
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10443
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10444 ;; Define a minor mode which can be used in other modes in order to
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10445 ;; integrate the org-mode table editor.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10446
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10447 ;; This is really a hack, because the org-mode table editor uses several
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10448 ;; keys which normally belong to the major mode, for example the TAB and
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10449 ;; RET keys. Here is how it works: The minor mode defines all the keys
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10450 ;; necessary to operate the table editor, but wraps the commands into a
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10451 ;; function which tests if the cursor is currently inside a table. If that
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10452 ;; is the case, the table editor command is executed. However, when any of
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10453 ;; those keys is used outside a table, the function uses `key-binding' to
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10454 ;; look up if the key has an associated command in another currently active
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10455 ;; keymap (minor modes, major mode, global), and executes that command.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10456 ;; There might be problems if any of the keys used by the table editor is
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10457 ;; otherwise used as a prefix key.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10458
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10459 ;; Another challenge is that the key binding for TAB can be tab or \C-i,
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10460 ;; likewise the binding for RET can be return or \C-m. Orgtbl-mode
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10461 ;; addresses this by checking explicitly for both bindings.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10462
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10463 ;; The optimized version (see variable `orgtbl-optimized') takes over
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10464 ;; all keys which are bound to `self-insert-command' in the *global map*.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10465 ;; Some modes bind other commands to simple characters, for example
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10466 ;; AUCTeX binds the double quote to `Tex-insert-quote'. With orgtbl-mode
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10467 ;; active, this binding is ignored inside tables and replaced with a
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10468 ;; modified self-insert.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10469
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10470 (defvar orgtbl-mode nil
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10471 "Variable controlling `orgtbl-mode', a minor mode enabling the `org-mode'
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
10472 table editor in arbitrary modes.")
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10473 (make-variable-buffer-local 'orgtbl-mode)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10474
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
10475 (defvar orgtbl-mode-map (make-keymap)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10476 "Keymap for `orgtbl-mode'.")
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10477
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10478 ;;;###autoload
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10479 (defun turn-on-orgtbl ()
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10480 "Unconditionally turn on `orgtbl-mode'."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10481 (orgtbl-mode 1))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10482
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10483 ;;;###autoload
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10484 (defun orgtbl-mode (&optional arg)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
10485 "The `org-mode' table editor as a minor mode for use in other modes."
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10486 (interactive)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10487 (if (eq major-mode 'org-mode)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10488 ;; Exit without error, in case some hook functions calls this
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10489 ;; by accident in org-mode.
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10490 (message "Orgtbl-mode is not useful in org-mode, command ignored")
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10491 (setq orgtbl-mode
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10492 (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode)))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10493 (if orgtbl-mode
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10494 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10495 (and (orgtbl-setup) (defun orgtbl-setup () nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10496 ;; Make sure we are first in minor-mode-map-alist
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10497 (let ((c (assq 'orgtbl-mode minor-mode-map-alist)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10498 (and c (setq minor-mode-map-alist
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10499 (cons c (delq c minor-mode-map-alist)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10500 (set (make-local-variable (quote org-table-may-need-update)) t)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
10501 (org-add-hook 'before-change-functions 'org-before-change-function
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
10502 nil 'local)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10503 (set (make-local-variable 'org-old-auto-fill-inhibit-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10504 auto-fill-inhibit-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10505 (set (make-local-variable 'auto-fill-inhibit-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10506 (if auto-fill-inhibit-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10507 (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10508 "[ \t]*|"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10509 (org-add-to-invisibility-spec '(org-cwidth))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10510 (easy-menu-add orgtbl-mode-menu)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10511 (run-hooks 'orgtbl-mode-hook))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10512 (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10513 (org-cleanup-narrow-column-properties)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10514 (org-remove-from-invisibility-spec '(org-cwidth))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10515 (remove-hook 'before-change-functions 'org-before-change-function t)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10516 (easy-menu-remove orgtbl-mode-menu)
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
10517 (force-mode-line-update 'all))))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10518
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10519 (defun org-cleanup-narrow-column-properties ()
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10520 "Remove all properties related to narrow-column invisibility."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10521 (let ((s 1))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10522 (while (setq s (text-property-any s (point-max)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10523 'display org-narrow-column-arrow))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10524 (remove-text-properties s (1+ s) '(display t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10525 (setq s 1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10526 (while (setq s (text-property-any s (point-max) 'org-cwidth 1))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10527 (remove-text-properties s (1+ s) '(org-cwidth t)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10528 (setq s 1)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10529 (while (setq s (text-property-any s (point-max) 'invisible 'org-cwidth))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10530 (remove-text-properties s (1+ s) '(invisible t)))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10531
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10532 ;; Install it as a minor mode.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10533 (put 'orgtbl-mode :included t)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10534 (put 'orgtbl-mode :menu-tag "Org Table Mode")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10535 (add-minor-mode 'orgtbl-mode " OrgTbl" orgtbl-mode-map)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10536
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10537 (defun orgtbl-make-binding (fun n &rest keys)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10538 "Create a function for binding in the table minor mode.
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
10539 FUN is the command to call inside a table. N is used to create a unique
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
10540 command name. KEYS are keys that should be checked in for a command
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10541 to execute outside of tables."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10542 (eval
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
10543 (list 'defun
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10544 (intern (concat "orgtbl-hijacker-command-" (int-to-string n)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10545 '(arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10546 (concat "In tables, run `" (symbol-name fun) "'.\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10547 "Outside of tables, run the binding of `"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10548 (mapconcat (lambda (x) (format "%s" x)) keys "' or `")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10549 "'.")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10550 '(interactive "p")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10551 (list 'if
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10552 '(org-at-table-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10553 (list 'call-interactively (list 'quote fun))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10554 (list 'let '(orgtbl-mode)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10555 (list 'call-interactively
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10556 (append '(or)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10557 (mapcar (lambda (k)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10558 (list 'key-binding k))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10559 keys)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10560 '('orgtbl-error))))))))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10561
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10562 (defun orgtbl-error ()
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10563 "Error when there is no default binding for a table key."
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10564 (interactive)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10565 (error "This key is has no function outside tables"))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10566
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10567 (defun orgtbl-setup ()
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10568 "Setup orgtbl keymaps."
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10569 (let ((nfunc 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10570 (bindings
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10571 (list
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10572 '([(meta shift left)] org-table-delete-column)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10573 '([(meta left)] org-table-move-column-left)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10574 '([(meta right)] org-table-move-column-right)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10575 '([(meta shift right)] org-table-insert-column)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10576 '([(meta shift up)] org-table-kill-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10577 '([(meta shift down)] org-table-insert-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10578 '([(meta up)] org-table-move-row-up)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10579 '([(meta down)] org-table-move-row-down)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10580 '("\C-c\C-w" org-table-cut-region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10581 '("\C-c\M-w" org-table-copy-region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10582 '("\C-c\C-y" org-table-paste-rectangle)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10583 '("\C-c-" org-table-insert-hline)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10584 ; '([(shift tab)] org-table-previous-field)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10585 '("\C-m" org-table-next-row)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10586 (list (org-key 'S-return) 'org-table-copy-down)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10587 '([(meta return)] org-table-wrap-region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10588 '("\C-c\C-q" org-table-wrap-region)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10589 '("\C-c?" org-table-current-column)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10590 '("\C-c " org-table-blank-field)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10591 '("\C-c+" org-table-sum)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10592 '("\C-c=" org-table-eval-formula)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10593 '("\C-c'" org-table-edit-formulas)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10594 '("\C-c`" org-table-edit-field)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10595 '("\C-c*" org-table-recalculate)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10596 '("\C-c|" org-table-create-or-convert-from-region)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10597 '("\C-c^" org-table-sort-lines)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10598 '([(control ?#)] org-table-rotate-recalc-marks)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10599 elt key fun cmd)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10600 (while (setq elt (pop bindings))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10601 (setq nfunc (1+ nfunc))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10602 (setq key (car elt)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10603 fun (nth 1 elt)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10604 cmd (orgtbl-make-binding fun nfunc key))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10605 (define-key orgtbl-mode-map key cmd))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10606 ;; Special treatment needed for TAB and RET
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
10607 (define-key orgtbl-mode-map [(return)]
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10608 (orgtbl-make-binding 'orgtbl-ret 100 [(return)] "\C-m"))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
10609 (define-key orgtbl-mode-map "\C-m"
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10610 (orgtbl-make-binding 'orgtbl-ret 101 "\C-m" [(return)]))
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
10611 (define-key orgtbl-mode-map [(tab)]
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10612 (orgtbl-make-binding 'orgtbl-tab 102 [(tab)] "\C-i"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10613 (define-key orgtbl-mode-map "\C-i"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10614 (orgtbl-make-binding 'orgtbl-tab 103 "\C-i" [(tab)])))
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10615 (define-key orgtbl-mode-map "\C-i"
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10616 (orgtbl-make-binding 'orgtbl-tab 104 [(shift tab)]))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10617 (define-key orgtbl-mode-map "\C-c\C-c"
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10618 (orgtbl-make-binding 'org-ctrl-c-ctrl-c 105 "\C-c\C-c"))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10619 (when orgtbl-optimized
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10620 ;; If the user wants maximum table support, we need to hijack
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10621 ;; some standard editing functions
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10622 (org-remap orgtbl-mode-map
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10623 'self-insert-command 'orgtbl-self-insert-command
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10624 'delete-char 'org-delete-char
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10625 'delete-backward-char 'org-delete-backward-char)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10626 (define-key orgtbl-mode-map "|" 'org-force-self-insert))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10627 (easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10628 '("OrgTbl"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10629 ["Align" org-ctrl-c-ctrl-c :active (org-at-table-p) :keys "C-c C-c"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10630 ["Next Field" org-cycle :active (org-at-table-p) :keys "TAB"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10631 ["Previous Field" org-shifttab :active (org-at-table-p) :keys "S-TAB"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10632 ["Next Row" org-return :active (org-at-table-p) :keys "RET"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10633 "--"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10634 ["Blank Field" org-table-blank-field :active (org-at-table-p) :keys "C-c SPC"]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10635 ["Edit Field" org-table-edit-field :active (org-at-table-p) :keys "C-c ` "]
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10636 ["Copy Field from Above"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10637 org-table-copy-down :active (org-at-table-p) :keys "S-RET"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10638 "--"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10639 ("Column"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10640 ["Move Column Left" org-metaleft :active (org-at-table-p) :keys "M-<left>"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10641 ["Move Column Right" org-metaright :active (org-at-table-p) :keys "M-<right>"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10642 ["Delete Column" org-shiftmetaleft :active (org-at-table-p) :keys "M-S-<left>"]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10643 ["Insert Column" org-shiftmetaright :active (org-at-table-p) :keys "M-S-<right>"]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10644 "--"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10645 ["Enable Narrowing" (setq org-table-limit-column-width (not org-table-limit-column-width)) :active (org-at-table-p) :selected org-table-limit-column-width :style toggle])
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10646 ("Row"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10647 ["Move Row Up" org-metaup :active (org-at-table-p) :keys "M-<up>"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10648 ["Move Row Down" org-metadown :active (org-at-table-p) :keys "M-<down>"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10649 ["Delete Row" org-shiftmetaup :active (org-at-table-p) :keys "M-S-<up>"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10650 ["Insert Row" org-shiftmetadown :active (org-at-table-p) :keys "M-S-<down>"]
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
10651 ["Sort lines in region" org-table-sort-lines (org-at-table-p) :keys "C-c ^"]
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10652 "--"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10653 ["Insert Hline" org-table-insert-hline :active (org-at-table-p) :keys "C-c -"])
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10654 ("Rectangle"
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
10655 ["Copy Rectangle" org-copy-special :active (org-at-table-p)]
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
10656 ["Cut Rectangle" org-cut-special :active (org-at-table-p)]
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
10657 ["Paste Rectangle" org-paste-special :active (org-at-table-p)]
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
10658 ["Fill Rectangle" org-table-wrap-region :active (org-at-table-p)])
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10659 "--"
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10660 ["Set Column Formula" org-table-eval-formula :active (org-at-table-p) :keys "C-c ="]
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10661 ["Set Named Field Formula" (org-table-eval-formula '(4)) :active (org-at-table-p) :keys "C-u C-c ="]
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
10662 ["Edit Formulas" org-table-edit-formulas :active (org-at-table-p) :keys "C-c '"]
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10663 ["Recalculate line" org-table-recalculate :active (org-at-table-p) :keys "C-c *"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10664 ["Recalculate all" (org-table-recalculate '(4)) :active (org-at-table-p) :keys "C-u C-c *"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10665 ["Toggle Recalculate Mark" org-table-rotate-recalc-marks :active (org-at-table-p) :keys "C-c #"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10666 ["Sum Column/Rectangle" org-table-sum
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10667 :active (or (org-at-table-p) (org-region-active-p)) :keys "C-c +"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10668 ["Which Column?" org-table-current-column :active (org-at-table-p) :keys "C-c ?"]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10669 ["Debug Formulas"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10670 (setq org-table-formula-debug (not org-table-formula-debug))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10671 :style toggle :selected org-table-formula-debug]
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10672 ))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
10673 t)
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10674
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10675 (defun orgtbl-tab (arg)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10676 "Justification and field motion for `orgtbl-mode'."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10677 (interactive "P")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10678 (if arg (org-table-edit-field t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10679 (org-table-justify-field-maybe)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
10680 (org-table-next-field)))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10681
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10682 (defun orgtbl-ret ()
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10683 "Justification and field motion for `orgtbl-mode'."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10684 (interactive)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10685 (org-table-justify-field-maybe)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10686 (org-table-next-row))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10687
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10688 (defun orgtbl-self-insert-command (N)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10689 "Like `self-insert-command', use overwrite-mode for whitespace in tables.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10690 If the cursor is in a table looking at whitespace, the whitespace is
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10691 overwritten, and the table is not marked as requiring realignment."
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10692 (interactive "p")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10693 (if (and (org-at-table-p)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10694 (or
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10695 (and org-table-auto-blank-field
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10696 (member last-command
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10697 '(orgtbl-hijacker-command-100
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10698 orgtbl-hijacker-command-101
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10699 orgtbl-hijacker-command-102
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10700 orgtbl-hijacker-command-103
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10701 orgtbl-hijacker-command-104
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10702 orgtbl-hijacker-command-105))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10703 (org-table-blank-field))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10704 t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10705 (eq N 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10706 (looking-at "[^|\n]* +|"))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
10707 (let (org-table-may-need-update)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10708 (goto-char (1- (match-end 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10709 (delete-backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10710 (goto-char (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10711 (self-insert-command N))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10712 (setq org-table-may-need-update t)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10713 (let (orgtbl-mode)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10714 (call-interactively (key-binding (vector last-input-event))))))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
10715
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10716 (defun org-force-self-insert (N)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10717 "Needed to enforce self-insert under remapping."
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10718 (interactive "p")
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10719 (self-insert-command N))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
10720
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10721 ;;; Exporting
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10722
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10723 (defconst org-level-max 20)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10724
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10725 (defun org-export-find-first-heading-line (list)
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
10726 "Remove all lines from LIST which are before the first headline."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10727 (let ((orig-list list)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10728 (re (concat "^" outline-regexp)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10729 (while (and list
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10730 (not (string-match re (car list))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10731 (pop list))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10732 (or list orig-list)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10733
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10734 (defun org-skip-comments (lines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10735 "Skip lines starting with \"#\" and subtrees starting with COMMENT."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10736 (let ((re1 (concat "^\\(\\*+\\)[ \t]+" org-comment-string))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10737 (re2 "^\\(\\*+\\)[ \t\n\r]")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10738 rtn line level)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10739 (while (setq line (pop lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10740 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10741 ((and (string-match re1 line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10742 (setq level (- (match-end 1) (match-beginning 1))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10743 ;; Beginning of a COMMENT subtree. Skip it.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10744 (while (and (setq line (pop lines))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10745 (or (not (string-match re2 line))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10746 (> (- (match-end 1) (match-beginning 1)) level))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10747 (setq lines (cons line lines)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10748 ((string-match "^#" line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10749 ;; an ordinary comment line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
10750 )
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
10751 ((and org-export-table-remove-special-lines
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
10752 (string-match "^[ \t]*| *[!_^] *|" line))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
10753 ;; a special table line that should be removed
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
10754 )
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10755 (t (setq rtn (cons line rtn)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10756 (nreverse rtn)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10757
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10758 ;; ASCII
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10759
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10760 (defconst org-ascii-underline '(?\$ ?\# ?^ ?\~ ?\= ?\-)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10761 "Characters for underlining headings in ASCII export.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10762
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10763 (defconst org-html-entities
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10764 '(("nbsp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10765 ("iexcl")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10766 ("cent")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10767 ("pound")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10768 ("curren")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10769 ("yen")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10770 ("brvbar")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10771 ("sect")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10772 ("uml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10773 ("copy")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10774 ("ordf")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10775 ("laquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10776 ("not")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10777 ("shy")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10778 ("reg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10779 ("macr")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10780 ("deg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10781 ("plusmn")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10782 ("sup2")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10783 ("sup3")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10784 ("acute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10785 ("micro")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10786 ("para")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10787 ("middot")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10788 ("odot"."o")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10789 ("star"."*")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10790 ("cedil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10791 ("sup1")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10792 ("ordm")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10793 ("raquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10794 ("frac14")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10795 ("frac12")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10796 ("frac34")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10797 ("iquest")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10798 ("Agrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10799 ("Aacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10800 ("Acirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10801 ("Atilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10802 ("Auml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10803 ("Aring") ("AA"."&Aring;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10804 ("AElig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10805 ("Ccedil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10806 ("Egrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10807 ("Eacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10808 ("Ecirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10809 ("Euml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10810 ("Igrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10811 ("Iacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10812 ("Icirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10813 ("Iuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10814 ("ETH")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10815 ("Ntilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10816 ("Ograve")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10817 ("Oacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10818 ("Ocirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10819 ("Otilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10820 ("Ouml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10821 ("times")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10822 ("Oslash")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10823 ("Ugrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10824 ("Uacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10825 ("Ucirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10826 ("Uuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10827 ("Yacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10828 ("THORN")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10829 ("szlig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10830 ("agrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10831 ("aacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10832 ("acirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10833 ("atilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10834 ("auml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10835 ("aring")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10836 ("aelig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10837 ("ccedil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10838 ("egrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10839 ("eacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10840 ("ecirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10841 ("euml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10842 ("igrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10843 ("iacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10844 ("icirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10845 ("iuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10846 ("eth")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10847 ("ntilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10848 ("ograve")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10849 ("oacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10850 ("ocirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10851 ("otilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10852 ("ouml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10853 ("divide")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10854 ("oslash")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10855 ("ugrave")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10856 ("uacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10857 ("ucirc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10858 ("uuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10859 ("yacute")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10860 ("thorn")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10861 ("yuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10862 ("fnof")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10863 ("Alpha")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10864 ("Beta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10865 ("Gamma")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10866 ("Delta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10867 ("Epsilon")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10868 ("Zeta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10869 ("Eta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10870 ("Theta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10871 ("Iota")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10872 ("Kappa")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10873 ("Lambda")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10874 ("Mu")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10875 ("Nu")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10876 ("Xi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10877 ("Omicron")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10878 ("Pi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10879 ("Rho")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10880 ("Sigma")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10881 ("Tau")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10882 ("Upsilon")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10883 ("Phi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10884 ("Chi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10885 ("Psi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10886 ("Omega")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10887 ("alpha")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10888 ("beta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10889 ("gamma")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10890 ("delta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10891 ("epsilon")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10892 ("varepsilon"."&epsilon;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10893 ("zeta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10894 ("eta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10895 ("theta")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10896 ("iota")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10897 ("kappa")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10898 ("lambda")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10899 ("mu")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10900 ("nu")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10901 ("xi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10902 ("omicron")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10903 ("pi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10904 ("rho")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10905 ("sigmaf") ("varsigma"."&sigmaf;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10906 ("sigma")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10907 ("tau")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10908 ("upsilon")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10909 ("phi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10910 ("chi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10911 ("psi")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10912 ("omega")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10913 ("thetasym") ("vartheta"."&thetasym;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10914 ("upsih")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10915 ("piv")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10916 ("bull") ("bullet"."&bull;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10917 ("hellip") ("dots"."&hellip;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10918 ("prime")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10919 ("Prime")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10920 ("oline")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10921 ("frasl")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10922 ("weierp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10923 ("image")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10924 ("real")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10925 ("trade")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10926 ("alefsym")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10927 ("larr") ("leftarrow"."&larr;") ("gets"."&larr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10928 ("uarr") ("uparrow"."&uarr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10929 ("rarr") ("to"."&rarr;") ("rightarrow"."&rarr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10930 ("darr")("downarrow"."&darr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10931 ("harr") ("leftrightarrow"."&harr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10932 ("crarr") ("hookleftarrow"."&crarr;") ; has round hook, not quite CR
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10933 ("lArr") ("Leftarrow"."&lArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10934 ("uArr") ("Uparrow"."&uArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10935 ("rArr") ("Rightarrow"."&rArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10936 ("dArr") ("Downarrow"."&dArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10937 ("hArr") ("Leftrightarrow"."&hArr;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10938 ("forall")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10939 ("part") ("partial"."&part;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10940 ("exist") ("exists"."&exist;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10941 ("empty") ("emptyset"."&empty;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10942 ("nabla")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10943 ("isin") ("in"."&isin;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10944 ("notin")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10945 ("ni")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10946 ("prod")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10947 ("sum")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10948 ("minus")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10949 ("lowast") ("ast"."&lowast;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10950 ("radic")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10951 ("prop") ("proptp"."&prop;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10952 ("infin") ("infty"."&infin;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10953 ("ang") ("angle"."&ang;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10954 ("and") ("vee"."&and;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10955 ("or") ("wedge"."&or;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10956 ("cap")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10957 ("cup")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10958 ("int")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10959 ("there4")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10960 ("sim")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10961 ("cong") ("simeq"."&cong;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10962 ("asymp")("approx"."&asymp;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10963 ("ne") ("neq"."&ne;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10964 ("equiv")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10965 ("le")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10966 ("ge")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10967 ("sub") ("subset"."&sub;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10968 ("sup") ("supset"."&sup;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10969 ("nsub")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10970 ("sube")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10971 ("supe")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10972 ("oplus")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10973 ("otimes")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10974 ("perp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10975 ("sdot") ("cdot"."&sdot;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10976 ("lceil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10977 ("rceil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10978 ("lfloor")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10979 ("rfloor")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10980 ("lang")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10981 ("rang")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10982 ("loz") ("Diamond"."&loz;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10983 ("spades") ("spadesuit"."&spades;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10984 ("clubs") ("clubsuit"."&clubs;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10985 ("hearts") ("diamondsuit"."&hearts;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10986 ("diams") ("diamondsuit"."&diams;")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10987 ("quot")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10988 ("amp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10989 ("lt")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10990 ("gt")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10991 ("OElig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10992 ("oelig")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10993 ("Scaron")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10994 ("scaron")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10995 ("Yuml")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10996 ("circ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10997 ("tilde")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10998 ("ensp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10999 ("emsp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11000 ("thinsp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11001 ("zwnj")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11002 ("zwj")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11003 ("lrm")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11004 ("rlm")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11005 ("ndash")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11006 ("mdash")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11007 ("lsquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11008 ("rsquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11009 ("sbquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11010 ("ldquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11011 ("rdquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11012 ("bdquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11013 ("dagger")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11014 ("Dagger")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11015 ("permil")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11016 ("lsaquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11017 ("rsaquo")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11018 ("euro")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11019
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11020 ("arccos"."arccos")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11021 ("arcsin"."arcsin")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11022 ("arctan"."arctan")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11023 ("arg"."arg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11024 ("cos"."cos")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11025 ("cosh"."cosh")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11026 ("cot"."cot")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11027 ("coth"."coth")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11028 ("csc"."csc")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11029 ("deg"."deg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11030 ("det"."det")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11031 ("dim"."dim")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11032 ("exp"."exp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11033 ("gcd"."gcd")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11034 ("hom"."hom")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11035 ("inf"."inf")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11036 ("ker"."ker")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11037 ("lg"."lg")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11038 ("lim"."lim")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11039 ("liminf"."liminf")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11040 ("limsup"."limsup")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11041 ("ln"."ln")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11042 ("log"."log")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11043 ("max"."max")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11044 ("min"."min")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11045 ("Pr"."Pr")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11046 ("sec"."sec")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11047 ("sin"."sin")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11048 ("sinh"."sinh")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11049 ("sup"."sup")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11050 ("tan"."tan")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11051 ("tanh"."tanh")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11052 )
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11053 "Entities for TeX->HTML translation.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11054 Entries can be like (\"ent\"), in which case \"\\ent\" will be translated to
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11055 \"&ent;\". An entry can also be a dotted pair like (\"ent\".\"&other;\").
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11056 In that case, \"\\ent\" will be translated to \"&other;\".
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11057 The list contains HTML entities for Latin-1, Greek and other symbols.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11058 It is supplemented by a number of commonly used TeX macros with appropriate
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
11059 translations. There is currently no way for users to extend this.")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11060
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11061 (defun org-cleaned-string-for-export (string)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11062 "Cleanup a buffer substring so that links can be created safely."
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11063 (interactive)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11064 (let* ((cb (current-buffer))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11065 (re-radio (and org-target-link-regexp
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11066 (concat "\\([^<]\\)\\(" org-target-link-regexp "\\)")))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11067 (re-plain-link (concat "\\([^[<]\\)" org-plain-link-re))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11068 (re-angle-link (concat "\\([^[]\\)" org-angle-link-re))
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11069 rtn)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11070 (save-excursion
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11071 (set-buffer (get-buffer-create " org-mode-tmp"))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11072 (erase-buffer)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11073 (insert string)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11074 (org-mode)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11075 ;; Find targets in comments and move them out of comments,
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11076 ;; but mark them as targets that should be invisible
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11077 (goto-char (point-min))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11078 (while (re-search-forward "^#.*?\\(<<<?[^>\r\n]+>>>?\\).*" nil t)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11079 (replace-match "\\1(INVISIBLE)"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11080 ;; Find matches for radio targets and turn them into internal links
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11081 (goto-char (point-min))
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11082 (when re-radio
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11083 (while (re-search-forward re-radio nil t)
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11084 (replace-match "\\1[[\\2]]")))
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11085 ;; Find all links that contain a newline and put them into a single line
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11086 (goto-char (point-min))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11087 (while (re-search-forward "\\(\\(\\[\\|\\]\\)\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\(\\[\\|\\]\\)\\)" nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11088 (replace-match "\\1 \\3")
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11089 (goto-char (match-beginning 0)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11090 ;; Normalize links: Convert angle and plain links into bracket links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11091 (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11092 (while (re-search-forward re-plain-link nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11093 (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11094 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11095 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11096 t t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11097 (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11098 (while (re-search-forward re-angle-link nil t)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11099 (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11100 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11101 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11102 t t))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11103
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11104 ;; Remove comments
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11105 (goto-char (point-min))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11106 (while (re-search-forward "^#.*\n?" nil t)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11107 (replace-match ""))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11108 (setq rtn (buffer-string)))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11109 (kill-buffer " org-mode-tmp")
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11110 rtn))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11111
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11112 (defun org-solidify-link-text (s &optional alist)
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11113 "Take link text and make a safe target out of it."
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11114 (save-match-data
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11115 (let* ((rtn
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11116 (mapconcat
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11117 'identity
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11118 (org-split-string s "[ \t\r\n]+") "--"))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11119 (a (assoc rtn alist)))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11120 (or (cdr a) rtn))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11121
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11122 (defun org-convert-to-odd-levels ()
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11123 "Convert an org-mode file with all levels allowed to one with odd levels.
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11124 This will leave level 1 alone, convert level 2 to level 3, level 3 to
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11125 level 5 etc."
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11126 (interactive)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11127 (when (yes-or-no-p "Are you sure you want to globally change levels to odd? ")
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11128 (let ((org-odd-levels-only nil) n)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11129 (save-excursion
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11130 (goto-char (point-min))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11131 (while (re-search-forward "^\\*\\*+" nil t)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11132 (setq n (1- (length (match-string 0))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11133 (while (>= (setq n (1- n)) 0)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11134 (org-demote))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11135 (end-of-line 1))))))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11136
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11137
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11138 (defun org-convert-to-oddeven-levels ()
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11139 "Convert an org-mode file with only odd levels to one with odd and even levels.
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11140 This promotes level 3 to level 2, level 5 to level 3 etc. If the file contains a
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11141 section with an even level, conversion would destroy the structure of the file. An error
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11142 is signaled in this case."
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11143 (interactive)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11144 (goto-char (point-min))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11145 ;; First check if there are no even levels
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11146 (when (re-search-forward "^\\(\\*\\*\\)+[^*]" nil t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11147 (org-show-hierarchy-above)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11148 (error "Not all levels are odd in this file. Conversion not possible."))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11149 (when (yes-or-no-p "Are you sure you want to globally change levels to odd-even? ")
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11150 (let ((org-odd-levels-only nil) n)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11151 (save-excursion
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11152 (goto-char (point-min))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11153 (while (re-search-forward "^\\*\\*+" nil t)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11154 (setq n (/ (length (match-string 0)) 2))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11155 (while (>= (setq n (1- n)) 0)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11156 (org-promote))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11157 (end-of-line 1))))))
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11158
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11159 (defun org-tr-level (n)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11160 "Make N odd if required."
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11161 (if org-odd-levels-only (1+ (/ n 2)) n))
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11162
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11163 (defvar org-last-level nil) ; dynamically scoped variable
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11164
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11165 (defun org-export-as-ascii (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11166 "Export the outline as a pretty ASCII file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11167 If there is an active region, export only the region.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11168 The prefix ARG specifies how many levels of the outline should become
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11169 underlined headlines. The default is 3."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11170 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11171 (setq-default org-todo-line-regexp org-todo-line-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11172 (let* ((region
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11173 (buffer-substring
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11174 (if (org-region-active-p) (region-beginning) (point-min))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11175 (if (org-region-active-p) (region-end) (point-max))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11176 (lines (org-export-find-first-heading-line
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11177 (org-skip-comments
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11178 (org-split-string
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11179 (org-cleaned-string-for-export region)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11180 "[\r\n]"))))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11181 (org-startup-with-deadline-check nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11182 (level 0) line txt
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11183 (umax nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11184 (case-fold-search nil)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11185 (filename (concat (file-name-sans-extension buffer-file-name)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11186 ".txt"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11187 (buffer (find-file-noselect filename))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11188 (levels-open (make-vector org-level-max nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11189 (date (format-time-string "%Y/%m/%d" (current-time)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11190 (time (format-time-string "%X" (org-current-time)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11191 (author user-full-name)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11192 (title (buffer-name))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11193 (options nil)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11194 (email user-mail-address)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11195 (language org-export-default-language)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11196 (text nil)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11197 (todo nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11198 (lang-words nil))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11199
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11200 (setq org-last-level 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11201 (org-init-section-numbers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11202
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11203 (find-file-noselect filename)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11204
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11205 ;; Search for the export key lines
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11206 (org-parse-key-lines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11207
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11208 (setq lang-words (or (assoc language org-export-language-setup)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11209 (assoc "en" org-export-language-setup)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11210 (if org-export-ascii-show-new-buffer
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11211 (switch-to-buffer-other-window buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11212 (set-buffer buffer))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11213 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11214 (fundamental-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11215 (if options (org-parse-export-options options))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11216 (setq umax (if arg (prefix-numeric-value arg)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11217 org-export-headline-levels))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11218
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11219 ;; File header
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11220 (if title (org-insert-centered title ?=))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11221 (insert "\n")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11222 (if (or author email)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11223 (insert (concat (nth 1 lang-words) ": " (or author "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11224 (if email (concat " <" email ">") "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11225 "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11226 (if (and date time)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11227 (insert (concat (nth 2 lang-words) ": " date " " time "\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11228 (if text (insert (concat (org-html-expand-for-ascii text) "\n\n")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11229
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11230 (insert "\n\n")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11231
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11232 (if org-export-with-toc
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11233 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11234 (insert (nth 3 lang-words) "\n"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11235 (make-string (length (nth 3 lang-words)) ?=) "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11236 (mapcar '(lambda (line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11237 (if (string-match org-todo-line-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11238 line)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11239 ;; This is a headline
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11240 (progn
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11241 (setq level (- (match-end 1) (match-beginning 1))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11242 level (org-tr-level level)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11243 txt (match-string 3 line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11244 todo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11245 (or (and (match-beginning 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11246 (not (equal (match-string 2 line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11247 org-done-string)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11248 ; TODO, not DONE
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11249 (and org-export-mark-todo-in-toc
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11250 (= level umax)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11251 (org-search-todo-below
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11252 line lines level))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11253 (setq txt (org-html-expand-for-ascii txt))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11254
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11255 (if org-export-with-section-numbers
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11256 (setq txt (concat (org-section-number level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11257 " " txt)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11258 (if (<= level umax)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11259 (progn
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11260 (insert
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11261 (make-string (* (1- level) 4) ?\ )
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11262 (format (if todo "%s (*)\n" "%s\n") txt))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11263 (setq org-last-level level))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11264 ))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11265 lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11266
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11267 (org-init-section-numbers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11268 (while (setq line (pop lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11269 ;; Remove the quoted HTML tags.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11270 (setq line (org-html-expand-for-ascii line))
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11271 ;; Remove targets
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11272 (while (string-match "<<<?[^<>]*>>>?[ \t]*\n?" line)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11273 (setq line (replace-match "" t t line)))
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11274 ;; Replace internal links
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11275 (while (string-match org-bracket-link-regexp line)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11276 (setq line (replace-match
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11277 (if (match-end 3) "[\\3]" "[\\1]")
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11278 t nil line)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11279 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11280 ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11281 ;; a Headline
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11282 (setq level (org-tr-level (- (match-end 1) (match-beginning 1)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11283 txt (match-string 2 line))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11284 (org-ascii-level-start level txt umax))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11285 (t (insert line "\n"))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11286 (normal-mode)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11287 (save-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11288 (goto-char (point-min))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11289
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11290 (defun org-search-todo-below (line lines level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11291 "Search the subtree below LINE for any TODO entries."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11292 (let ((rest (cdr (memq line lines)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11293 (re org-todo-line-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11294 line lv todo)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11295 (catch 'exit
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11296 (while (setq line (pop rest))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11297 (if (string-match re line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11298 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11299 (setq lv (- (match-end 1) (match-beginning 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11300 todo (and (match-beginning 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11301 (not (equal (match-string 2 line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11302 org-done-string))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11303 ; TODO, not DONE
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11304 (if (<= lv level) (throw 'exit nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11305 (if todo (throw 'exit t))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11306
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11307 ;; FIXME: Try to handle <b> and <i> as faces via text properties.
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11308 ;; We could also implement *bold*,/italic/ and _underline_ for ASCII export
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11309 (defun org-html-expand-for-ascii (line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11310 "Handle quoted HTML for ASCII export."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11311 (if org-export-html-expand
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11312 (while (string-match "@<[^<>\n]*>" line)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11313 ;; We just remove the tags for now.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11314 (setq line (replace-match "" nil nil line))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11315 line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11316
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11317 (defun org-insert-centered (s &optional underline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11318 "Insert the string S centered and underline it with character UNDERLINE."
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
11319 (let ((ind (max (/ (- 80 (string-width s)) 2) 0)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11320 (insert (make-string ind ?\ ) s "\n")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11321 (if underline
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11322 (insert (make-string ind ?\ )
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
11323 (make-string (string-width s) underline)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11324 "\n"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11325
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11326 (defun org-ascii-level-start (level title umax)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11327 "Insert a new level in ASCII export."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11328 (let (char)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11329 (if (> level umax)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11330 (insert (make-string (* 2 (- level umax 1)) ?\ ) "* " title "\n")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11331 (if (or (not (equal (char-before) ?\n))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11332 (not (equal (char-before (1- (point))) ?\n)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11333 (insert "\n"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11334 (setq char (nth (- umax level) (reverse org-ascii-underline)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11335 (if org-export-with-section-numbers
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11336 (setq title (concat (org-section-number level) " " title)))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11337 (insert title "\n" (make-string (string-width title) char) "\n"))))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11338
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11339 (defun org-export-copy-visible ()
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11340 "Copy the visible part of the buffer to another buffer, for printing.
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
11341 Also removes the first line of the buffer if it specifies a mode,
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11342 and all options lines."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11343 (interactive)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11344 (let* ((filename (concat (file-name-sans-extension buffer-file-name)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11345 ".txt"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11346 (buffer (find-file-noselect filename))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11347 (ore (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11348 (org-make-options-regexp
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11349 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11350 "STARTUP" "ARCHIVE"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11351 "TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11352 (if org-noutline-p "\\(\n\\|$\\)" "")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11353 s e)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11354 (with-current-buffer buffer
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11355 (erase-buffer)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11356 (text-mode))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11357 (save-excursion
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11358 (setq s (goto-char (point-min)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11359 (while (not (= (point) (point-max)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11360 (goto-char (org-find-invisible))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11361 (append-to-buffer buffer s (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11362 (setq s (goto-char (org-find-visible)))))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11363 (switch-to-buffer-other-window buffer)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11364 (newline)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11365 (goto-char (point-min))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11366 (if (looking-at ".*-\\*- mode:.*\n")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11367 (replace-match ""))
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11368 (while (re-search-forward ore nil t)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11369 (replace-match ""))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11370 (goto-char (point-min))))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11371
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11372 (defun org-find-visible ()
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11373 (if (featurep 'noutline)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11374 (let ((s (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11375 (while (and (not (= (point-max) (setq s (next-overlay-change s))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11376 (get-char-property s 'invisible)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11377 s)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11378 (skip-chars-forward "^\n")
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11379 (point)))
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11380 (defun org-find-invisible ()
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11381 (if (featurep 'noutline)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11382 (let ((s (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11383 (while (and (not (= (point-max) (setq s (next-overlay-change s))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11384 (not (get-char-property s 'invisible))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11385 s)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11386 (skip-chars-forward "^\r")
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
11387 (point)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11388
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11389 ;; HTML
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11390
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11391 (defun org-get-current-options ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11392 "Return a string with current options as keyword options.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11393 Does include HTML export options as well as TODO and CATEGORY stuff."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11394 (format
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11395 "#+TITLE: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11396 #+AUTHOR: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11397 #+EMAIL: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11398 #+LANGUAGE: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11399 #+TEXT: Some descriptive text to be emitted. Several lines OK.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11400 #+OPTIONS: H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s *:%s TeX:%s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11401 #+CATEGORY: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11402 #+SEQ_TODO: %s
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11403 #+TYP_TODO: %s
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11404 #+STARTUP: %s %s %s %s %s
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
11405 #+ARCHIVE: %s
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11406 "
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11407 (buffer-name) (user-full-name) user-mail-address org-export-default-language
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11408 org-export-headline-levels
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11409 org-export-with-section-numbers
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11410 org-export-with-toc
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11411 org-export-preserve-breaks
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11412 org-export-html-expand
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11413 org-export-with-fixed-width
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11414 org-export-with-tables
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11415 org-export-with-sub-superscripts
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11416 org-export-with-emphasize
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11417 org-export-with-TeX-macros
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11418 (file-name-nondirectory buffer-file-name)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11419 (if (equal org-todo-interpretation 'sequence)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11420 (mapconcat 'identity org-todo-keywords " ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11421 "TODO FEEDBACK VERIFY DONE")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11422 (if (equal org-todo-interpretation 'type)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11423 (mapconcat 'identity org-todo-keywords " ")
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11424 "Me Jason Marie DONE")
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
11425 (cdr (assoc org-startup-folded
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
11426 '((nil . "showall") (t . "overview") (content . "content"))))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11427 (if org-startup-with-deadline-check "dlcheck" "nodlcheck")
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11428 (if org-odd-levels-only "odd" "oddeven")
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11429 (if org-hide-leading-stars "hidestars" "showstars")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11430 (if org-startup-align-all-tables "align" "noalign")
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
11431 org-archive-location
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
11432 ))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11433
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11434 (defun org-insert-export-options-template ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11435 "Insert into the buffer a template with information for exporting."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11436 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11437 (if (not (bolp)) (newline))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11438 (let ((s (org-get-current-options)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11439 (and (string-match "#\\+CATEGORY" s)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11440 (setq s (substring s 0 (match-beginning 0))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11441 (insert s)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11442
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11443 (defun org-toggle-fixed-width-section (arg)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11444 "Toggle the fixed-width export.
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11445 If there is no active region, the QUOTE keyword at the current headline is
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11446 inserted or removed. When present, it causes the text between this headline
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11447 and the next to be exported as fixed-width text, and unmodified.
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11448 If there is an active region, this command adds or removes a colon as the
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11449 first character of this line. If the first character of a line is a colon,
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11450 this line is also exported in fixed-width font."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11451 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11452 (let* ((cc 0)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11453 (regionp (org-region-active-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11454 (beg (if regionp (region-beginning) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11455 (end (if regionp (region-end)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11456 (nlines (or arg (if (and beg end) (count-lines beg end) 1)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11457 (re "[ \t]*\\(:\\)")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11458 off)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11459 (if regionp
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11460 (save-excursion
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11461 (goto-char beg)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11462 (setq cc (current-column))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11463 (beginning-of-line 1)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11464 (setq off (looking-at re))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11465 (while (> nlines 0)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11466 (setq nlines (1- nlines))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11467 (beginning-of-line 1)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11468 (cond
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11469 (arg
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11470 (move-to-column cc t)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11471 (insert ":\n")
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11472 (forward-line -1))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11473 ((and off (looking-at re))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11474 (replace-match "" t t nil 1))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11475 ((not off) (move-to-column cc t) (insert ":")))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11476 (forward-line 1)))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11477 (save-excursion
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11478 (org-back-to-heading)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11479 (if (looking-at (concat outline-regexp
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11480 "\\( +\\<" org-quote-string "\\>\\)"))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11481 (replace-match "" t t nil 1)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11482 (if (looking-at outline-regexp)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11483 (progn
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11484 (goto-char (match-end 0))
65264
a95981ee377b (calc-embedded-close-formula, calc-embedded-open-formula,
Juanma Barranquero <lekktu@gmail.com>
parents: 65243
diff changeset
11485 (insert " " org-quote-string))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11486
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11487 (defun org-export-as-html-and-open (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11488 "Export the outline as HTML and immediately open it with a browser.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11489 If there is an active region, export only the region.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11490 The prefix ARG specifies how many levels of the outline should become
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11491 headlines. The default is 3. Lower levels will become bulleted lists."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11492 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11493 (org-export-as-html arg 'hidden)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11494 (org-open-file buffer-file-name))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11495
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11496 (defun org-export-as-html-batch ()
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11497 "Call `org-export-as-html', may be used in batch processing as
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11498 emacs --batch
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11499 --load=$HOME/lib/emacs/org.el
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11500 --eval \"(setq org-export-headline-levels 2)\"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11501 --visit=MyFile --funcall org-export-as-html-batch"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11502 (org-export-as-html org-export-headline-levels 'hidden))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11503
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11504 (defun org-export-as-html (arg &optional hidden)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11505 "Export the outline as a pretty HTML file.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11506 If there is an active region, export only the region.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11507 The prefix ARG specifies how many levels of the outline should become
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11508 headlines. The default is 3. Lower levels will become bulleted lists."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11509 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11510 (setq-default org-todo-line-regexp org-todo-line-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11511 (setq-default org-deadline-line-regexp org-deadline-line-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11512 (setq-default org-done-string org-done-string)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11513 (let* ((style org-export-html-style)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11514 (odd org-odd-levels-only)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11515 (region-p (org-region-active-p))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11516 (region
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11517 (buffer-substring
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11518 (if region-p (region-beginning) (point-min))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11519 (if region-p (region-end) (point-max))))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11520 (all_lines
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11521 (org-skip-comments (org-split-string
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11522 (org-cleaned-string-for-export region)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11523 "[\r\n]")))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11524 (lines (org-export-find-first-heading-line all_lines))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11525 (level 0) (line "") (origline "") txt todo
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11526 (umax nil)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
11527 (filename (concat (file-name-sans-extension buffer-file-name)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11528 ".html"))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11529 (buffer (find-file-noselect filename))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11530 (levels-open (make-vector org-level-max nil))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11531 (date (format-time-string "%Y/%m/%d" (current-time)))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11532 (time (format-time-string "%X" (org-current-time)))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11533 (author user-full-name)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11534 (title (buffer-name))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11535 (options nil)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11536 (quote-re (concat "^\\*+[ \t]*" org-quote-string "\\>"))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11537 (inquote nil)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11538 (infixed nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11539 (in-local-list nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11540 (local-list-num nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11541 (local-list-indent nil)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11542 (llt org-plain-list-ordered-item-terminator)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11543 (email user-mail-address)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11544 (language org-export-default-language)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11545 (text nil)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11546 (lang-words nil)
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11547 (target-alist nil) tg
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11548 (head-count 0) cnt
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11549 (start 0)
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
11550 ;; FIXME: The following returns always nil under XEmacs
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
11551 (coding-system (and (fboundp 'coding-system-get)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
11552 (boundp 'buffer-file-coding-system)
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
11553 buffer-file-coding-system))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
11554 (coding-system-for-write (or coding-system coding-system-for-write))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
11555 (save-buffer-coding-system (or coding-system save-buffer-coding-system))
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
11556 (charset (and coding-system
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
11557 (coding-system-get coding-system 'mime-charset)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11558 table-open type
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11559 table-buffer table-orig-buffer
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11560 ind start-is-num starter
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11561 rpl path desc desc1 desc2 link
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11562 )
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11563 (message "Exporting...")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11564
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
11565 (setq org-last-level 1)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11566 (org-init-section-numbers)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11567
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11568 ;; Search for the export key lines
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11569 (org-parse-key-lines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11570 (setq lang-words (or (assoc language org-export-language-setup)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11571 (assoc "en" org-export-language-setup)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11572
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11573 ;; Switch to the output buffer
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11574 (if (or hidden (not org-export-html-show-new-buffer))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11575 (set-buffer buffer)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11576 (switch-to-buffer-other-window buffer))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11577 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11578 (fundamental-mode)
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11579 (let ((case-fold-search nil)
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
11580 (org-odd-levels-only odd))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11581 (if options (org-parse-export-options options))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11582 (setq umax (if arg (prefix-numeric-value arg)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11583 org-export-headline-levels))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11584
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11585 ;; File header
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11586 (insert (format
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11587 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11588 \"http://www.w3.org/TR/REC-html40/loose.dtd\">
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11589 <html lang=\"%s\"><head>
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11590 <title>%s</title>
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
11591 <meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\">
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11592 <meta name=generator content=\"Org-mode\">
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11593 <meta name=generated content=\"%s %s\">
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11594 <meta name=author content=\"%s\">
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11595 %s
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11596 </head><body>
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11597 "
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
11598 language (org-html-expand title) (or charset "iso-8859-1")
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11599 date time author style))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11600 (if title (insert (concat "<H1 class=\"title\">"
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11601 (org-html-expand title) "</H1>\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11602 (if author (insert (concat (nth 1 lang-words) ": " author "\n")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11603 (if email (insert (concat "<a href=\"mailto:" email "\">&lt;"
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11604 email "&gt;</a>\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11605 (if (or author email) (insert "<br>\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11606 (if (and date time) (insert (concat (nth 2 lang-words) ": "
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11607 date " " time "<br>\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11608 (if text (insert (concat "<p>\n" (org-html-expand text))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11609 (if org-export-with-toc
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11610 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11611 (insert (format "<H2>%s</H2>\n" (nth 3 lang-words)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11612 (insert "<ul>\n")
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11613 (setq lines
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11614 (mapcar '(lambda (line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11615 (if (string-match org-todo-line-regexp line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11616 ;; This is a headline
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11617 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11618 (setq level (- (match-end 1) (match-beginning 1))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11619 level (org-tr-level level)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11620 txt (save-match-data
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11621 (org-html-expand
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11622 (match-string 3 line)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11623 todo
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11624 (or (and (match-beginning 2)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11625 (not (equal (match-string 2 line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11626 org-done-string)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11627 ; TODO, not DONE
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11628 (and org-export-mark-todo-in-toc
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11629 (= level umax)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11630 (org-search-todo-below
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11631 line lines level))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11632 (if org-export-with-section-numbers
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11633 (setq txt (concat (org-section-number level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11634 " " txt)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11635 (if (<= level umax)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11636 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11637 (setq head-count (+ head-count 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11638 (if (> level org-last-level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11639 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11640 (setq cnt (- level org-last-level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11641 (while (>= (setq cnt (1- cnt)) 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11642 (insert "<ul>"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11643 (insert "\n")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11644 (if (< level org-last-level)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11645 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11646 (setq cnt (- org-last-level level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11647 (while (>= (setq cnt (1- cnt)) 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11648 (insert "</ul>"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11649 (insert "\n")))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11650 ;; Check for targets
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11651 (while (string-match org-target-regexp line)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11652 (setq tg (match-string 1 line)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11653 line (replace-match
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11654 (concat "@<span class=\"target\">" tg "@</span> ")
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11655 t t line))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11656 (push (cons (org-solidify-link-text tg)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11657 (format "sec-%d" head-count))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11658 target-alist))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11659 (while (string-match "&lt;\\(&lt;\\)+\\|&gt;\\(&gt;\\)+" txt)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11660 (setq txt (replace-match "" t t txt)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11661 (insert
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11662 (format
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11663 (if todo
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11664 "<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a>\n"
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11665 "<li><a href=\"#sec-%d\">%s</a>\n")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11666 head-count txt))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11667
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11668 (setq org-last-level level))
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11669 )))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11670 line)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11671 lines))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11672 (while (> org-last-level 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11673 (setq org-last-level (1- org-last-level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11674 (insert "</ul>\n"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11675 ))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11676 (setq head-count 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11677 (org-init-section-numbers)
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11678
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11679 (while (setq line (pop lines) origline line)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11680 (catch 'nextline
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11681
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11682 ;; end of quote section?
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11683 (when (and inquote (string-match "^\\*+" line))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11684 (insert "</pre>\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11685 (setq inquote nil))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11686 ;; inside a quote section?
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11687 (when inquote
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11688 (insert (org-html-protect line) "\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11689 (throw 'nextline nil))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11690
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11691 ;; verbatim lines
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11692 (when (and org-export-with-fixed-width
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11693 (string-match "^[ \t]*:\\(.*\\)" line))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11694 (when (not infixed)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11695 (setq infixed t)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11696 (insert "<pre>\n"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11697 (insert (org-html-protect (match-string 1 line)) "\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11698 (when (and lines
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11699 (not (string-match "^[ \t]*\\(:.*\\)"
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11700 (car lines))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11701 (setq infixed nil)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11702 (insert "</pre>\n"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11703 (throw 'nextline nil))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11704
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11705
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
11706 ;; make targets to anchors
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11707 (while (string-match "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11708 (cond
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11709 ((match-end 2)
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11710 (setq line (replace-match
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11711 (concat "@<a name=\""
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11712 (org-solidify-link-text (match-string 1 line))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11713 "\">\\nbsp@</a>")
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11714 t t line)))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11715 ((and org-export-with-toc (equal (string-to-char line) ?*))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11716 (setq line (replace-match
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11717 (concat "@<span class=\"target\">" (match-string 1 line) "@</span> ")
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11718 ; (concat "@<i>" (match-string 1 line) "@</i> ")
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11719 t t line)))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11720 (t
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11721 (setq line (replace-match
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11722 (concat "@<a name=\""
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11723 (org-solidify-link-text (match-string 1 line))
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11724 "\" class=\"target\">" (match-string 1 line) "@</a> ")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11725 t t line)))))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11726
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11727 ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11728 ;; handle @<..> HTML tags (replace "@&gt;..&lt;" by "<..>")
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11729 (setq line (org-html-expand line))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
11730
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11731 ;; Format the links
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11732 (setq start 0)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11733 (while (string-match org-bracket-link-analytic-regexp line start)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11734 (setq start (match-beginning 0))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11735 (setq type (if (match-end 2) (match-string 2 line) "internal"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11736 (setq path (match-string 3 line))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11737 (setq desc1 (if (match-end 5) (match-string 5 line))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11738 desc2 (if (match-end 2) (concat type ":" path) path)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11739 desc (or desc1 desc2))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11740 (cond
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11741 ((equal type "internal")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11742 (setq rpl
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11743 (concat
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11744 "<a href=\"#"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11745 (org-solidify-link-text path target-alist)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11746 "\">" desc "</a>")))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11747 ((member type '("http" "https" "ftp" "mailto" "news"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11748 ;; standard URL
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11749 (setq link (concat type ":" path))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11750 (setq rpl (concat "<a href=\"" link "\">" desc "</a>")))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11751 ((string= type "file")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11752 ;; FILE link
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11753 (let* ((filename path)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11754 (abs-p (file-name-absolute-p filename))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11755 (thefile (if abs-p (expand-file-name filename) filename))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11756 (thefile (save-match-data
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11757 (if (string-match ":[0-9]+$" thefile)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11758 (replace-match "" t t thefile)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11759 thefile)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11760 (file-is-image-p
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11761 (save-match-data
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11762 (string-match (org-image-file-name-regexp) thefile))))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11763 (setq rpl (if (and org-export-html-inline-images
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11764 file-is-image-p)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11765 (concat "<img src=\"" thefile "\"/>")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11766 (concat "<a href=\"" thefile "\">" desc "</a>")))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11767 ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11768 (setq rpl (concat "<i>&lt;" type ":" path "&gt;</i>"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11769 ;; FIXME: We get to see the escaped links!!!!!
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11770 (setq line (replace-match rpl t t line)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11771 start (+ start (length rpl))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11772 ;; TODO items
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11773 (if (and (string-match org-todo-line-regexp line)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11774 (match-beginning 2))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11775 (if (equal (match-string 2 line) org-done-string)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11776 (setq line (replace-match
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11777 "<span class=\"done\">\\2</span>"
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11778 nil nil line 2))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11779 (setq line (replace-match "<span class=\"todo\">\\2</span>"
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11780 nil nil line 2))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11781
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11782 ;; DEADLINES
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11783 (if (string-match org-deadline-line-regexp line)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11784 (progn
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11785 (if (save-match-data
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11786 (string-match "<a href"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11787 (substring line 0 (match-beginning 0))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11788 nil ; Don't do the replacement - it is inside a link
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11789 (setq line (replace-match "<span class=\"deadline\">\\&</span>"
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11790 nil nil line 1)))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11791 (cond
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11792 ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11793 ;; This is a headline
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
11794 (setq level (org-tr-level (- (match-end 1) (match-beginning 1)))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11795 txt (match-string 2 line))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11796 (if (<= level umax) (setq head-count (+ head-count 1)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11797 (when in-local-list
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11798 ;; Close any local lists before inserting a new header line
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11799 (while local-list-num
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11800 (insert (if (car local-list-num) "</ol>\n" "</ul>"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11801 (pop local-list-num))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11802 (setq local-list-indent nil
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11803 in-local-list nil))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11804 (org-html-level-start level txt umax
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11805 (and org-export-with-toc (<= level umax))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11806 head-count)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11807 ;; QUOTES
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11808 (when (string-match quote-re line)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11809 (insert "<pre>")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11810 (setq inquote t)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11811
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11812 ((and org-export-with-tables
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11813 (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)" line))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11814 (if (not table-open)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11815 ;; New table starts
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11816 (setq table-open t table-buffer nil table-orig-buffer nil))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11817 ;; Accumulate lines
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11818 (setq table-buffer (cons line table-buffer)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11819 table-orig-buffer (cons origline table-orig-buffer))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11820 (when (or (not lines)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11821 (not (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11822 (car lines))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11823 (setq table-open nil
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11824 table-buffer (nreverse table-buffer)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11825 table-orig-buffer (nreverse table-orig-buffer))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11826 (insert (org-format-table-html table-buffer table-orig-buffer))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11827 (t
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11828 ;; Normal lines
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11829 (when (and (string-match
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11830 (cond
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11831 ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+[.)]\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11832 ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+\\.\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11833 ((= llt ?\)) "^\\( \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+)\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11834 (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11835 line))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11836 (setq ind (org-get-string-indentation line)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11837 start-is-num (match-beginning 4)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11838 starter (if (match-beginning 2) (match-string 2 line))
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11839 line (substring line (match-beginning 5)))
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
11840 (unless (string-match "[^ \t]" line)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11841 ;; empty line. Pretend indentation is large.
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11842 (setq ind (1+ (or (car local-list-indent) 1))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11843 (while (and in-local-list
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11844 (or (and (= ind (car local-list-indent))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11845 (not starter))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11846 (< ind (car local-list-indent))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11847 (insert (if (car local-list-num) "</ol>\n" "</ul>"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11848 (pop local-list-num) (pop local-list-indent)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11849 (setq in-local-list local-list-indent))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11850 (cond
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11851 ((and starter
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11852 (or (not in-local-list)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
11853 (> ind (car local-list-indent))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11854 ;; Start new (level of ) list
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11855 (insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11856 (push start-is-num local-list-num)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11857 (push ind local-list-indent)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11858 (setq in-local-list t))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11859 (starter
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11860 ;; continue current list
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11861 (insert "<li>\n"))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11862 ;; Empty lines start a new paragraph. If hand-formatted lists
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11863 ;; are not fully interpreted, lines starting with "-", "+", "*"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11864 ;; also start a new paragraph.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11865 (if (string-match "^ [-+*]-\\|^[ \t]*$" line) (insert "<p>"))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11866 (insert line (if org-export-preserve-breaks "<br>\n" "\n"))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11867 ))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11868 (if org-export-html-with-timestamp
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11869 (insert org-export-html-html-helper-timestamp))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11870 (insert "</body>\n</html>\n")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11871 (normal-mode)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11872 (save-buffer)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
11873 (goto-char (point-min)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11874
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11875 (defun org-format-table-html (lines olines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11876 "Find out which HTML converter to use and return the HTML code."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11877 (if (string-match "^[ \t]*|" (car lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11878 ;; A normal org table
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11879 (org-format-org-table-html lines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11880 ;; Table made by table.el - test for spanning
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11881 (let* ((hlines (delq nil (mapcar
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11882 (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11883 (if (string-match "^[ \t]*\\+-" x) x
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11884 nil))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11885 lines)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11886 (first (car hlines))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11887 (ll (and (string-match "\\S-+" first)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11888 (match-string 0 first)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11889 (re (concat "^[ \t]*" (regexp-quote ll)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11890 (spanning (delq nil (mapcar (lambda (x) (not (string-match re x)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11891 hlines))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11892 (if (and (not spanning)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11893 (not org-export-prefer-native-exporter-for-tables))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11894 ;; We can use my own converter with HTML conversions
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11895 (org-format-table-table-html lines)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11896 ;; Need to use the code generator in table.el, with the original text.
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11897 (org-format-table-table-html-using-table-generate-source olines)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11898
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11899 (defun org-format-org-table-html (lines)
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
11900 "Format a table into HTML."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11901 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11902 (setq lines (nreverse lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11903 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11904 (setq lines (nreverse lines))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11905 (when org-export-table-remove-special-lines
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11906 ;; Check if the table has a marking column. If yes remove the
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11907 ;; column and the special lines
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11908 (let* ((special
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11909 (not
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11910 (memq nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11911 (mapcar
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11912 (lambda (x)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11913 (or (string-match "^[ \t]*|-" x)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11914 (string-match "^[ \t]*| *\\([#!$*_^ ]\\) *|" x)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11915 lines)))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11916 (if special
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11917 (setq lines
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11918 (delq nil
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11919 (mapcar
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11920 (lambda (x)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11921 (if (string-match "^[ \t]*| *[!_^] *|" x)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11922 nil ; ignore this line
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11923 (and (or (string-match "^[ \t]*|-+\\+" x)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11924 (string-match "^[ \t]*|[^|]*|" x))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11925 (replace-match "|" t t x))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
11926 lines))))))
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
11927
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11928 (let ((head (and org-export-highlight-first-table-line
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11929 (delq nil (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11930 (lambda (x) (string-match "^[ \t]*|-" x))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11931 (cdr lines)))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11932 line fields html)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11933 (setq html (concat org-export-html-table-tag "\n"))
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
11934 (while (setq line (pop lines))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11935 (catch 'next-line
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11936 (if (string-match "^[ \t]*|-" line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11937 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11938 (setq head nil) ;; head ends here, first time around
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11939 ;; ignore this line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11940 (throw 'next-line t)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11941 ;; Break the line into fields
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11942 (setq fields (org-split-string line "[ \t]*|[ \t]*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11943 (setq html (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11944 html
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11945 "<tr>"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11946 (mapconcat (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11947 (if head
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11948 (concat "<th>" x "</th>")
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11949 (concat "<td>" x "</td>")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11950 fields "")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11951 "</tr>\n"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11952 (setq html (concat html "</table>\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11953 html))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11954
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11955 (defun org-fake-empty-table-line (line)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11956 "Replace everything except \"|\" with spaces."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11957 (let ((i (length line))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11958 (newstr (copy-sequence line)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11959 (while (> i 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11960 (setq i (1- i))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11961 (if (not (eq (aref newstr i) ?|))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11962 (aset newstr i ?\ )))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11963 newstr))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11964
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11965 (defun org-format-table-table-html (lines)
69121
39ec690b89d6 (org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
Juanma Barranquero <lekktu@gmail.com>
parents: 69116
diff changeset
11966 "Format a table generated by table.el into HTML.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11967 This conversion does *not* use `table-generate-source' from table.el.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11968 This has the advantage that Org-mode's HTML conversions can be used.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11969 But it has the disadvantage, that no cell- or row-spanning is allowed."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11970 (let (line field-buffer
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11971 (head org-export-highlight-first-table-line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11972 fields html empty)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11973 (setq html (concat org-export-html-table-tag "\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11974 (while (setq line (pop lines))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11975 (setq empty "&nbsp")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11976 (catch 'next-line
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11977 (if (string-match "^[ \t]*\\+-" line)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11978 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11979 (if field-buffer
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11980 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11981 (setq html (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11982 html
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11983 "<tr>"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11984 (mapconcat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11985 (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11986 (if (equal x "") (setq x empty))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11987 (if head
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11988 (concat "<th>" x "</th>\n")
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
11989 (concat "<td>" x "</td>\n")))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11990 field-buffer "\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11991 "</tr>\n"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11992 (setq head nil)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11993 (setq field-buffer nil)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11994 ;; Ignore this line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11995 (throw 'next-line t)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11996 ;; Break the line into fields and store the fields
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11997 (setq fields (org-split-string line "[ \t]*|[ \t]*"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11998 (if field-buffer
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
11999 (setq field-buffer (mapcar
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12000 (lambda (x)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12001 (concat x "<br>" (pop fields)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12002 field-buffer))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12003 (setq field-buffer fields))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12004 (setq html (concat html "</table>\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12005 html))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12006
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12007 (defun org-format-table-table-html-using-table-generate-source (lines)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12008 "Format a table into html, using `table-generate-source' from table.el.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12009 This has the advantage that cell- or row-spanning is allowed.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12010 But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12011 (require 'table)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12012 (with-current-buffer (get-buffer-create " org-tmp1 ")
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12013 (erase-buffer)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12014 (insert (mapconcat 'identity lines "\n"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12015 (goto-char (point-min))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12016 (if (not (re-search-forward "|[^+]" nil t))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12017 (error "Error processing table"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12018 (table-recognize-table)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12019 (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12020 (table-generate-source 'html " org-tmp2 ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12021 (set-buffer " org-tmp2 ")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12022 (buffer-substring (point-min) (point-max))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12023
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12024 (defun org-html-protect (s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12025 ;; convert & to &amp;, < to &lt; and > to &gt;
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12026 (let ((start 0))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12027 (while (string-match "&" s start)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12028 (setq s (replace-match "&amp;" t t s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12029 start (1+ (match-beginning 0))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12030 (while (string-match "<" s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12031 (setq s (replace-match "&lt;" t t s)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12032 (while (string-match ">" s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12033 (setq s (replace-match "&gt;" t t s))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12034 s)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12035
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12036 (defun org-html-expand (string)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12037 "Prepare STRING for HTML export. Applies all active conversions.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12038 If there are links in the string, don't modify these."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12039 (let* (m s l res)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12040 (while (setq m (string-match org-bracket-link-regexp string))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12041 (setq s (substring string 0 m)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12042 l (match-string 0 string)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12043 string (substring string (match-end 0)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12044 (push (org-html-do-expand s) res)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12045 (push l res))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12046 (push (org-html-do-expand string) res)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12047 (apply 'concat (nreverse res))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12048
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12049 (defun org-html-do-expand (s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12050 "Apply all active conversions to translate special ASCII to HTML."
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12051 (setq s (org-html-protect s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12052 (if org-export-html-expand
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12053 (while (string-match "@&lt;\\([^&]*\\)&gt;" s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12054 (setq s (replace-match "<\\1>" nil nil s))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12055 (if org-export-with-emphasize
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12056 (setq s (org-export-html-convert-emphasize s)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12057 (if org-export-with-sub-superscripts
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12058 (setq s (org-export-html-convert-sub-super s)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12059 (if org-export-with-TeX-macros
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12060 (let ((start 0) wd ass)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12061 (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)" s start))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12062 (setq wd (match-string 1 s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12063 (if (setq ass (assoc wd org-html-entities))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12064 (setq s (replace-match (or (cdr ass)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12065 (concat "&" (car ass) ";"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12066 t t s))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12067 (setq start (+ start (length wd)))))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12068 s)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12069
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12070 (defun org-create-multibrace-regexp (left right n)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12071 "Create a regular expression which will match a balanced sexp.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12072 Opening delimiter is LEFT, and closing delimiter is RIGHT, both given
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12073 as single character strings.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12074 The regexp returned will match the entire expression including the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12075 delimiters. It will also define a single group which contains the
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
12076 match except for the outermost delimiters. The maximum depth of
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
12077 stacked delimiters is N. Escaping delimiters is not possible."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12078 (let* ((nothing (concat "[^" "\\" left "\\" right "]*?"))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12079 (or "\\|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12080 (re nothing)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12081 (next (concat "\\(?:" nothing left nothing right "\\)+" nothing)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12082 (while (> n 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12083 (setq n (1- n)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12084 re (concat re or next)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12085 next (concat "\\(?:" nothing left next right "\\)+" nothing)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12086 (concat left "\\(" re "\\)" right)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12087
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12088 (defvar org-match-substring-regexp
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12089 (concat
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12090 "\\([^\\]\\)\\([_^]\\)\\("
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12091 "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12092 "\\|"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12093 "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12094 "\\|"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12095 "\\(\\(?:\\*\\|[-+]?[^-+*!@#$%^_ \t\r\n,:\"?<>~;./{}=()]+\\)\\)\\)")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12096 "The regular expression matching a sub- or superscript.")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12097
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12098 (defun org-export-html-convert-sub-super (string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12099 "Convert sub- and superscripts in STRING to HTML."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12100 (let (key c)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12101 (while (string-match org-match-substring-regexp string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12102 (setq key (if (string= (match-string 2 string) "_") "sub" "sup"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12103 (setq c (or (match-string 8 string)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12104 (match-string 6 string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12105 (match-string 5 string)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12106 (setq string (replace-match
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12107 (concat (match-string 1 string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12108 "<" key ">" c "</" key ">")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12109 t t string)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12110 (while (string-match "\\\\\\([_^]\\)" string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12111 (setq string (replace-match (match-string 1 string) t t string))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12112 string)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12113
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12114 (defun org-export-html-convert-emphasize (string)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12115 (let (c (s 0))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12116 (while (string-match "\\(\\W\\|^\\)\\([*/_]\\)\\(\\w+\\)\\2\\(\\W\\|$\\)" string s)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12117 (setq c (cdr (assoc (match-string 2 string)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12118 '(("*" . "b") ("/" . "i") ("_" . "u"))))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12119 s (+ (match-end 0) 3)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12120 string (replace-match
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12121 (concat "\\1<" c ">\\3</" c ">\\4") t nil string)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12122 string))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12123
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12124 (defun org-parse-key-lines ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12125 "Find the special key lines with the information for exporters."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12126 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12127 (goto-char 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12128 (let ((re (org-make-options-regexp
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12129 '("TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12130 key)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12131 (while (re-search-forward re nil t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12132 (setq key (match-string 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12133 (cond ((string-equal key "TITLE")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12134 (setq title (match-string 2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12135 ((string-equal key "AUTHOR")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12136 (setq author (match-string 2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12137 ((string-equal key "EMAIL")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12138 (setq email (match-string 2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12139 ((string-equal key "LANGUAGE")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12140 (setq language (match-string 2)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12141 ((string-equal key "TEXT")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12142 (setq text (concat text "\n" (match-string 2))))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12143 ((string-equal key "OPTIONS")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12144 (setq options (match-string 2))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12145
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12146 (defun org-parse-export-options (s)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12147 "Parse the export options line."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12148 (let ((op '(("H" . org-export-headline-levels)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12149 ("num" . org-export-with-section-numbers)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12150 ("toc" . org-export-with-toc)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12151 ("\\n" . org-export-preserve-breaks)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12152 ("@" . org-export-html-expand)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12153 (":" . org-export-with-fixed-width)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12154 ("|" . org-export-with-tables)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12155 ("^" . org-export-with-sub-superscripts)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12156 ("*" . org-export-with-emphasize)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12157 ("TeX" . org-export-with-TeX-macros)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12158 o)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12159 (while (setq o (pop op))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12160 (if (string-match (concat (regexp-quote (car o)) ":\\([^ \t\n\r;,.]*\\)")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12161 s)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12162 (set (make-local-variable (cdr o))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12163 (car (read-from-string (match-string 1 s))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12164
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12165 (defun org-html-level-start (level title umax with-toc head-count)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12166 "Insert a new level in HTML export."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12167 (let ((l (1+ (max level umax))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12168 (while (<= l org-level-max)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12169 (if (aref levels-open (1- l))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12170 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12171 (org-html-level-close l)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12172 (aset levels-open (1- l) nil)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12173 (setq l (1+ l)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12174 (if (> level umax)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12175 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12176 (if (aref levels-open (1- level))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12177 (insert "<li>" title "<p>\n")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12178 (aset levels-open (1- level) t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12179 (insert "<ul><li>" title "<p>\n")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12180 (if org-export-with-section-numbers
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12181 (setq title (concat (org-section-number level) " " title)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12182 (setq level (+ level 1))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12183 (if with-toc
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12184 (insert (format "\n<H%d><a name=\"sec-%d\">%s</a></H%d>\n"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12185 level head-count title level))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12186 (insert (format "\n<H%d>%s</H%d>\n" level title level))))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12187
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12188 (defun org-html-level-close (&rest args)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12189 "Terminate one level in HTML export."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12190 (insert "</ul>"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12191
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12192 ;; Variable holding the vector with section numbers
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12193 (defvar org-section-numbers (make-vector org-level-max 0))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12194
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12195 (defun org-init-section-numbers ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12196 "Initialize the vector for the section numbers."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12197 (let* ((level -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12198 (numbers (nreverse (org-split-string "" "\\.")))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12199 (depth (1- (length org-section-numbers)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12200 (i depth) number-string)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12201 (while (>= i 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12202 (if (> i level)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12203 (aset org-section-numbers i 0)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12204 (setq number-string (or (car numbers) "0"))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12205 (if (string-match "\\`[A-Z]\\'" number-string)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12206 (aset org-section-numbers i
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12207 (- (string-to-char number-string) ?A -1))
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
12208 (aset org-section-numbers i (string-to-number number-string)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12209 (pop numbers))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12210 (setq i (1- i)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12211
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12212 (defun org-section-number (&optional level)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12213 "Return a string with the current section number.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12214 When LEVEL is non-nil, increase section numbers on that level."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12215 (let* ((depth (1- (length org-section-numbers))) idx n (string ""))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12216 (when level
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12217 (when (> level -1)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12218 (aset org-section-numbers
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12219 level (1+ (aref org-section-numbers level))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12220 (setq idx (1+ level))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12221 (while (<= idx depth)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12222 (if (not (= idx 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12223 (aset org-section-numbers idx 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12224 (setq idx (1+ idx))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12225 (setq idx 0)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12226 (while (<= idx depth)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12227 (setq n (aref org-section-numbers idx))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12228 (setq string (concat string (if (not (string= string "")) "." "")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12229 (int-to-string n)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12230 (setq idx (1+ idx)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12231 (save-match-data
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12232 (if (string-match "\\`\\([@0]\\.\\)+" string)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12233 (setq string (replace-match "" nil nil string)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12234 (if (string-match "\\(\\.0\\)+\\'" string)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12235 (setq string (replace-match "" nil nil string))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12236 string))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12237
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12238
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12239 (defun org-export-icalendar-this-file ()
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12240 "Export current file as an iCalendar file.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12241 The iCalendar file will be located in the same directory as the Org-mode
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12242 file, but with extension `.ics'."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12243 (interactive)
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
12244 (org-export-icalendar nil buffer-file-name))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12245
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12246 (defun org-export-as-xml ()
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12247 "Export current buffer as XOXO XML buffer."
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12248 (interactive)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12249 (cond ((eq org-export-xml-type 'xoxo)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12250 (org-export-as-xoxo (current-buffer)))))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12251
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12252 (defun org-export-as-xoxo-insert-into (buffer &rest output)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12253 (with-current-buffer buffer
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12254 (apply 'insert output)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12255
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12256 (defun org-export-as-xoxo (&optional buffer)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12257 "Export the org buffer as XOXO.
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12258 The XOXO buffer is named *xoxo-<source buffer name>*"
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12259 (interactive (list (current-buffer)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12260 ;; A quickie abstraction
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12261
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12262 ;; Output everything as XOXO
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12263 (with-current-buffer (get-buffer buffer)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12264 (goto-char (point-min)) ;; CD: beginning-of-buffer is not allowed.
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12265 (let* ((filename (concat (file-name-sans-extension buffer-file-name)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12266 ".xml"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12267 (out (find-file-noselect filename))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12268 (last-level 1)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12269 (hanging-li nil))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12270 ;; Check the output buffer is empty.
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12271 (with-current-buffer out (erase-buffer))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12272 ;; Kick off the output
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12273 (org-export-as-xoxo-insert-into out "<ol class='xoxo'>\n")
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12274 (while (re-search-forward "^\\(\\*+\\) \\(.+\\)" (point-max) 't)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12275 (let* ((hd (match-string-no-properties 1))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12276 (level (length hd))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12277 (text (concat
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12278 (match-string-no-properties 2)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12279 (save-excursion
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12280 (goto-char (match-end 0))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12281 (let ((str ""))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12282 (catch 'loop
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12283 (while 't
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12284 (forward-line)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12285 (if (looking-at "^[ \t]\\(.*\\)")
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12286 (setq str (concat str (match-string-no-properties 1)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12287 (throw 'loop str)))))))))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12288
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12289 ;; Handle level rendering
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12290 (cond
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12291 ((> level last-level)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12292 (org-export-as-xoxo-insert-into out "\n<ol>\n"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12293
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12294 ((< level last-level)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12295 (dotimes (- (- last-level level) 1)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12296 (if hanging-li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12297 (org-export-as-xoxo-insert-into out "</li>\n"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12298 (org-export-as-xoxo-insert-into out "</ol>\n"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12299 (when hanging-li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12300 (org-export-as-xoxo-insert-into out "</li>\n")
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12301 (setq hanging-li nil)))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12302
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12303 ((equal level last-level)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12304 (if hanging-li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12305 (org-export-as-xoxo-insert-into out "</li>\n")))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12306 )
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12307
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12308 (setq last-level level)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12309
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12310 ;; And output the new li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12311 (setq hanging-li 't)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12312 (if (equal ?+ (elt text 0))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12313 (org-export-as-xoxo-insert-into out "<li class='" (substring text 1) "'>")
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12314 (org-export-as-xoxo-insert-into out "<li>" text))))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12315
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12316 ;; Finally finish off the ol
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12317 (dotimes (- last-level 1)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12318 (if hanging-li
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12319 (org-export-as-xoxo-insert-into out "</li>\n"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12320 (org-export-as-xoxo-insert-into out "</ol>\n"))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12321
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12322 ;; Finish the buffer off and clean it up.
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12323 (switch-to-buffer-other-window out)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12324 (indent-region (point-min) (point-max))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12325 (save-buffer)
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12326 (goto-char (point-min))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12327 )))
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12328
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12329 ;;;###autoload
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12330 (defun org-export-icalendar-all-agenda-files ()
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12331 "Export all files in `org-agenda-files' to iCalendar .ics files.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12332 Each iCalendar file will be located in the same directory as the Org-mode
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12333 file, but with extension `.ics'."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12334 (interactive)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12335 (apply 'org-export-icalendar nil (org-agenda-files t)))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12336
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12337 ;;;###autoload
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12338 (defun org-export-icalendar-combine-agenda-files ()
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12339 "Export all files in `org-agenda-files' to a single combined iCalendar file.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12340 The file is stored under the name `org-combined-agenda-icalendar-file'."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12341 (interactive)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12342 (apply 'org-export-icalendar t (org-agenda-files t)))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12343
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12344 (defun org-export-icalendar (combine &rest files)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12345 "Create iCalendar files for all elements of FILES.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12346 If COMBINE is non-nil, combine all calendar entries into a single large
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12347 file and store it under the name `org-combined-agenda-icalendar-file'."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12348 (save-excursion
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12349 (let* (file ical-file ical-buffer category started org-agenda-new-buffers)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12350 (when combine
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12351 (setq ical-file org-combined-agenda-icalendar-file
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12352 ical-buffer (org-get-agenda-file-buffer ical-file))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12353 (set-buffer ical-buffer) (erase-buffer))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12354 (while (setq file (pop files))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12355 (catch 'nextfile
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12356 (org-check-agenda-file file)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12357 (unless combine
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12358 (setq ical-file (concat (file-name-sans-extension file) ".ics"))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12359 (setq ical-buffer (org-get-agenda-file-buffer ical-file))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12360 (set-buffer ical-buffer) (erase-buffer))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12361 (set-buffer (org-get-agenda-file-buffer file))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12362 (setq category (or org-category
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12363 (file-name-sans-extension
69319
7aecee7bf0d9 Move defvars out of eval-when-compile. Use
Carsten Dominik <dominik@science.uva.nl>
parents: 69240
diff changeset
12364 (file-name-nondirectory buffer-file-name))))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12365 (if (symbolp category) (setq category (symbol-name category)))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12366 (let ((standard-output ical-buffer))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12367 (if combine
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12368 (and (not started) (setq started t)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12369 (org-start-icalendar-file org-icalendar-combined-name))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12370 (org-start-icalendar-file category))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12371 (org-print-icalendar-entries combine category)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12372 (when (or (and combine (not files)) (not combine))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12373 (org-finish-icalendar-file)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12374 (set-buffer ical-buffer)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12375 (save-buffer)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12376 (run-hooks 'org-after-save-iCalendar-file-hook)))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12377 (org-release-buffers org-agenda-new-buffers))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12378
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12379 (defvar org-after-save-iCalendar-file-hook nil
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12380 "Hook run after an iCalendar file has been saved.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12381 The iCalendar buffer is still current when this hook is run.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12382 A good way to use this is to tell a desktop calenndar application to re-read
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12383 the iCalendar file.")
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12384
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12385 (defun org-print-icalendar-entries (&optional combine category)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12386 "Print iCalendar entries for the current Org-mode file to `standard-output'.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12387 When COMBINE is non nil, add the category to each line."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12388 (let ((re2 (concat "--?-?\\(" org-ts-regexp "\\)"))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12389 (dts (org-ical-ts-to-string
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12390 (format-time-string (cdr org-time-stamp-formats) (current-time))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12391 "DTSTART"))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
12392 hd ts ts2 state (inc t) pos scheduledp deadlinep tmp pri)
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12393 (save-excursion
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12394 (goto-char (point-min))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12395 (while (re-search-forward org-ts-regexp nil t)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12396 (setq pos (match-beginning 0)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12397 ts (match-string 0)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12398 inc t
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12399 hd (org-get-heading))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12400 (if (looking-at re2)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12401 (progn
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12402 (goto-char (match-end 0))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12403 (setq ts2 (match-string 1) inc nil))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12404 (setq ts2 ts
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12405 tmp (buffer-substring (max (point-min)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12406 (- pos org-ds-keyword-length))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12407 pos)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12408 deadlinep (string-match org-deadline-regexp tmp)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12409 scheduledp (string-match org-scheduled-regexp tmp)
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
12410 ;; donep (org-entry-is-done-p)
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
12411 ))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12412 (if (or (string-match org-tr-regexp hd)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12413 (string-match org-ts-regexp hd))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12414 (setq hd (replace-match "" t t hd)))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12415 (if combine
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12416 (setq hd (concat hd " (category " category ")")))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12417 (if deadlinep (setq hd (concat "DL: " hd " This is a deadline")))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12418 (if scheduledp (setq hd (concat "S: " hd " Scheduled for this date")))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12419 (princ (format "BEGIN:VEVENT
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12420 %s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12421 %s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12422 SUMMARY:%s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12423 END:VEVENT\n"
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12424 (org-ical-ts-to-string ts "DTSTART")
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12425 (org-ical-ts-to-string ts2 "DTEND" inc)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12426 hd)))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12427 (when org-icalendar-include-todo
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12428 (goto-char (point-min))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12429 (while (re-search-forward org-todo-line-regexp nil t)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12430 (setq state (match-string 1))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12431 (unless (equal state org-done-string)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12432 (setq hd (match-string 3))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12433 (if (string-match org-priority-regexp hd)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12434 (setq pri (string-to-char (match-string 2 hd))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12435 hd (concat (substring hd 0 (match-beginning 1))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12436 (substring hd (- (match-end 1)))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12437 (setq pri org-default-priority))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12438 (setq pri (floor (1+ (* 8. (/ (float (- org-lowest-priority pri))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12439 (- org-lowest-priority ?A))))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12440
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12441 (princ (format "BEGIN:VTODO
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12442 %s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12443 SUMMARY:%s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12444 SEQUENCE:1
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12445 PRIORITY:%d
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12446 END:VTODO\n"
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12447 dts hd pri))))))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12448
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12449 (defun org-start-icalendar-file (name)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12450 "Start an iCalendar file by inserting the header."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12451 (let ((user user-full-name)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12452 (name (or name "unknown"))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
12453 (timezone (cadr (current-time-zone))))
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12454 (princ
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12455 (format "BEGIN:VCALENDAR
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12456 VERSION:2.0
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12457 X-WR-CALNAME:%s
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12458 PRODID:-//%s//Emacs with Org-mode//EN
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12459 X-WR-TIMEZONE:%s
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12460 CALSCALE:GREGORIAN\n" name user timezone))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12461
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12462 (defun org-finish-icalendar-file ()
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12463 "Finish an iCalendar file by inserting the END statement."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12464 (princ "END:VCALENDAR\n"))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12465
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12466 (defun org-ical-ts-to-string (s keyword &optional inc)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12467 "Take a time string S and convert it to iCalendar format.
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12468 KEYWORD is added in front, to make a complete line like DTSTART....
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12469 When INC is non-nil, increase the hour by two (if time string contains
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12470 a time), or the day by one (if it does not contain a time)."
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12471 (let ((t1 (org-parse-time-string s 'nodefault))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12472 t2 fmt have-time time)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12473 (if (and (car t1) (nth 1 t1) (nth 2 t1))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12474 (setq t2 t1 have-time t)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12475 (setq t2 (org-parse-time-string s)))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12476 (let ((s (car t2)) (mi (nth 1 t2)) (h (nth 2 t2))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12477 (d (nth 3 t2)) (m (nth 4 t2)) (y (nth 5 t2)))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12478 (when inc
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12479 (if have-time (setq h (+ 2 h)) (setq d (1+ d))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12480 (setq time (encode-time s mi h d m y)))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12481 (setq fmt (if have-time ":%Y%m%dT%H%M%S" ";VALUE=DATE:%Y%m%d"))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12482 (concat keyword (format-time-string fmt time))))
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12483
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12484
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12485 ;;; Key bindings
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12486
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12487 ;; - Bindings in Org-mode map are currently
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12488 ;; 0123456789abcdefghijklmnopqrstuvwxyz!?@#$%^&-+*/=()_{}[]:;"|,.<>~`'\t the alphabet
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12489 ;; abcd fgh j lmnopqrstuvwxyz!? #$ ^ -+*/= [] ; |,.<>~ '\t necessary bindings
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12490 ;; e (?) useful from outline-mode
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12491 ;; i k @ expendable from outline-mode
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12492 ;; 0123456789 % & ()_{} " ` free
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12493
65964
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
12494 ;; Make `C-c C-x' a prefix key
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
12495 (define-key org-mode-map "\C-c\C-x" (make-sparse-keymap))
4a5b33d70e6f (org-mode-map): Explicit definition of `C-c C-x' as a
Carsten Dominik <dominik@science.uva.nl>
parents: 65705
diff changeset
12496
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12497 ;; TAB key with modifiers
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12498 (define-key org-mode-map "\C-i" 'org-cycle)
69482
a305f07816a9 (org-insert-centered): Use `string-width' to make
Carsten Dominik <dominik@science.uva.nl>
parents: 69454
diff changeset
12499 (define-key org-mode-map [(tab)] 'org-cycle)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12500 (define-key org-mode-map [(meta tab)] 'org-complete)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12501 (define-key org-mode-map "\M-\C-i" 'org-complete) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12502 ;; The following line is necessary under Suse GNU/Linux
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12503 (unless (featurep 'xemacs)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12504 (define-key org-mode-map [S-iso-lefttab] 'org-shifttab))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12505 (define-key org-mode-map [(shift tab)] 'org-shifttab)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12506
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12507 (define-key org-mode-map (org-key 'S-return) 'org-table-copy-down)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12508 (define-key org-mode-map "\C-c\C-xc" 'org-table-copy-down) ; tty
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12509 (define-key org-mode-map [(meta shift return)] 'org-insert-todo-heading)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12510 (define-key org-mode-map "\C-c\C-xM" 'org-insert-todo-heading) ; tty
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12511 (define-key org-mode-map [(meta return)] 'org-meta-return)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12512 (define-key org-mode-map "\C-c\C-xm" 'org-meta-return) ; tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12513 (define-key org-mode-map [?\e (return)] 'org-meta-return) ; tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12514
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12515 ;; Cursor keys with modifiers
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12516 (define-key org-mode-map [(meta left)] 'org-metaleft)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12517 (define-key org-mode-map [?\e (left)] 'org-metaleft) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12518 (define-key org-mode-map "\C-c\C-xl" 'org-metaleft) ; for tty emacs
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12519 (define-key org-mode-map [(meta right)] 'org-metaright)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12520 (define-key org-mode-map [?\e (right)] 'org-metaright) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12521 (define-key org-mode-map "\C-c\C-xr" 'org-metaright) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12522 (define-key org-mode-map [(meta up)] 'org-metaup)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12523 (define-key org-mode-map [?\e (up)] 'org-metaup) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12524 (define-key org-mode-map "\C-c\C-xu" 'org-metaup) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12525 (define-key org-mode-map [(meta down)] 'org-metadown)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12526 (define-key org-mode-map [?\e (down)] 'org-metadown) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12527 (define-key org-mode-map "\C-c\C-xd" 'org-metadown) ; for tty emacs
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12528
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12529 (define-key org-mode-map [(meta shift left)] 'org-shiftmetaleft)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12530 (define-key org-mode-map "\C-c\C-xL" 'org-shiftmetaleft) ; tty
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12531 (define-key org-mode-map [(meta shift right)] 'org-shiftmetaright)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12532 (define-key org-mode-map "\C-c\C-xR" 'org-shiftmetaright) ; tty
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12533 (define-key org-mode-map [(meta shift up)] 'org-shiftmetaup)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12534 (define-key org-mode-map "\C-c\C-xU" 'org-shiftmetaup) ; tty
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12535 (define-key org-mode-map [(meta shift down)] 'org-shiftmetadown)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12536 (define-key org-mode-map "\C-c\C-xD" 'org-shiftmetadown) ; tty
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12537 (define-key org-mode-map (org-key 'S-up) 'org-shiftup)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12538 (define-key org-mode-map [?\C-c ?\C-x (up)] 'org-shiftup)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12539 (define-key org-mode-map (org-key 'S-down) 'org-shiftdown)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12540 (define-key org-mode-map [?\C-c ?\C-x (down)] 'org-shiftdown)
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12541 (define-key org-mode-map (org-key 'S-left) 'org-shiftleft)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12542 (define-key org-mode-map [?\C-c ?\C-x (left)] 'org-shiftleft)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12543 (define-key org-mode-map (org-key 'S-right) 'org-shiftright)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12544 (define-key org-mode-map [?\C-c ?\C-x (right)] 'org-shiftright)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12545
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12546 ;; All the other keys
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12547 (define-key org-mode-map "\C-c$" 'org-archive-subtree)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12548 (define-key org-mode-map "\C-c\C-j" 'org-goto)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12549 (define-key org-mode-map "\C-c\C-t" 'org-todo)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12550 (define-key org-mode-map "\C-c\C-s" 'org-schedule)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12551 (define-key org-mode-map "\C-c\C-d" 'org-deadline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12552 (define-key org-mode-map "\C-c;" 'org-toggle-comment)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12553 (define-key org-mode-map "\C-c\C-v" 'org-show-todo-tree)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12554 (define-key org-mode-map "\C-c\C-w" 'org-check-deadlines)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12555 (define-key org-mode-map "\C-c/" 'org-occur) ; Minor-mode reserved
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
12556 (define-key org-mode-map "\C-c\\" 'org-tags-sparse-tree) ; Minor-mode res.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12557 (define-key org-mode-map "\C-c\C-m" 'org-insert-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12558 (define-key org-mode-map "\M-\C-m" 'org-insert-heading)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12559 (define-key org-mode-map "\C-c\C-l" 'org-insert-link)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12560 (define-key org-mode-map "\C-c\C-o" 'org-open-at-point)
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12561 (define-key org-mode-map "\C-c%" 'org-mark-ring-push)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12562 (define-key org-mode-map "\C-c&" 'org-mark-ring-goto)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12563 (define-key org-mode-map "\C-c\C-z" 'org-time-stamp) ; Alternative binding
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12564 (define-key org-mode-map "\C-c." 'org-time-stamp) ; Minor-mode reserved
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12565 (define-key org-mode-map "\C-c!" 'org-time-stamp-inactive) ; Minor-mode r.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12566 (define-key org-mode-map "\C-c," 'org-priority) ; Minor-mode reserved
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12567 (define-key org-mode-map "\C-c\C-y" 'org-evaluate-time-range)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12568 (define-key org-mode-map "\C-c>" 'org-goto-calendar)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12569 (define-key org-mode-map "\C-c<" 'org-date-from-calendar)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12570 (define-key org-mode-map [(control ?,)] 'org-cycle-agenda-files)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12571 (define-key org-mode-map "\C-c[" 'org-agenda-file-to-front)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12572 (define-key org-mode-map "\C-c]" 'org-remove-file)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12573 (define-key org-mode-map "\C-c\C-r" 'org-timeline)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12574 (define-key org-mode-map "\C-c-" 'org-table-insert-hline)
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12575 (define-key org-mode-map "\C-c^" 'org-table-sort-lines)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12576 (define-key org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c)
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
12577 (define-key org-mode-map "\C-m" 'org-return)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12578 (define-key org-mode-map "\C-c?" 'org-table-current-column)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12579 (define-key org-mode-map "\C-c " 'org-table-blank-field)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12580 (define-key org-mode-map "\C-c+" 'org-table-sum)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12581 (define-key org-mode-map "\C-c=" 'org-table-eval-formula)
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
12582 (define-key org-mode-map "\C-c'" 'org-table-edit-formulas)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12583 (define-key org-mode-map "\C-c`" 'org-table-edit-field)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12584 (define-key org-mode-map "\C-c|" 'org-table-create-or-convert-from-region)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12585 (define-key org-mode-map "\C-c*" 'org-table-recalculate)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12586 (define-key org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12587 (define-key org-mode-map "\C-c~" 'org-table-create-with-table.el)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12588 (define-key org-mode-map "\C-c\C-q" 'org-table-wrap-region)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12589 (define-key org-mode-map "\C-c\C-xa" 'org-export-as-ascii)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12590 (define-key org-mode-map "\C-c\C-x\C-a" 'org-export-as-ascii)
61134
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
12591 (define-key org-mode-map "\C-c\C-xv" 'org-export-copy-visible)
ac45ed541a16 * org.el (org-agenda-phases-of-moon, org-agenda-sunrise-sunset)
Carsten Dominik <dominik@science.uva.nl>
parents: 60918
diff changeset
12592 (define-key org-mode-map "\C-c\C-x\C-v" 'org-export-copy-visible)
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12593 ;; OPML support is only an option for the future
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
12594 ;(define-key org-mode-map "\C-c\C-xo" 'org-export-as-opml)
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
12595 ;(define-key org-mode-map "\C-c\C-x\C-o" 'org-export-as-opml)
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12596 (define-key org-mode-map "\C-c\C-xi" 'org-export-icalendar-this-file)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12597 (define-key org-mode-map "\C-c\C-x\C-i" 'org-export-icalendar-all-agenda-files)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12598 (define-key org-mode-map "\C-c\C-xc" 'org-export-icalendar-combine-agenda-files)
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
12599 (define-key org-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12600 (define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12601 (define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12602 (define-key org-mode-map "\C-c\C-xh" 'org-export-as-html)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12603 (define-key org-mode-map "\C-c\C-xx" 'org-export-as-xml)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12604 (define-key org-mode-map "\C-c\C-x\C-x" 'org-export-as-xml)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12605 (define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12606 (define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12607
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
12608 (define-key org-mode-map "\C-c\C-x\C-k" 'org-cut-special)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12609 (define-key org-mode-map "\C-c\C-x\C-w" 'org-cut-special)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12610 (define-key org-mode-map "\C-c\C-x\M-w" 'org-copy-special)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12611 (define-key org-mode-map "\C-c\C-x\C-y" 'org-paste-special)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12612
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12613 (defsubst org-table-p () (org-at-table-p))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12614
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12615 (defun org-self-insert-command (N)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12616 "Like `self-insert-command', use overwrite-mode for whitespace in tables.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12617 If the cursor is in a table looking at whitespace, the whitespace is
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12618 overwritten, and the table is not marked as requiring realignment."
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12619 (interactive "p")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12620 (if (and (org-table-p)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12621 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12622 ;; check if we blank the field, and if that triggers align
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12623 (and org-table-auto-blank-field
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12624 (member last-command
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12625 '(org-cycle org-return org-shifttab org-ctrl-c-ctrl-c))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12626 (if (or (equal (char-after) ?\ ) (looking-at "[^|\n]* |"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12627 ;; got extra space, this field does not determine column width
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12628 (let (org-table-may-need-update) (org-table-blank-field))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12629 ;; no extra space, this field may determine column width
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12630 (org-table-blank-field)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12631 t)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12632 (eq N 1)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12633 (looking-at "[^|\n]* |"))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12634 (let (org-table-may-need-update)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12635 (goto-char (1- (match-end 0)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12636 (delete-backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12637 (goto-char (match-beginning 0))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12638 (self-insert-command N))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12639 (setq org-table-may-need-update t)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12640 (self-insert-command N)))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12641
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12642 (defun org-delete-backward-char (N)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12643 "Like `delete-backward-char', insert whitespace at field end in tables.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12644 When deleting backwards, in tables this function will insert whitespace in
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12645 front of the next \"|\" separator, to keep the table aligned. The table will
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12646 still be marked for re-alignment if the field did fill the entire column,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12647 because, in this case the deletion might narrow the column."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12648 (interactive "p")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12649 (if (and (org-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12650 (eq N 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12651 (string-match "|" (buffer-substring (point-at-bol) (point)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12652 (looking-at ".*?|"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12653 (let ((pos (point))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12654 (noalign (looking-at "[^|\n\r]* |"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12655 (c org-table-may-need-update))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12656 (backward-delete-char N)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12657 (skip-chars-forward "^|")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12658 (insert " ")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12659 (goto-char (1- pos))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12660 ;; noalign: if there were two spaces at the end, this field
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12661 ;; does not determine the width of the column.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12662 (if noalign (setq org-table-may-need-update c)))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12663 (backward-delete-char N)))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12664
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12665 (defun org-delete-char (N)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12666 "Like `delete-char', but insert whitespace at field end in tables.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12667 When deleting characters, in tables this function will insert whitespace in
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12668 front of the next \"|\" separator, to keep the table aligned. The table will
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12669 still be marked for re-alignment if the field did fill the entire column,
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12670 because, in this case the deletion might narrow the column."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12671 (interactive "p")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12672 (if (and (org-table-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12673 (not (bolp))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12674 (not (= (char-after) ?|))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12675 (eq N 1))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12676 (if (looking-at ".*?|")
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12677 (let ((pos (point))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12678 (noalign (looking-at "[^|\n\r]* |"))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12679 (c org-table-may-need-update))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12680 (replace-match (concat
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12681 (substring (match-string 0) 1 -1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12682 " |"))
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12683 (goto-char pos)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12684 ;; noalign: if there were two spaces at the end, this field
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12685 ;; does not determine the width of the column.
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12686 (if noalign (setq org-table-may-need-update c))))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12687 (delete-char N)))
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12688
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12689 ;; How to do this: Measure non-white length of current string
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12690 ;; If equal to column width, we should realign.
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12691
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12692 (defun org-remap (map &rest commands)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12693 "In MAP, remap the functions given in COMMANDS.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12694 COMMANDS is a list of alternating OLDDEF NEWDEF command names."
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12695 (let (new old)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12696 (while commands
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12697 (setq old (pop commands) new (pop commands))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12698 (if (fboundp 'command-remapping)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12699 (define-key map (vector 'remap old) new)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12700 (substitute-key-definition old new map global-map)))))
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12701
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12702 (when (eq org-enable-table-editor 'optimized)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12703 ;; If the user wants maximum table support, we need to hijack
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12704 ;; some standard editing functions
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12705 (org-remap org-mode-map
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12706 'self-insert-command 'org-self-insert-command
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12707 'delete-char 'org-delete-char
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12708 'delete-backward-char 'org-delete-backward-char)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12709 (define-key org-mode-map "|" 'org-force-self-insert))
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12710
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12711 (defun org-shiftcursor-error ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12712 "Throw an error because Shift-Cursor command was applied in wrong context."
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12713 (error "This command is active in special context like tables, headlines or timestamps"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12714
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12715 (defun org-shifttab ()
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12716 "Global visibility cycling or move to previous table field.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12717 Calls `(org-cycle t)' or `org-table-previous-field', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12718 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12719 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12720 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12721 ((org-at-table-p) (org-table-previous-field))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12722 (t (org-cycle '(4)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12723
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12724 (defun org-shiftmetaleft ()
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12725 "Promote subtree or delete table column.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12726 Calls `org-promote-subtree' or `org-table-delete-column', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12727 See the individual commands for more information."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12728 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12729 (cond
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12730 ((org-at-table-p) (org-table-delete-column))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12731 ((org-on-heading-p) (org-promote-subtree))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12732 ((org-at-item-p) (call-interactively 'org-outdent-item))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12733 (t (org-shiftcursor-error))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12734
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12735 (defun org-shiftmetaright ()
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12736 "Demote subtree or insert table column.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12737 Calls `org-demote-subtree' or `org-table-insert-column', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12738 See the individual commands for more information."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12739 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12740 (cond
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12741 ((org-at-table-p) (org-table-insert-column))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12742 ((org-on-heading-p) (org-demote-subtree))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12743 ((org-at-item-p) (call-interactively 'org-indent-item))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12744 (t (org-shiftcursor-error))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12745
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12746 (defun org-shiftmetaup (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12747 "Move subtree up or kill table row.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12748 Calls `org-move-subtree-up' or `org-table-kill-row' or
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12749 `org-move-item-up' depending on context. See the individual commands
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12750 for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12751 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12752 (cond
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12753 ((org-at-table-p) (org-table-kill-row))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12754 ((org-on-heading-p) (org-move-subtree-up arg))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12755 ((org-at-item-p) (org-move-item-up arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12756 (t (org-shiftcursor-error))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12757 (defun org-shiftmetadown (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12758 "Move subtree down or insert table row.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12759 Calls `org-move-subtree-down' or `org-table-insert-row' or
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12760 `org-move-item-down', depending on context. See the individual
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12761 commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12762 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12763 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12764 ((org-at-table-p) (org-table-insert-row arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12765 ((org-on-heading-p) (org-move-subtree-down arg))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12766 ((org-at-item-p) (org-move-item-down arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12767 (t (org-shiftcursor-error))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12768
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12769 (defun org-metaleft (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12770 "Promote heading or move table column to left.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12771 Calls `org-do-promote' or `org-table-move-column', depending on context.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12772 With no specific context, calls the Emacs default `backward-word'.
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12773 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12774 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12775 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12776 ((org-at-table-p) (org-table-move-column 'left))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12777 ((or (org-on-heading-p) (org-region-active-p)) (org-do-promote))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12778 (t (backward-word (prefix-numeric-value arg)))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12779
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12780 (defun org-metaright (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12781 "Demote subtree or move table column to right.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12782 Calls `org-do-demote' or `org-table-move-column', depending on context.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12783 With no specific context, calls the Emacs default `forward-word'.
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12784 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12785 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12786 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12787 ((org-at-table-p) (org-table-move-column nil))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12788 ((or (org-on-heading-p) (org-region-active-p)) (org-do-demote))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12789 (t (forward-word (prefix-numeric-value arg)))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12790
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12791 (defun org-metaup (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12792 "Move subtree up or move table row up.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12793 Calls `org-move-subtree-up' or `org-table-move-row' or
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12794 `org-move-item-up', depending on context. See the individual commands
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12795 for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12796 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12797 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12798 ((org-at-table-p) (org-table-move-row 'up))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12799 ((org-on-heading-p) (org-move-subtree-up arg))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12800 ((org-at-item-p) (org-move-item-up arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12801 (t (org-shiftcursor-error))))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12802
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12803 (defun org-metadown (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12804 "Move subtree down or move table row down.
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12805 Calls `org-move-subtree-down' or `org-table-move-row' or
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12806 `org-move-item-down', depending on context. See the individual
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12807 commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12808 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12809 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12810 ((org-at-table-p) (org-table-move-row nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12811 ((org-on-heading-p) (org-move-subtree-down arg))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12812 ((org-at-item-p) (org-move-item-down arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12813 (t (org-shiftcursor-error))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12814
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12815 (defun org-shiftup (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12816 "Increase item in timestamp or increase priority of current item.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12817 Calls `org-timestamp-up' or `org-priority-up', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12818 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12819 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12820 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12821 ((org-at-timestamp-p) (org-timestamp-up arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12822 (t (org-priority-up))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12823
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12824 (defun org-shiftdown (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12825 "Decrease item in timestamp or decrease priority of current item.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12826 Calls `org-timestamp-down' or `org-priority-down', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12827 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12828 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12829 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12830 ((org-at-timestamp-p) (org-timestamp-down arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12831 (t (org-priority-down))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12832
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12833 (defun org-shiftright ()
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12834 "Next TODO keyword or timestamp one day later, depending on context."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12835 (interactive)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12836 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12837 ((org-at-timestamp-p) (org-timestamp-up-day))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12838 ((org-on-heading-p) (org-todo 'right))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12839 (t (org-shiftcursor-error))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12840
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12841 (defun org-shiftleft ()
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12842 "Previous TODO keyword or timestamp one day earlier, depending on context."
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12843 (interactive)
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12844 (cond
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12845 ((org-at-timestamp-p) (org-timestamp-down-day))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12846 ((org-on-heading-p) (org-todo 'left))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12847 (t (org-shiftcursor-error))))
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
12848
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12849 (defun org-copy-special ()
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12850 "Copy region in table or copy current subtree.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12851 Calls `org-table-copy' or `org-copy-subtree', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12852 See the individual commands for more information."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12853 (interactive)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
12854 (call-interactively
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12855 (if (org-at-table-p) 'org-table-copy-region 'org-copy-subtree)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12856
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12857 (defun org-cut-special ()
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12858 "Cut region in table or cut current subtree.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12859 Calls `org-table-copy' or `org-cut-subtree', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12860 See the individual commands for more information."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12861 (interactive)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12862 (call-interactively
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12863 (if (org-at-table-p) 'org-table-cut-region 'org-cut-subtree)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12864
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12865 (defun org-paste-special (arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12866 "Paste rectangular region into table, or past subtree relative to level.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12867 Calls `org-table-paste-rectangle' or `org-paste-subtree', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12868 See the individual commands for more information."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12869 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12870 (if (org-at-table-p)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12871 (org-table-paste-rectangle)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12872 (org-paste-subtree arg)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12873
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12874 (defun org-ctrl-c-ctrl-c (&optional arg)
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12875 "Set tags in headline, or update according to changed information at point.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12876
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12877 This command does many different things, depending on context:
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12878
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12879 - If the cursor is in a headline, prompt for tags and insert them
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12880 into the current line, aligned to `org-tags-column'. When called
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12881 with prefix arg, realign all tags in the current buffer.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12882
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12883 - If the cursor is in one of the special #+KEYWORD lines, this
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12884 triggers scanning the buffer for these lines and updating the
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12885 information.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12886
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12887 - If the cursor is inside a table, realign the table. This command
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12888 works even if the automatic table editor has been turned off.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12889
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12890 - If the cursor is on a #+TBLFM line, re-apply the formulas to
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12891 the entire table.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12892
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12893 - If the cursor is inside a table created by the table.el package,
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
12894 activate that table.
69997
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12895
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12896 - If the current buffer is a remember buffer, close note and file it.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12897 with a prefix argument, file it without further interaction to the default
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12898 location.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12899
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12900 - If the cursor is on a <<<target>>>, update radio targets and corresponding
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12901 links in this buffer.
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12902
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12903 - If the cursor is on a numbered item in a plain list, renumber the
8a4e2269dd99 (org-ctrl-c-ctrl-c): Improved documentation string.
Carsten Dominik <dominik@science.uva.nl>
parents: 69931
diff changeset
12904 ordered list."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12905 (interactive "P")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12906 (let ((org-enable-table-editor t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12907 (cond
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12908 ((and (local-variable-p 'org-finish-function (current-buffer))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12909 (fboundp org-finish-function))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12910 (funcall org-finish-function))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
12911 ((org-on-target-p) (org-update-radio-target-regexp))
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
12912 ((org-on-heading-p) (org-set-tags arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12913 ((org-at-table.el-p)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12914 (require 'table)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12915 (beginning-of-line 1)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12916 (re-search-forward "|" (save-excursion (end-of-line 2) (point)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12917 (table-recognize-table))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12918 ((org-at-table-p)
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12919 (org-table-maybe-eval-formula)
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12920 (if arg
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12921 (org-table-recalculate t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12922 (org-table-maybe-recalculate-line))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12923 (org-table-align))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12924 ((org-at-item-p)
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12925 (org-renumber-ordered-list (prefix-numeric-value arg)))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12926 ((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)"))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12927 (cond
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12928 ((equal (match-string 1) "TBLFM")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12929 ;; Recalculate the table before this line
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12930 (save-excursion
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12931 (beginning-of-line 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12932 (skip-chars-backward " \r\n\t")
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
12933 (if (org-at-table-p) (org-table-recalculate t))))
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12934 (t
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12935 (org-mode-restart))))
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
12936 (t (error "C-c C-c can do nothing useful at this location.")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12937
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12938 (defun org-mode-restart ()
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12939 "Restart Org-mode, to scan again for special lines.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12940 Also updates the keyword regular expressions."
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12941 (interactive)
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12942 (let ((org-inhibit-startup t)) (org-mode))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12943 (message "Org-mode restarted to refresh keyword and special line setup"))
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12944
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12945 (defun org-return ()
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12946 "Goto next table row or insert a newline.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12947 Calls `org-table-next-row' or `newline', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12948 See the individual commands for more information."
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
12949 (interactive)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12950 (cond
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12951 ((org-at-table-p)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12952 (org-table-justify-field-maybe)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12953 (org-table-next-row))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12954 (t (newline))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12955
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12956 (defun org-meta-return (&optional arg)
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12957 "Insert a new heading or wrap a region in a table.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12958 Calls `org-insert-heading' or `org-table-wrap-region', depending on context.
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
12959 See the individual commands for more information."
59539
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12960 (interactive "P")
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12961 (cond
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12962 ((org-at-table-p)
998101ef8562 2005-01-14 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 58841
diff changeset
12963 (org-table-wrap-region arg))
67380
7b2c13a9190d (org-insert-heading): Try to do items before headings.
Carsten Dominik <dominik@science.uva.nl>
parents: 67342
diff changeset
12964 (t (org-insert-heading arg))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12965
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12966 ;;; Menu entries
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12967
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12968 ;; Define the Org-mode menus
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12969 (easy-menu-define org-tbl-menu org-mode-map "Tbl menu"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12970 '("Tbl"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12971 ["Align" org-ctrl-c-ctrl-c (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12972 ["Next Field" org-cycle (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12973 ["Previous Field" org-shifttab (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12974 ["Next Row" org-return (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12975 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12976 ["Blank Field" org-table-blank-field (org-at-table-p)]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12977 ["Edit Field" org-table-edit-field (org-at-table-p)]
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12978 ["Copy Field from Above" org-table-copy-down (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12979 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12980 ("Column"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12981 ["Move Column Left" org-metaleft (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12982 ["Move Column Right" org-metaright (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12983 ["Delete Column" org-shiftmetaleft (org-at-table-p)]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12984 ["Insert Column" org-shiftmetaright (org-at-table-p)]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12985 "--"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
12986 ["Enable Narrowing" (setq org-table-limit-column-width (not org-table-limit-column-width)) :active (org-at-table-p) :selected org-table-limit-column-width :style toggle])
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12987 ("Row"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12988 ["Move Row Up" org-metaup (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12989 ["Move Row Down" org-metadown (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12990 ["Delete Row" org-shiftmetaup (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12991 ["Insert Row" org-shiftmetadown (org-at-table-p)]
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
12992 ["Sort lines in region" org-table-sort-lines (org-at-table-p)]
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12993 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12994 ["Insert Hline" org-table-insert-hline (org-at-table-p)])
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12995 ("Rectangle"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12996 ["Copy Rectangle" org-copy-special (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12997 ["Cut Rectangle" org-cut-special (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12998 ["Paste Rectangle" org-paste-special (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
12999 ["Fill Rectangle" org-table-wrap-region (org-at-table-p)])
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13000 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13001 ("Calculate"
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
13002 ["Set Column Formula" org-table-eval-formula (org-at-table-p)]
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
13003 ["Set Named Field Formula" (org-table-eval-formula '(4)) :active (org-at-table-p) :keys "C-u C-c ="]
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
13004 ["Edit Formulas" org-table-edit-formulas (org-at-table-p)]
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
13005 "--"
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13006 ["Recalculate line" org-table-recalculate (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13007 ["Recalculate all" (lambda () (interactive) (org-table-recalculate '(4))) :active (org-at-table-p) :keys "C-u C-c *"]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13008 ["Toggle Recalculate Mark" org-table-rotate-recalc-marks (org-at-table-p)]
64515
3f75dfc753c0 (org-table-column-names, org-table-column-name-regexp)
Carsten Dominik <dominik@science.uva.nl>
parents: 64084
diff changeset
13009 "--"
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
13010 ["Sum Column/Rectangle" org-table-sum
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13011 (or (org-at-table-p) (org-region-active-p))]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13012 ["Which Column?" org-table-current-column (org-at-table-p)])
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13013 ["Debug Formulas"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13014 (setq org-table-formula-debug (not org-table-formula-debug))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13015 :style toggle :selected org-table-formula-debug]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13016 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13017 ["Create" org-table-create (and (not (org-at-table-p))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13018 org-enable-table-editor)]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13019 ["Convert Region" org-table-convert-region (not (org-at-table-p 'any))]
63832
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13020 ["Import from File" org-table-import (not (org-at-table-p))]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13021 ["Export to File" org-table-export (org-at-table-p)]
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13022 "--"
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13023 ["Create/Convert from/to table.el" org-table-create-with-table.el t]))
d367f23e6db1 (orgtbl-setup): New function, for delayed
Carsten Dominik <dominik@science.uva.nl>
parents: 63431
diff changeset
13024
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13025 (easy-menu-define org-org-menu org-mode-map "Org menu"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13026 '("Org"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13027 ["Cycle Visibility" org-cycle (or (bobp) (outline-on-heading-p))]
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
13028 ["Cycle Global Visibility" org-shifttab (not (org-at-table-p))]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13029 ["Sparse Tree" org-occur t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13030 ["Show All" show-all t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13031 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13032 ["New Heading" org-insert-heading t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13033 ("Navigate Headings"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13034 ["Up" outline-up-heading t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13035 ["Next" outline-next-visible-heading t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13036 ["Previous" outline-previous-visible-heading t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13037 ["Next Same Level" outline-forward-same-level t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13038 ["Previous Same Level" outline-backward-same-level t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13039 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13040 ["Jump" org-goto t])
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13041 ("Edit Structure"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13042 ["Move Subtree Up" org-shiftmetaup (not (org-at-table-p))]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13043 ["Move Subtree Down" org-shiftmetadown (not (org-at-table-p))]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13044 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13045 ["Copy Subtree" org-copy-special (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13046 ["Cut Subtree" org-cut-special (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13047 ["Paste Subtree" org-paste-special (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13048 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13049 ["Promote Heading" org-metaleft (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13050 ["Promote Subtree" org-shiftmetaleft (not (org-at-table-p))]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13051 ["Demote Heading" org-metaright (not (org-at-table-p))]
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
13052 ["Demote Subtree" org-shiftmetaright (not (org-at-table-p))]
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
13053 "--"
69224
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13054 ["Archive Subtree" org-archive-subtree t]
e80276821f75 (org-export-as-html): Fixed bugs in HTML
Carsten Dominik <dominik@science.uva.nl>
parents: 69121
diff changeset
13055 "--"
69454
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13056 ["Convert to odd levels" org-convert-to-odd-levels t]
d60237bf3ccc (org-link-search): Avoid self-matching of links, allow
Carsten Dominik <dominik@science.uva.nl>
parents: 69319
diff changeset
13057 ["Convert to odd/even levels" org-convert-to-oddeven-levels t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13058 "--"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13059 ("TODO Lists"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13060 ["TODO/DONE/-" org-todo t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13061 ["Show TODO Tree" org-show-todo-tree t]
67342
5790642c4a89 (org-occur-highlights): New variable.
Carsten Dominik <dominik@science.uva.nl>
parents: 67105
diff changeset
13062 ["Global TODO list" org-todo-list t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13063 "--"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13064 ["Set Priority" org-priority t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13065 ["Priority Up" org-shiftup t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13066 ["Priority Down" org-shiftdown t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13067 ("Dates and Scheduling"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13068 ["Timestamp" org-time-stamp t]
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
13069 ["Timestamp (inactive)" org-time-stamp-inactive t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13070 ("Change Date"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13071 ["1 Day Later" org-timestamp-up-day t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13072 ["1 Day Earlier" org-timestamp-down-day t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13073 ["1 ... Later" org-shiftup t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13074 ["1 ... Earlier" org-shiftdown t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13075 ["Compute Time Range" org-evaluate-time-range t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13076 ["Schedule Item" org-schedule t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13077 ["Deadline" org-deadline t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13078 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13079 ["Goto Calendar" org-goto-calendar t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13080 ["Date from Calendar" org-date-from-calendar t])
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13081 "--"
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
13082 ["Agenda Command" org-agenda t]
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
13083 ("File List for Agenda")
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
13084 ("Special views current file"
67612
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
13085 ["TODO Tree" org-show-todo-tree t]
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
13086 ["Check Deadlines" org-check-deadlines t]
58d7532b2ef1 (org-tags-match-list-sublevels): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67535
diff changeset
13087 ["Timeline" org-timeline t]
67692
f30b7a47672e (org-agenda-custom-commands): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 67612
diff changeset
13088 ["Tags Tree" org-tags-sparse-tree t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13089 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13090 ("Hyperlinks"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13091 ["Store Link (Global)" org-store-link t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13092 ["Insert Link" org-insert-link t]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13093 ["Follow Link" org-open-at-point t]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13094 "--"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13095 ["Descriptive Links"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13096 (progn (org-add-to-invisibility-spec '(org-link)) (org-restart-font-lock))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13097 :style radio :selected (member '(org-link) buffer-invisibility-spec)]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13098 ["Literal Links"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13099 (progn
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13100 (org-remove-from-invisibility-spec '(org-link)) (org-restart-font-lock))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13101 :style radio :selected (not (member '(org-link) buffer-invisibility-spec))]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13102 "--"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13103 ["Upgrade all <link> to [[link][desc]]" org-upgrade-old-links
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13104 (save-excursion (goto-char (point-min))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13105 (re-search-forward "<[a-z]+:" nil t))])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13106 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13107 ("Export"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13108 ["ASCII" org-export-as-ascii t]
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13109 ["Extract Visible Text" org-export-copy-visible t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13110 ["HTML" org-export-as-html t]
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13111 ["HTML and Open" org-export-as-html-and-open t]
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13112 ["XML (XOXO)" org-export-as-xml t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13113 "--"
66262
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
13114 ["iCalendar this file" org-export-icalendar-this-file t]
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
13115 ["iCalendar all agenda files" org-export-icalendar-all-agenda-files
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
13116 :active t :keys "C-c C-x C-i"]
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
13117 ["iCalendar combined" org-export-icalendar-combine-agenda-files t]
c3855d669e33 * textmodes/org.el (org-combined-agenda-icalendar-file)
Carsten Dominik <dominik@science.uva.nl>
parents: 66224
diff changeset
13118 "--"
61560
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13119 ["Option Template" org-insert-export-options-template t]
a54fc673c31c (org-agenda-date-prompt): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 61312
diff changeset
13120 ["Toggle Fixed Width" org-toggle-fixed-width-section t])
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13121 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13122 ("Documentation"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13123 ["Show Version" org-version t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13124 ["Info Documentation" org-info t])
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13125 ("Customize"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13126 ["Browse Org Group" org-customize t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13127 "--"
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13128 ["Expand This Menu" org-create-customize-menu
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13129 (fboundp 'customize-menu-create)])
65654
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
13130 "--"
4a2301f2a9bb * textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
Carsten Dominik <dominik@science.uva.nl>
parents: 65638
diff changeset
13131 ["Refresh setup" org-mode-restart t]
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13132 ))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13133
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13134 (defun org-info (&optional node)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13135 "Read documentation for Org-mode in the info system.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13136 With optional NODE, go directly to that node."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13137 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13138 (require 'info)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13139 (Info-goto-node (format "(org)%s" (or node ""))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13140
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13141 (defun org-install-agenda-files-menu ()
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13142 (let ((bl (buffer-list)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13143 (save-excursion
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13144 (while bl
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13145 (set-buffer (pop bl))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13146 (if (eq major-mode 'org-mode) (setq bl nil)))
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13147 (when (eq major-mode 'org-mode)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13148 (easy-menu-change
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13149 '("Org") "File List for Agenda"
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13150 (append
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13151 (list
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13152 ["Edit File List" (org-edit-agenda-file-list) t]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13153 ["Add/Move Current File to Front of List" org-agenda-file-to-front t]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13154 ["Remove Current File from List" org-remove-file t]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13155 ["Cycle through agenda files" org-cycle-agenda-files t]
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13156 "--")
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13157 (mapcar 'org-file-menu-entry (org-agenda-files t))))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13158
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13159 ;;; Documentation
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13160
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13161 (defun org-customize ()
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13162 "Call the customize function with org as argument."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13163 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13164 (customize-browse 'org))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13165
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13166 (defun org-create-customize-menu ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13167 "Create a full customization menu for Org-mode, insert it into the menu."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13168 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13169 (if (fboundp 'customize-menu-create)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13170 (progn
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13171 (easy-menu-change
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13172 '("Org") "Customize"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13173 `(["Browse Org group" org-customize t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13174 "--"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13175 ,(customize-menu-create 'org)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13176 ["Set" Custom-set t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13177 ["Save" Custom-save t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13178 ["Reset to Current" Custom-reset-current t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13179 ["Reset to Saved" Custom-reset-saved t]
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13180 ["Reset to Standard Settings" Custom-reset-standard t]))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13181 (message "\"Org\"-menu now contains full customization menu"))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13182 (error "Cannot expand menu (outdated version of cus-edit.el)")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13183
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13184 ;;; Miscellaneous stuff
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13185
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13186 (defun org-move-line-down (arg)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13187 "Move the current line down. With prefix argument, move it past ARG lines."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13188 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13189 (let ((col (current-column))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13190 beg end pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13191 (beginning-of-line 1) (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13192 (beginning-of-line 2) (setq end (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13193 (beginning-of-line (+ 1 arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13194 (setq pos (move-marker (make-marker) (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13195 (insert (delete-and-extract-region beg end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13196 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13197 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13198
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13199 (defun org-move-line-up (arg)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13200 "Move the current line up. With prefix argument, move it past ARG lines."
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13201 (interactive "p")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13202 (let ((col (current-column))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13203 beg end pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13204 (beginning-of-line 1) (setq beg (point))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13205 (beginning-of-line 2) (setq end (point))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13206 (beginning-of-line (- arg))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13207 (setq pos (move-marker (make-marker) (point)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13208 (insert (delete-and-extract-region beg end))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13209 (goto-char pos)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13210 (move-to-column col)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13211
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13212 ;; Paragraph filling stuff.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13213 ;; We want this to be just right, so use the full arsenal.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13214 ;; FIXME: This very likely does not work correctly for XEmacs, because the
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13215 ;; filladapt package works slightly differently.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13216
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13217 (defun org-set-autofill-regexps ()
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13218 (interactive)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13219 ;; In the paragraph separator we include headlines, because filling
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13220 ;; text in a line directly attached to a headline would otherwise
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13221 ;; fill the headline as well.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13222 (set (make-local-variable 'paragraph-separate) "\f\\|\\*\\|[ ]*$\\|[ \t]*[:|]")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13223 ;; The paragraph starter includes hand-formatted lists.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13224 (set (make-local-variable 'paragraph-start)
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
13225 "\f\\|[ ]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*]\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]")
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13226 ;; Inhibit auto-fill for headers, tables and fixed-width lines.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13227 ;; But only if the user has not turned off tables or fixed-width regions
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13228 (set (make-local-variable 'auto-fill-inhibit-regexp)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13229 (concat "\\*\\|#"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13230 (if (or org-enable-table-editor org-enable-fixed-width-editor)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13231 (concat
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13232 "\\|[ \t]*["
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13233 (if org-enable-table-editor "|" "")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13234 (if org-enable-fixed-width-editor ":" "")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13235 "]"))))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13236 ;; We use our own fill-paragraph function, to make sure that tables
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13237 ;; and fixed-width regions are not wrapped. That function will pass
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13238 ;; through to `fill-paragraph' when appropriate.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13239 (set (make-local-variable 'fill-paragraph-function) 'org-fill-paragraph)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13240 ;; Adaptive filling: To get full control, first make sure that
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13241 ;; `adaptive-fill-regexp' never matches. Then install our won matcher.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13242 (setq adaptive-fill-regexp "\000")
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13243 (setq adaptive-fill-function 'org-adaptive-fill-function))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13244
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13245 (defun org-fill-paragraph (&optional justify)
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13246 "Re-align a table, pass through to fill-paragraph if no table."
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13247 (let ((table-p (org-at-table-p))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13248 (table.el-p (org-at-table.el-p)))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13249 (cond ((equal (char-after (point-at-bol)) ?*) t) ; skip headlines
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13250 (table.el-p t) ; skip table.el tables
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13251 (table-p (org-table-align) t) ; align org-mode tables
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13252 (t nil)))) ; call paragraph-fill
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13253
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13254 ;; For reference, this is the default value of adaptive-fill-regexp
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13255 ;; "[ \t]*\\([-|#;>*]+[ \t]*\\|(?[0-9]+[.)][ \t]*\\)*"
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13256
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13257 (defun org-adaptive-fill-function ()
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13258 "Return a fill prefix for org-mode files.
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13259 In particular, this makes sure hanging paragraphs for hand-formatted lists
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13260 work correctly."
67105
7286e01feef0 (org-export-plain-list-max-depth): Renamed from
Carsten Dominik <dominik@science.uva.nl>
parents: 66987
diff changeset
13261 (if (looking-at " *\\([-*+] \\|[0-9]+[.)] \\)?")
66987
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13262 (make-string (- (match-end 0) (match-beginning 0)) ?\ )))
4da59b0dd54b (org-table-sort-lines): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 66741
diff changeset
13263
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13264 ;; Functions needed for Emacs/XEmacs region compatibility
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13265
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13266 (defun org-add-hook (hook function &optional append local)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13267 "Add-hook, compatible with both Emacsen."
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13268 (if (and local (featurep 'xemacs))
69116
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13269 (add-local-hook hook function append)
79fc120cc4c1 (org-cleaned-string-for-export, org-solidify-link-text):
Carsten Dominik <dominik@science.uva.nl>
parents: 69088
diff changeset
13270 (add-hook hook function append local)))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13271
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13272 (defun org-region-active-p ()
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13273 "Is `transient-mark-mode' on and the region active?
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13274 Works on both Emacs and XEmacs."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13275 (if org-ignore-region
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13276 nil
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13277 (if (featurep 'xemacs)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13278 (and zmacs-regions (region-active-p))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13279 (and transient-mark-mode mark-active))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13280
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13281 (defun org-add-to-invisibility-spec (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13282 "Add elements to `buffer-invisibility-spec'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13283 See documentation for `buffer-invisibility-spec' for the kind of elements
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13284 that can be added."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13285 (cond
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13286 ((fboundp 'add-to-invisibility-spec)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13287 (add-to-invisibility-spec arg))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13288 ((or (null buffer-invisibility-spec) (eq buffer-invisibility-spec t))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13289 (setq buffer-invisibility-spec (list arg)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13290 (t
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13291 (setq buffer-invisibility-spec
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13292 (cons arg buffer-invisibility-spec)))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13293
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13294 (defun org-remove-from-invisibility-spec (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13295 "Remove elements from `buffer-invisibility-spec'."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13296 (if (fboundp 'remove-from-invisibility-spec)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13297 (remove-from-invisibility-spec arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13298 (if (consp buffer-invisibility-spec)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13299 (setq buffer-invisibility-spec
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13300 (delete arg buffer-invisibility-spec)))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13301
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13302 (defun org-in-invisibility-spec-p (arg)
68478
61b78b1445bf (org-allow-space-in-links, org-closed-string, org-quote-string,
Juanma Barranquero <lekktu@gmail.com>
parents: 68294
diff changeset
13303 "Is ARG a member of `buffer-invisibility-spec'?"
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13304 (if (consp buffer-invisibility-spec)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13305 (member arg buffer-invisibility-spec)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13306 nil))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13307
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13308 (defun org-image-file-name-regexp ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13309 "Return regexp matching the file names of images."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13310 (if (fboundp 'image-file-name-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13311 (image-file-name-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13312 (let ((image-file-name-extensions
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13313 '("png" "jpeg" "jpg" "gif" "tiff" "tif"
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13314 "xbm" "xpm" "pbm" "pgm" "ppm")))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13315 (concat "\\."
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13316 (regexp-opt (nconc (mapcar 'upcase
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13317 image-file-name-extensions)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13318 image-file-name-extensions)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13319 t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13320 "\\'"))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13321
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13322 ;; Functions needed for compatibility with old outline.el.
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13323
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13324 ;; Programming for the old outline.el (that uses selective display
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13325 ;; instead of `invisible' text properties) is a nightmare, mostly
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13326 ;; because regular expressions can no longer be anchored at
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13327 ;; beginning/end of line. Therefore a number of function need special
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13328 ;; treatment when the old outline.el is being used.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13329
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13330 ;; The following functions capture almost the entire compatibility code
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13331 ;; between the different versions of outline-mode. The only other
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13332 ;; places where this is important are the font-lock-keywords, and in
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13333 ;; `org-export-copy-visible'. Search for `org-noutline-p' to find them.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13334
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13335 ;; C-a should go to the beginning of a *visible* line, also in the
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13336 ;; new outline.el. I guess this should be patched into Emacs?
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13337 (defun org-beginning-of-line ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13338 "Go to the beginning of the current line. If that is invisible, continue
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13339 to a visible line beginning. This makes the function of C-a more intuitive."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13340 (interactive)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13341 (beginning-of-line 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13342 (if (bobp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13343 nil
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13344 (backward-char 1)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13345 (if (org-invisible-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13346 (while (and (not (bobp)) (org-invisible-p))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13347 (backward-char 1)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13348 (beginning-of-line 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13349 (forward-char 1))))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13350
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13351 (when org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13352 (define-key org-mode-map "\C-a" 'org-beginning-of-line))
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13353 ;; FIXME: should I use substitute-key-definition to reach other bindings
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13354 ;; of beginning-of-line?
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13355
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13356 (defun org-invisible-p ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13357 "Check if point is at a character currently not visible."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13358 (if org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13359 ;; Early versions of noutline don't have `outline-invisible-p'.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13360 (if (fboundp 'outline-invisible-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13361 (outline-invisible-p)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13362 (get-char-property (point) 'invisible))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13363 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13364 (skip-chars-backward "^\r\n")
62546
153ddc124932 (org-agenda-toggle-time-grid): New command.
Carsten Dominik <dominik@science.uva.nl>
parents: 62087
diff changeset
13365 (equal (char-before) ?\r))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13366
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13367 (defun org-invisible-p2 ()
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13368 "Check if point is at a character currently not visible."
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13369 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13370 (if org-noutline-p
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13371 (progn
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13372 (if (and (eolp) (not (bobp))) (backward-char 1))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13373 ;; Early versions of noutline don't have `outline-invisible-p'.
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13374 (if (fboundp 'outline-invisible-p)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13375 (outline-invisible-p)
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13376 (get-char-property (point) 'invisible)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13377 (skip-chars-backward "^\r\n")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13378 (equal (char-before) ?\r))))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13379
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13380 (defun org-back-to-heading (&optional invisible-ok)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13381 "Move to previous heading line, or beg of this line if it's a heading.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13382 Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13383 (if org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13384 (outline-back-to-heading invisible-ok)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13385 (if (and (memq (char-before) '(?\n ?\r))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13386 (looking-at outline-regexp))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13387 t
63359
add99bfc904a (org-CUA-compatible): New option.
Carsten Dominik <dominik@science.uva.nl>
parents: 63225
diff changeset
13388 (if (re-search-backward (concat (if invisible-ok "\\([\r\n]\\|^\\)" "^")
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13389 outline-regexp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13390 nil t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13391 (if invisible-ok
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13392 (progn (goto-char (match-end 1))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13393 (looking-at outline-regexp)))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13394 (error "Before first heading")))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13395
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13396 (defun org-on-heading-p (&optional invisible-ok)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13397 "Return t if point is on a (visible) heading line.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13398 If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13399 (if org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13400 (outline-on-heading-p 'invisible-ok)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13401 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13402 (skip-chars-backward "^\n\r")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13403 (and (looking-at outline-regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13404 (or invisible-ok
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13405 (bobp)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13406 (equal (char-before) ?\n))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13407
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13408 (defun org-on-target-p ()
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13409 (let ((pos (point)))
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13410 (save-excursion
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13411 (skip-chars-forward "<")
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13412 (and (re-search-backward "<<" nil t)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13413 (or (looking-at org-radio-target-regexp)
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13414 (looking-at org-target-regexp))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13415 (<= (match-beginning 0) pos)
69931
9544ae02c58d (org-export-plain-list-max-depth)
Carsten Dominik <dominik@science.uva.nl>
parents: 69685
diff changeset
13416 (>= (1+ (match-end 0)) pos)))))
69088
1e05f30609d3 (org-mark-ring-previous, org-mark-ring-set): New
Carsten Dominik <dominik@science.uva.nl>
parents: 68648
diff changeset
13417
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13418 (defun org-up-heading-all (arg)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13419 "Move to the heading line of which the present line is a subheading.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13420 This function considers both visible and invisible heading lines.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13421 With argument, move up ARG levels."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13422 (if org-noutline-p
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
13423 (if (fboundp 'outline-up-heading-all)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13424 (outline-up-heading-all arg) ; emacs 21 version of outline.el
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13425 (outline-up-heading arg t)) ; emacs 22 version of outline.el
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13426 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13427 (looking-at outline-regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13428 (if (<= (- (match-end 0) (match-beginning 0)) arg)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13429 (error "Cannot move up %d levels" arg)
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13430 (re-search-backward
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13431 (concat "[\n\r]" (regexp-quote
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13432 (make-string (- (match-end 0) (match-beginning 0) arg)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13433 ?*))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13434 "[^*]"))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13435 (forward-char 1))))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13436
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13437 (defun org-show-hidden-entry ()
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13438 "Show an entry where even the heading is hidden."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13439 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13440 (if (not org-noutline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13441 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13442 (org-back-to-heading t)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13443 (org-flag-heading nil)))
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13444 (org-show-entry)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13445
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13446 (defun org-check-occur-regexp (regexp)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13447 "If REGEXP starts with \"^\", modify it to check for \\r as well.
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13448 Of course, only for the old outline mode."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13449 (if org-noutline-p
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13450 regexp
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13451 (if (string-match "^\\^" regexp)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13452 (concat "[\n\r]" (substring regexp 1))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13453 regexp)))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13454
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13455 (defun org-flag-heading (flag &optional entry)
62076
4f2150e05f24 (org-get-entries-from-diary): Remove unused vars.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61924
diff changeset
13456 "Flag the current heading. FLAG non-nil means make invisible.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13457 When ENTRY is non-nil, show the entire entry."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13458 (save-excursion
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13459 (org-back-to-heading t)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13460 (if (not org-noutline-p)
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13461 ;; Make the current headline visible
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13462 (outline-flag-region (max 1 (1- (point))) (point) (if flag ?\r ?\n)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13463 ;; Check if we should show the entire entry
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13464 (if entry
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13465 (progn
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13466 (org-show-entry)
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13467 (save-excursion ;; FIXME: Is this the fix for points in the -|
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13468 ;; middle of text? |
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13469 (and (outline-next-heading) ;; |
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13470 (org-flag-heading nil)))) ; show the next heading _|
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13471 (outline-flag-region (max 1 (1- (point)))
64080
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13472 (save-excursion (outline-end-of-heading) (point))
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13473 (if org-noutline-p
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13474 flag
d5372215b17d Leading space replaced by TABS.
Carsten Dominik <dominik@science.uva.nl>
parents: 64078
diff changeset
13475 (if flag ?\r ?\n))))))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13476
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13477 (defun org-end-of-subtree (&optional invisible-OK)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13478 ;; This is an exact copy of the original function, but it uses
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13479 ;; `org-back-to-heading', to make it work also in invisible
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13480 ;; trees. And is uses an invisible-OK argument.
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13481 ;; Under Emacs this is not needed, but the old outline.el needs this fix.
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13482 (org-back-to-heading invisible-OK)
68245
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13483 (let ((first t)
68031
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13484 (level (funcall outline-level)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13485 (while (and (not (eobp))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13486 (or first (> (funcall outline-level) level)))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13487 (setq first nil)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13488 (outline-next-heading))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13489 (if (memq (preceding-char) '(?\n ?\^M))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13490 (progn
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13491 ;; Go to end of line before heading
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13492 (forward-char -1)
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13493 (if (memq (preceding-char) '(?\n ?\^M))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13494 ;; leave blank line before heading
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13495 (forward-char -1))))))
f556787bf755 (org-end-of-subtree): New function.
Carsten Dominik <dominik@science.uva.nl>
parents: 67692
diff changeset
13496
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13497 (defun org-show-subtree ()
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13498 "Show everything after this heading at deeper levels."
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
13499 (outline-flag-region
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
13500 (point)
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13501 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13502 (outline-end-of-subtree) (outline-next-heading) (point))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13503 (if org-noutline-p nil ?\n)))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13504
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13505 (defun org-show-entry ()
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13506 "Show the body directly following this heading.
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13507 Show the heading too, if it is currently invisible."
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13508 (interactive)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13509 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13510 (org-back-to-heading t)
63902
0b526dc24ccb (org-agenda-start-on-weekday, org-calendar-to-agenda-key,
Juanma Barranquero <lekktu@gmail.com>
parents: 63832
diff changeset
13511 (outline-flag-region
61924
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13512 (1- (point))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13513 (save-excursion
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13514 (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move)
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13515 (or (match-beginning 1) (point-max)))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13516 (if org-noutline-p nil ?\n))))
d29accb0274a Many small changes to keep the byte compiler happy. Furthermore:
Carsten Dominik <dominik@science.uva.nl>
parents: 61582
diff changeset
13517
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13518 (defun org-make-options-regexp (kwds)
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13519 "Make a regular expression for keyword lines."
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13520 (concat
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13521 (if org-noutline-p "^" "[\n\r]")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13522 "#?[ \t]*\\+\\("
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13523 (mapconcat 'regexp-quote kwds "\\|")
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13524 "\\):[ \t]*"
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13525 (if org-noutline-p "\\(.+\\)" "\\([^\n\r]+\\)")))
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13526
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13527 ;; Make `bookmark-jump' show the jump location if it was hidden.
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13528 (eval-after-load "bookmark"
65243
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13529 '(if (boundp 'bookmark-after-jump-hook)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13530 ;; We can use the hook
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13531 (add-hook 'bookmark-after-jump-hook 'org-bookmark-jump-unhide)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13532 ;; Hook not available, use advice
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13533 (defadvice bookmark-jump (after org-make-visible activate)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13534 "Make the position visible."
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13535 (org-bookmark-jump-unhide))))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13536
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13537 (defun org-bookmark-jump-unhide ()
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13538 "Unhide the current position, to show the bookmark location."
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13539 (and (eq major-mode 'org-mode)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13540 (or (org-invisible-p)
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13541 (save-excursion (goto-char (max (point-min) (1- (point))))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13542 (org-invisible-p)))
d0087dcb8981 (org-special-keyword): New face.
Carsten Dominik <dominik@science.uva.nl>
parents: 64751
diff changeset
13543 (org-show-hierarchy-above)))
58792
265139cbc47c New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13544
68245
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13545 ;;; Finish up
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13546
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13547 (provide 'org)
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13548
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13549 (run-hooks 'org-load-hook)
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13550
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13551 ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
1a47b5a03b4a Move defvars out of eval-when-compile. Move code
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 68175
diff changeset
13552 ;;; org.el ends here
70010
c49248393916 (org-set-regexps-and-options, org-get-current-options):
Carsten Dominik <dominik@science.uva.nl>
parents: 70009
diff changeset
13553